Detection method based on adaptive time-frequency feature extraction for attack behavior tracking
By dividing network traffic into subsequences and optimizing wavelet transform parameters, combined with the feature fusion of the attention module, the problem of low accuracy in detecting low signal-to-noise ratio attack traffic is solved and more efficient attack traffic identification is achieved.
Patent Information
- Application Number
- CN202410852478.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-27
AI Technical Summary
Existing technologies are difficult to effectively detect low signal-to-noise ratio attack traffic because traditional methods are difficult to distinguish attack traffic from normal traffic, and the accuracy of wavelet transform depends on the selection of wavelet transform parameters.
By dividing the network traffic to be detected into multiple traffic sub-sequences, the target wavelet transform parameters (wavelet basis, number of layers and scale parameters) are determined based on the data in different frequency ranges in each sub-sequence, and multi-layer wavelet transform and gradient optimization algorithms are used Adjust these parameters to improve the accuracy of feature extraction. Then, an attention module is used to fuse multiple layers of time-frequency features to determine the detection results.
It improves the accuracy of low signal-to-noise ratio attack traffic detection, can more effectively distinguish attack traffic from normal traffic, and enhances the accuracy of detection results.
Smart Images

Figure CN118400203B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a detection method based on adaptive time-frequency feature extraction for attack behavior tracking. Background Art
[0002] In network communications, low signal-to-noise ratio attack traffic refers to the situation where attack traffic is mixed with normal traffic and is difficult to distinguish effectively. Since the number of attack packets in low signal-to-noise ratio attack traffic is relatively small and mixed with a large number of legitimate network communications, it is difficult for traditional detection methods based on traffic statistics to detect attack behaviors. Although wavelet transform can be used in related technologies to detect low signal-to-noise ratio attack traffic in network traffic, the accuracy of the detection results still needs to be improved. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides a detection method, device, equipment, medium and product based on adaptive time-frequency feature extraction for attack behavior tracking.
[0004] According to a first aspect of the present disclosure, a detection method based on adaptive time-frequency feature extraction for attack behavior tracking is provided, the method comprising:
[0005] The network traffic to be detected is divided into multiple traffic subsequences; for each traffic subsequence, the traffic subsequence is wavelet transformed using target wavelet transform parameters to obtain a first feature set, wherein the target wavelet transform parameters include a wavelet basis, a number of layers and a scale parameter, and the target wavelet transform parameters are determined based on data in different frequency ranges in the traffic subsequence; based on the fusion features of all the first feature sets, a detection result of the network traffic to be detected is determined, and the detection result is used to indicate whether the network traffic to be detected contains low signal-to-noise ratio attack traffic.
[0006] In some embodiments, the target wavelet transform parameters are determined according to the following steps: performing multi-layer wavelet transform on the traffic subsequence, reconstructing the traffic in each layer according to the high-frequency subsequence and the low-frequency subsequence obtained by wavelet transform, and adjusting the wavelet basis and scale parameters of each layer through a gradient optimization algorithm with the goal of minimizing the difference in the reconstructed traffic, so as to obtain the target wavelet transform parameters.
[0007] In some embodiments, the method of performing multi-layer wavelet transform on the flow subsequence, reconstructing the flow in each layer according to the high-frequency subsequence and the low-frequency subsequence obtained by wavelet transform, and adjusting the wavelet basis and scale parameters of each layer through a gradient optimization algorithm with the goal of minimizing the difference in the reconstructed flow to obtain the target wavelet transform parameters, includes: i The wavelet basis and scale parameters of the layer iThe low-frequency subsequence in the -1 layer is transformed by wavelet transform to obtain i The low-frequency subsequence and high-frequency subsequence of the layer, where i Greater than or equal to 2, and i is less than n, i and n are both positive integers. i= 1, the wavelet basis and scale parameters of the first layer are initial values, and the i -1 layer low frequency subsequence refers to the flow subsequence; i The high-frequency subsequence and low-frequency subsequence of the layer, and the i The high-frequency subsequences of all layers before the first layer reconstruct the traffic, and determine the reconstruction error according to the reconstructed traffic and the traffic subsequence; adjust the first layer by the gradient optimization algorithm i The wavelet basis and scale parameters of the layer are determined, and the wavelet basis and scale parameters corresponding to the minimum reconstruction error are used as the wavelet basis and scale parameters of the i+1th layer; after the adjustment of the wavelet basis and scale parameters of all layers is completed, the layer number with the minimum reconstruction error and the wavelet basis and scale parameters of the layer are determined as the target wavelet transform parameters.
[0008] In the case where the first feature set includes multiple layers of time-frequency features, determining the detection result of the network traffic to be detected based on the fusion features of all the first feature sets includes: using the attention module corresponding to each first feature set to obtain the weight of each layer of time-frequency features in the first feature set, the attention module corresponds to the first feature set one by one; according to each layer of time-frequency features in each first feature set and the weight of each layer of time-frequency features, all the first feature sets are fused to obtain fused features; and determining the detection result of the network traffic to be detected based on the fused features.
[0009] In some embodiments, the method also includes: before detecting the network traffic to be detected, obtaining currently allocatable resources and a target indicator value, wherein the target indicator value is used to characterize the system performance after allocating computing resources to the network traffic to be detected, and the system performance is determined based on the throughput, latency, resource utilization and overhead of an accelerator running the network traffic detection method; if the currently allocatable resources are greater than or equal to the computing resources required to complete the detection task, and the target indicator value meets preset conditions, then computing resources are allocated to the network traffic to be detected.
[0010] According to a second aspect of the present disclosure, a detection device based on adaptive time-frequency feature extraction for attack behavior tracking is provided, the device comprising:
[0011] A division unit is used to divide the network traffic to be detected into multiple traffic subsequences; a feature extraction unit is used to perform wavelet transform on each traffic subsequence using target wavelet transform parameters to obtain a first feature set, wherein the target wavelet transform parameters include a wavelet basis, a number of layers and a scale parameter, and the target wavelet transform parameters are determined based on data in different frequency ranges in the traffic subsequences; a detection unit is used to determine a detection result of the network traffic to be detected based on the fusion features of all the first feature sets, and the detection result is used to indicate whether the network traffic to be detected contains low signal-to-noise ratio attack traffic.
[0012] According to a third aspect of the present disclosure, an electronic device is provided, the device comprising: a processor; and a memory for storing instructions executable by the processor to execute any of the methods described in the present disclosure.
[0013] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, any method described in the present disclosure is implemented.
[0014] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program and instructions, wherein the computer program / instructions are executed by a processor to implement any of the methods described above.
[0015] The technical solution provided by the present disclosure may include the following beneficial effects: dividing the network traffic data to be detected into multiple traffic subsequences, for each traffic subsequence, using the target wavelet transform parameters (i.e., wavelet basis, number of layers, and scale parameters) obtained by optimizing the data in different frequency ranges in the traffic subsequence, performing wavelet transform on the traffic subsequence to obtain a first feature set, and determining the detection result of the network traffic to be detected based on the fusion features of all the first feature sets. The present disclosure determines the target wavelet transform parameters for wavelet transforming the traffic subsequence based on the data in different frequency ranges in the traffic subsequence for the traffic subsequence within each window, thereby improving the accuracy of feature extraction using wavelet transform, and further improving the accuracy of the detection result.
[0016] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description, are used to explain the technical solutions of the present disclosure.
[0018] Figure 1It is a flowchart of a detection method based on adaptive time-frequency feature extraction for attack behavior tracking according to an exemplary embodiment of the present disclosure.
[0019] Figure 2 The present disclosure is a flowchart showing a method of determining target wavelet transform parameters according to an exemplary embodiment.
[0020] Figure 3a It is a framework diagram of a characteristic anchorage model shown in the present disclosure according to an exemplary embodiment.
[0021] Figure 3b It is a framework diagram of an attention-based multi-layer collaborative model shown in the present disclosure according to an exemplary embodiment.
[0022] Figure 4 It is a system framework diagram shown in the present disclosure according to an exemplary embodiment.
[0023] Figure 5 It is a schematic structural diagram of a detection device according to an exemplary embodiment of the present disclosure.
[0024] Figure 6 It is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0026] Since low signal-to-noise ratio attack traffic is mixed in a large amount of normal traffic, it is difficult to detect. For example, covert attacks such as LDoS (Low-rate Denial of Service) and tunnel scanning have traffic characteristics similar to normal traffic, so they will not be intercepted by traditional firewall systems. For another example, in evasion attacks, attackers will deliberately inject different types of noise packets into the attack traffic. These packets are usually generated by various benign applications in order to imitate normal network activities and thus evade detection by intrusion detection systems. Although wavelet transform can be used in related technologies to detect low signal-to-noise ratio attack traffic in network traffic, the accuracy of the wavelet transform analysis results depends on the selection of wavelet transform parameters.
[0027] Based on this, the present disclosure provides a network traffic detection method, which divides the network traffic to be detected into multiple traffic subsequences. For the traffic subsequence in each time window, the wavelet transform parameters when performing wavelet transform on the traffic subsequence are determined according to the data of different frequency ranges contained in the traffic subsequence, thereby improving the accuracy of feature extraction using wavelet transform, and further improving the accuracy of the detection results obtained according to the extracted features.
[0028] The following embodiments will specifically illustrate a network traffic detection method provided by the present disclosure in conjunction with the accompanying drawings.
[0029] Figure 1 is a flow chart of a detection method based on adaptive time-frequency feature extraction for attack behavior tracking according to an exemplary embodiment of the present disclosure, such as Figure 1 As shown, the network traffic detection method may include the following steps 101 to 103.
[0030] In step 101, the network traffic to be detected is divided into a plurality of traffic sub-sequences.
[0031] In this embodiment, a sliding time window can be used to divide the network traffic to be detected into multiple traffic subsequences with different time spans. The size of the time window and the sliding step length are set according to actual needs and are not limited here.
[0032] Those skilled in the art should understand that, in addition to using a sliding time window for division, the network traffic to be detected may also be divided into equal parts to obtain multiple traffic subsequences.
[0033] In step 102, for each traffic subsequence, a wavelet transform is performed on the traffic subsequence using a target wavelet transform parameter to obtain a first feature set.
[0034] The target wavelet transform parameters include wavelet basis, number of layers and scale parameters. In wavelet transform, the traffic subsequence will be decomposed into subspace sequences of different layers, and each subspace represents different frequency components of the signal. If the wavelet transform parameters are not selected properly, the subspace sequence will not be able to characterize the attack characteristics well, which may eventually lead to the omission of attack traffic. Therefore, in order to improve the detection accuracy, it is necessary to determine the best wavelet transform parameters for each traffic subsequence, that is, the target wavelet transform parameters. This embodiment realizes the adaptive determination of the target wavelet transform parameters from the perspective of the different network traffic contained in different traffic subsequences. It should be noted that the network traffic in the same traffic subsequence includes data in different frequency ranges.
[0035] Since the network traffic included in each traffic subsequence is different, different target wavelet transform parameters can be determined according to the network traffic included in each traffic subsequence.
[0036] In some embodiments, the correspondence between multiple groups of reference network traffic and candidate wavelet transform parameters can be constructed in advance based on the wavelet transform coefficients of the massive network traffic. On this basis, the target wavelet transform parameters of each traffic subsequence can be determined in the following manner: matching the traffic subsequence with multiple reference network traffic, obtaining the target network traffic with the highest similarity to the traffic subsequence, and obtaining the target wavelet transform parameters corresponding to the target network traffic based on the correspondence.
[0037] In the case of variable distribution characteristics of network traffic in the existing network, the optimal wavelet basis, number of layers and scale parameters need to be automatically selected according to the traffic attributes of different traffic subsequences, which can adapt to different traffic subsequences.
[0038] In step 103, the detection result of the network traffic to be detected is determined according to the fusion features of all the first feature sets.
[0039] The detection result is used to indicate whether the network traffic to be detected contains low signal-to-noise ratio attack traffic.
[0040] In this embodiment, multiple first feature sets may be input into a pre-trained neural network model, the multiple first feature sets may be fused in the neural network model to obtain fused features, and whether attack traffic exists therein may be predicted based on the fused features.
[0041] The present disclosure divides the network traffic data to be detected into multiple traffic subsequences, and for each traffic subsequence, uses the target wavelet transform parameters (i.e., wavelet basis, number of layers, and scale parameters) obtained by optimizing the data in different frequency ranges in the traffic subsequence to perform wavelet transform on the traffic subsequence to obtain a first feature set, and determines the detection result of the network traffic to be detected based on the fusion features of all the first feature sets. The present disclosure determines the target wavelet transform parameters for wavelet transforming the traffic subsequence based on the data in different frequency ranges in the traffic subsequence for the traffic subsequence in each window, thereby improving the accuracy of feature extraction using wavelet transform, and further improving the accuracy of the detection result.
[0042] In some embodiments, the target wavelet transform parameters can also be determined by performing hierarchical optimization on data in different frequency ranges in the traffic subsequence. For example, they can be determined according to the following steps: performing multi-layer wavelet transform on the traffic subsequence, reconstructing the traffic in each layer according to the high-frequency subsequence and low-frequency subsequence obtained by wavelet transform, and adjusting the wavelet basis and scale parameters of each layer through a gradient optimization algorithm with the goal of minimizing the difference in the reconstructed traffic, so as to obtain the target wavelet transform parameters.
[0043] The low-frequency subsequence in each layer contains the fluctuation information in the traffic subsequence, and the high-frequency subsequence contains the detailed information of the fluctuation. Starting from the second layer, the low-frequency subsequence in the previous layer is subjected to wavelet transformation, that is, when reconstructing the traffic, the traffic is reconstructed based on the low-frequency subsequence, high-frequency subsequence of the current layer, and the high-frequency subsequences of all previous layers.
[0044] The above determination process may specifically include: i The wavelet basis and scale parameters of the layer i The low-frequency subsequence in the -1 layer is transformed by wavelet transform to obtain i The low-frequency subsequence and high-frequency subsequence of the layer, where i Greater than or equal to 2, and i Less than n , i and n are all positive integers. i = 1, the wavelet basis and scale parameters of the first layer are initial values, and the i The low-frequency subsequence in the -1 layer refers to the traffic subsequence;
[0045] According to i The high-frequency subsequence and low-frequency subsequence of the layer, and the i reconstructing the high frequency subsequences of all layers before the layer, and determining the reconstruction error according to the reconstructed flow and the flow subsequences;
[0046] Adjust the first i The wavelet basis and scale parameter of the layer are used as the wavelet basis and scale parameter corresponding to the minimum reconstruction error. i +1 layer of wavelet basis and scale parameters;
[0047] After the adjustment of the wavelet basis and scale parameters of all layers is completed, the number of layers with the smallest reconstruction error and the wavelet basis and scale parameters of the layer are determined as the target wavelet transform parameters.
[0048] Figure 2 is a flowchart of determining target wavelet transform parameters according to an exemplary embodiment of the present disclosure. Figure 2 As shown, the process of determining the target wavelet transform parameters includes the following steps 201 to 204.
[0049] In step 201, i =1, initialize wavelet transform parameters.
[0050] A library containing various wavelet basis functions is created in advance, such as Haar, Daubechies, Symlets, Coiflets, etc., to adapt to different types of signal characteristics. When receiving the network traffic to be detected, a wavelet basis is randomly selected from the library and the number of layers and scale parameters are initialized.
[0051] In step 202, wavelet transform is performed to reconstruct the flow, and a reconstruction error is determined based on the reconstructed flow and flow subsequence.
[0052] In step 203, the first i The wavelet basis and scale parameters of the first layer are updated and passed to the i +1 layer.
[0053] when i = 1, the initialization parameters are used to perform wavelet transform on the traffic subsequence to obtain the high-frequency subsequence HP1 and the low-frequency subsequence LP1 of the first layer. Assuming that the initial wavelet transform parameters are (w 11 , w 12 , w 13 ), where w 11 represents the wavelet basis, w 12 Indicates the number of layers, w 13 Represents the scale parameter.
[0054] The traffic is reconstructed based on the high-frequency subsequence and the low-frequency subsequence of the first layer using formula 1.
[0055] f '= LP1 + HP1 Formula (1)
[0056] In the formula, f ' indicates reconstruction traffic.
[0057] The reconstruction error is determined based on the reconstructed flow and flow subsequence. The wavelet basis and scale parameters of the first layer are adjusted through the gradient optimization algorithm with the goal of minimizing the reconstruction error. The wavelet transform parameters (w 21 , w 22 , w 23 ).
[0058] The optimized wavelet transform parameters (w 21 , w 22 , w 23 ) is updated and passed to layer 2.
[0059] In this embodiment, the objective function may be set as shown in Formula 2, and the wavelet basis and scale parameters when the objective function is optimal may be obtained through a gradient optimization algorithm.
[0060] Formula (2)
[0061] is the objective function, where θ represents a set of wavelet transform parameters (wavelet basis, number of layers, scale), MSE is the mean square error, through the flow subsequence f and reconstruction traffic f 'The difference calculation.
[0062] when i = 2, the wavelet transform parameters (w 21 , w 22 , w 23 ) Perform wavelet transform on the low-frequency subsequence of the first layer to obtain the high-frequency subsequence HP12 and the low-frequency subsequence LP12 of the second layer, and then reconstruct the traffic according to the high-frequency subsequence HP12 and the low-frequency subsequence LP12 of the second layer and the high-frequency subsequence of the first layer.
[0063] The reconstruction error is determined based on the reconstructed flow and flow subsequence. The wavelet basis and scale parameters of the second layer are adjusted through the gradient optimization algorithm with the goal of minimizing the reconstruction error. Then, the optimized wavelet transform parameters (w 21 , w 22 , w 23 ) updates are passed to Layer 3.
[0064] And so on, until the number of layers reaches the preset number, that is, the parameters of all layers are adjusted.
[0065] In step 204, based on the reconstruction errors of all layers, the wavelet transform parameters corresponding to the layer with the smallest reconstruction error are determined as target wavelet transform parameters.
[0066] That is, after the parameters of all layers are adjusted, the reconstruction errors of all layers are considered for joint optimization, and the wavelet transform parameters corresponding to the layer with the smallest reconstruction error are determined as the target wavelet transform parameters.
[0067] When the target wavelet transform parameters are determined, the flow subsequence can be subjected to wavelet transform according to the target wavelet transform parameters, thereby obtaining a first feature set.
[0068] So far, we can get k The optimal wavelet decomposition feature set of traffic subsequences, that is, the first feature set T k = [ f 11 , f 12 , f 21 ,f 22 ,..., f r1 , f r2 ],in, f 11 represents the low-frequency subsequence of layer 1, f 12 Represents the high-frequency subsequence of layer 1; f 21 represents the low-frequency subsequence of the second layer, f 22 represents the high-frequency subsequence of layer 2; f r1 Indicates r The low-frequency subsequence of the layer, f r2 Indicates r The high-frequency subsequence of the layer, r Represents the number of layers in the target wavelet transform parameters.
[0069] Integrate the first feature set corresponding to all time windows [T1, T2, ..., T k ..., T K ] as the time-frequency representation of the network traffic to be detected, where: K Indicates the number of traffic subsequences included in the network traffic to be detected.
[0070] like Figure 3a As shown, according to the concept of determining the target wavelet transform parameters, a feature anchoring model based on hierarchical optimization is designed. Based on the feature anchoring model, the optimal wavelet basis, number of decomposition layers and scale are automatically selected for traffic subsequences of different time spans to adapt to the dynamic changes of traffic data, thereby obtaining the first feature set of the traffic subsequence.
[0071] Each traffic subsequence can be decomposed into multiple layers of information after multi-layer wavelet transform, and each layer reveals the time-frequency characteristics of the traffic subsequence from different scale components, that is, each first feature set includes multiple layers of time-frequency characteristics. Considering the problems of sparse matrix and scattered features in the first feature set, in order to focus on effective features, this embodiment constructs a multi-layer collaborative model based on attention, and introduces the attention mechanism to enhance the model's attention to key features.
[0072] The processing process of the attention-based multi-layer collaborative model may include: using the attention module corresponding to each first feature set to obtain the weight of each layer of time-frequency features in the first feature set, fusing all first feature sets according to each layer of time-frequency features in each first feature set and the weight of each layer of time-frequency features to obtain fused features; and determining the detection result of the network traffic to be detected based on the fused features.
[0073] The attention-based multi-layer collaborative model can effectively process multi-window and multi-layer sequence data, while solving the problems of matrix sparsity and feature dispersion, and improving the model's attention to key features.
[0074] Figure 3b is a framework diagram of a multi-layer collaborative model based on attention according to an exemplary embodiment of the present disclosure, such as Figure 3b As shown, the attention modules in the multi-layer collaborative model correspond one-to-one to the first feature set obtained in each time window;
[0075] The input data of the multi-layer collaborative model is a plurality of first feature sets, each of which contains features of different time spans and frequency scales of the corresponding window. In the multi-layer collaborative model, the attention module is used to calculate the weight of each layer of time-frequency features in the first feature set, and the time-frequency features are weighted according to the weights to obtain weighted features. The weighted features of different first feature sets are fused to obtain fused features, for example, stacking, weighted sum, or more complex fusion strategies can be used for fusion. The fused features are processed to obtain the detection results and output through the output layer, where the output layer can be a softmax layer, a fully connected layer, etc.
[0076] The attention-based multi-layer collaborative model is trained on normal and abnormal traffic to identify the key features that distinguish normal and abnormal traffic, adaptively focus on the most important parts of the data, and capture multi-scale abnormal patterns.
[0077] In order to achieve effective extraction of traffic time-frequency features without sacrificing feature extraction accuracy, and rapid filtering of normal traffic, this embodiment also provides an adaptive dynamic load balancing filtering model to introduce traffic into an accelerator for accelerated filtering. The accelerator may be a field programmable gate array FPGA, GPU, etc.
[0078] Figure 4 is a system framework diagram shown in the present disclosure according to an exemplary embodiment, such as Figure 4 As shown, the process of completing the detection task includes three parts: traffic extraction and division, feature extraction, and attention-based multi-layer collaborative model, which are represented by A, B, and C in this embodiment. The adaptive dynamic load balancing filtering model divides the hardware into the above three parts according to the balancing strategy, and the edge between A, B, and C is A->B->C. Before load balancing, the computing resources required to complete the detection task are evaluated. Taking the accelerator as FPGA as an example, the FPGA resources required for each module are evaluated, including lookup tables (LUTs), flip-flops (FFs), digital signal processors (DSPs), memory blocks (BRAMs), etc.
[0079] A: requires fewer computing resources, but requires fast response; B: requires more computing resources, especially for complex traffic feature extraction; C: requires the most computing resources and memory resources. Suppose A requires X resources and the execution time is T1; B requires Y resources and the execution time is T2; C requires Z resources and the execution time is T3. That is, the computing resources required to complete the detection task are the sum of X, Y, and Z.
[0080] The load balancing standards in this embodiment include minimum delay, maximum throughput and resource balance. Among them, minimizing delay can enable fast response, which is suitable for real-time or near real-time systems; maximizing throughput can process more data, which is suitable for batch processing systems; and balancing the use of FPGA resources to avoid overload.
[0081] Based on the above standards, an indicator Performance is designed to measure system performance. The calculation formula is shown in Formula 3.
[0082] Formula (3)
[0083] In the formula, Throughput refers to throughput, which is the number of tasks completed per unit time, usually expressed as the number of data packets or instructions processed per second; Latency refers to delay, which is the average time required from receiving a request to completing processing; Resource Utilization refers to resource utilization, which is the usage ratio of FPGA resources (such as logic units, DSP blocks, BRAM, etc.); Overhead refers to overhead, which is additional management and coordination costs and does not directly contribute to task processing.
[0084] The following will specifically introduce how to use the dynamic programming algorithm to achieve adaptive resource allocation.
[0085] In some embodiments, whether to allocate computing resources to the current network traffic to be detected is determined based on resource constraints and dependencies. For example, before detecting the network traffic to be detected, the current allocatable resources and the target indicator value can be obtained, and the target indicator value is used to characterize the system performance after allocating computing resources to the network traffic to be detected, and the system performance is determined based on the throughput, latency, resource utilization and overhead of the accelerator running the network traffic detection method; if the current allocatable resources are greater than or equal to the computing resources required to complete the detection task, and the target indicator value meets the preset conditions, the computing resources are allocated to the network traffic to be detected.
[0086] Among them, the preset condition may be that the target indicator value is greater than a threshold, that is, if the currently allocatable resources are greater than or equal to the computing resources required to complete the detection task, and the target indicator value is greater than the threshold, computing resources are allocated to the network traffic to be detected.
[0087] The preset condition may also be that the target index value is greater than the index value before computing resources are allocated to the network traffic to be detected. That is, if the currently allocatable resources are greater than or equal to the computing resources required to complete the detection task, and the target index value is greater than the index value before computing resources are allocated to the network traffic to be detected, computing resources are allocated to the network traffic to be detected.
[0088] For ease of understanding, assume that the network traffic to be detected is the gth one, and the state after computing resources are allocated to the gth network traffic to be detected is called the current state, and the state in which computing resources are not allocated to the gth network traffic to be detected is called the previous state. That is, let dp[g][j] represent the indicator value when the total amount of resources is j after running the first g tasks, dp[0][j]=0 represents the state when there is no task initially, and dp[g-1][j- g ] means that before running g-1 tasks, the total resources are j- g The indicator value at time g Represents the computing resources required to complete the g-th detection task.
[0089] In determining whether the state is from dp[g-1][j- g ] transfers to dp[g][j], first determine whether the currently allocable resources meet the task requirements, and if so, then determine whether the indicator value after allocating resources is better than the indicator value before allocating resources, that is, ), if the indicator value after resource allocation is better than the indicator value before resource allocation, computing resources are allocated to the g-th network flow to be detected, that is, the state is transferred from the previous state to the current state, that is, the detection task of the g-th network flow to be detected is started.
[0090] For example, the indicator value after allocating resources to the g-th network traffic to be detected can be calculated according to the following formula 4.
[0091] Formula (4)
[0092] In the formula, Indicates the indicator value when processing the first g tasks; Indicates the throughput when processing the first g tasks; represents the delay in processing the first g tasks; It indicates the resource utilization rate when processing the first g tasks when the total resource amount is j; It represents the cost of processing the first g tasks when the total amount of resources is j.
[0093] Load balancing can achieve rapid detection, so it is possible to detect network traffic at all times. Compared with the detection method that analyzes multiple data packets within a preset time period, it can capture rapidly changing traffic characteristics, especially those instantaneous, non-periodic abnormal traffic. In addition, it is also possible to have an in-depth understanding of traffic behavior based on the long-term trend and historical background of traffic. The network traffic detection method provided by the present disclosure is more adaptable to the rapid changes in traffic patterns, especially in the face of rapidly developing network attacks or changing network conditions.
[0094] like Figure 4 As shown, the present invention divides the network traffic to be detected into traffic subsequences of different time spans, designs a feature anchoring model based on hierarchical optimization to automatically select the best wavelet basis, decomposition layer number and scale to adapt to the dynamic changes of traffic data, and obtains multi-layer time-frequency features of the network traffic to be detected in multiple time windows. Afterwards, in order to effectively obtain the distinguishing features between low signal-to-noise ratio attack traffic and normal traffic, different time windows and different layers of time-frequency features are used as input, and a multi-layer collaborative model based on attention is used for feature fusion. Finally, the network traffic to be detected is introduced into the accelerator for processing based on adaptive dynamic load balancing technology to achieve rapid filtering of network traffic.
[0095] Corresponding to the embodiments of the aforementioned method, the present disclosure also provides embodiments of a device and a terminal to which the device is applied.
[0096] Figure 5 FIG. 1 is a schematic diagram of a detection device according to an exemplary embodiment of the present disclosure. Figure 5 As shown, the network traffic detection device includes:
[0097] A division unit 501 is used to divide the network traffic to be detected into a plurality of traffic sub-sequences;
[0098] A feature extraction unit 502 is used to perform a wavelet transform on each flow subsequence using a target wavelet transform parameter to obtain a first feature set, wherein the target wavelet transform parameter includes a wavelet basis, a number of layers, and a scale parameter, and the target wavelet transform parameter is determined based on data in different frequency ranges in the flow subsequence;
[0099] The detection unit 503 is used to determine the detection result of the network traffic to be detected according to the fusion features of all the first feature sets, and the detection result is used to indicate whether the network traffic to be detected contains low signal-to-noise ratio attack traffic.
[0100] In some embodiments, the target wavelet transform parameters are determined according to the following steps: performing multi-layer wavelet transform on the traffic subsequence, reconstructing the traffic in each layer according to the high-frequency subsequence and the low-frequency subsequence obtained by wavelet transform, and adjusting the wavelet basis and scale parameters of each layer through a gradient optimization algorithm with the goal of minimizing the difference in the reconstructed traffic, so as to obtain the target wavelet transform parameters.
[0101] In some embodiments, the feature extraction unit 502 is specifically used to perform wavelet transform on the low-frequency subsequence in the i-1th layer according to the wavelet basis and scale parameter of the i-th layer to obtain the low-frequency subsequence and high-frequency subsequence of the i-th layer, wherein i is greater than or equal to 2 and i is less than n, and i and n are both positive integers. When i=1, the wavelet basis and scale parameter of the first layer are initial values, and the low-frequency subsequence in the i-1th layer refers to the flow subsequence; reconstruct the flow according to the high-frequency subsequence and low-frequency subsequence of the i-th layer and the high-frequency subsequences of all layers before the i-th layer, and determine the reconstruction error according to the reconstructed flow and the flow subsequence; adjust the wavelet basis and scale parameter of the i-th layer through the gradient optimization algorithm, and use the wavelet basis and scale parameter corresponding to the minimum reconstruction error as the wavelet basis and scale parameter of the i+1th layer; until the adjustment of the wavelet basis and scale parameter of all layers is completed, the layer number with the minimum reconstruction error and the wavelet basis and scale parameter of the layer are determined as the target wavelet transform parameters.
[0102] In the case where the first feature set includes multiple layers of time-frequency features, the detection unit is specifically used to: use the attention module corresponding to each first feature set to obtain the weight of each layer of time-frequency features in the first feature set, and the attention module corresponds to the first feature set one by one; according to each layer of time-frequency features in each first feature set and the weight of each layer of time-frequency features, all first feature sets are fused to obtain fused features; and the detection result of the network traffic to be detected is determined according to the fused features.
[0103] In some embodiments, the device also includes: a load balancing unit, which is used to obtain current allocatable resources and a target indicator value before detecting the network traffic to be detected, and the target indicator value is used to characterize the system performance after allocating computing resources to the network traffic to be detected, and the system performance is determined based on the throughput, latency, resource utilization and overhead of the accelerator running the network traffic detection method; if the current allocatable resources are greater than or equal to the computing resources required to complete the detection task, and the target indicator value meets the preset conditions, computing resources are allocated to the network traffic to be detected.
[0104] Figure 6 A schematic diagram of the structure of an electronic device provided by at least one embodiment of the present disclosure. Figure 6As shown, the electronic device includes a memory and a processor, the memory is used to store computer instructions that can be executed on the processor, and the processor is used to implement the network traffic detection method described in any embodiment of the present disclosure when executing the computer instructions.
[0105] At least one embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, any network traffic detection method described in the present disclosure is implemented.
[0106] It should be understood by those skilled in the art that one or more embodiments of the present disclosure may be provided as a method, a system or a computer program product. Therefore, one or more embodiments of the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0107] The above description is only a preferred embodiment of one or more embodiments of the present disclosure and is not intended to limit one or more embodiments of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present disclosure shall be included in the scope of protection of one or more embodiments of the present disclosure.
Claims
1. A detection method based on adaptive time-frequency feature extraction for attack behavior tracking, characterized in that: The method comprises: Divide the network traffic to be detected into multiple traffic subsequences; For each flow subsequence, wavelet transform is performed on the flow subsequence using target wavelet transform parameters to obtain a first feature set, wherein the target wavelet transform parameters include a wavelet basis, a number of layers, and a scale parameter, and the target wavelet transform parameters are determined according to data in different frequency ranges in the flow subsequence; Determine, according to the fusion features of all the first feature sets, a detection result of the network traffic to be detected, wherein the detection result is used to indicate whether the network traffic to be detected contains low signal-to-noise ratio attack traffic; Wherein, the target wavelet transform parameters are determined according to the following steps: A multi-layer wavelet transform is performed on the traffic subsequence, and the traffic is reconstructed in each layer according to the high-frequency subsequence and the low-frequency subsequence obtained by the wavelet transform. The wavelet basis and scale parameters of each layer are adjusted through a gradient optimization algorithm with the goal of minimizing the difference in the reconstructed traffic to obtain the target wavelet transform parameters.
2. The method according to claim 1, characterized in that The multi-layer wavelet transform is performed on the traffic subsequence, and the traffic is reconstructed in each layer according to the high-frequency subsequence and the low-frequency subsequence obtained by the wavelet transform, and the wavelet basis and scale parameters of each layer are adjusted by the gradient optimization algorithm with the goal of minimizing the difference in the reconstructed traffic, so as to obtain the target wavelet transform parameters, including: According to i The wavelet basis and scale parameters of the layer i The low-frequency subsequence in the -1 layer is transformed by wavelet transform to obtain i The low-frequency subsequence and high-frequency subsequence of the layer, where i Greater than or equal to 2, and i Less than n , i and n are all positive integers. i = 1, the wavelet basis and scale parameters of the first layer are initial values, and the i The low-frequency subsequence in the -1 layer refers to the traffic subsequence; According to i The high-frequency subsequence and low-frequency subsequence of the layer, and the i reconstructing the high frequency subsequences of all layers before the layer, and determining the reconstruction error according to the reconstructed flow and the flow subsequences; Adjust the first i The wavelet basis and scale parameter of the layer are used as the wavelet basis and scale parameter corresponding to the minimum reconstruction error. i +1 layer of wavelet basis and scale parameters; After the adjustment of the wavelet basis and scale parameters of all layers is completed, the number of layers with the smallest reconstruction error and the wavelet basis and scale parameters of the layer are determined as the target wavelet transform parameters.
3. The method according to claim 1, characterized in that The first feature set includes multiple layers of time-frequency features; The step of determining the detection result of the network traffic to be detected according to the fusion features of all the first feature sets includes: Using an attention module corresponding to each first feature set, obtaining a weight of each layer of time-frequency features in the first feature set, wherein the attention module corresponds to the first feature set one by one; According to each layer of time-frequency features in each first feature set and the weight of each layer of time-frequency features, all first feature sets are fused to obtain fused features; The detection result of the network traffic to be detected is determined according to the fusion feature.
4. The method according to claim 1, characterized in that: The method further comprises: Before detecting the network traffic to be detected, currently allocatable resources and a target index value are obtained, wherein the target index value is used to characterize the system performance after allocating computing resources to the network traffic to be detected, wherein the system performance is determined according to the throughput, delay, resource utilization and overhead of the accelerator running the network traffic detection method; If the currently allocatable resources are greater than or equal to the computing resources required to complete the detection task, and the target indicator value meets the preset conditions, computing resources are allocated to the network traffic to be detected.
5. A network traffic detection device, characterized in that: The device comprises: A division unit, used for dividing the network traffic to be detected into a plurality of traffic sub-sequences; a feature extraction unit, for performing wavelet transform on each flow subsequence using target wavelet transform parameters to obtain a first feature set, wherein the target wavelet transform parameters include a wavelet basis, a number of layers, and a scale parameter, and the target wavelet transform parameters are determined based on data in different frequency ranges in the flow subsequence; A detection unit, used to determine a detection result of the network traffic to be detected according to the fusion features of all the first feature sets, wherein the detection result is used to indicate whether the network traffic to be detected contains low signal-to-noise ratio attack traffic; The target wavelet transform parameters are determined according to the following steps: performing multi-layer wavelet transform on the traffic subsequence, reconstructing the traffic in each layer according to the high-frequency subsequence and the low-frequency subsequence obtained by wavelet transform, and adjusting the wavelet basis and scale parameters of each layer through the gradient optimization algorithm with the goal of minimizing the difference in the reconstructed traffic, so as to obtain the target wavelet transform parameters.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 4 is implemented.
7. A terminal device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method according to any one of claims 1 to 4.
8. A computer program product comprising a computer program and instructions, characterized in that: When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 4 is implemented.
