DDoS traffic identification method and device, electronic equipment and storage medium
By encoding and identifying the protocol, direction and packet length information of data packets in network traffic, and using the LSTM model to identify sequence features, the existing technology solves the problem of difficulty in identifying slow attacks and confusing DDoS traffic with packet header fields, and improves identification accuracy and robustness.
Patent Information
- Application Number
- CN202410901232.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-10-29
AI Technical Summary
Existing DDoS traffic identification methods are difficult to effectively identify slow attacks and traffic with obfuscated packet header fields. They have poor robustness and are easily affected by evasion attacks.
By obtaining the IP addresses of data packets in network traffic, dividing them into queues, and encoding them based on the protocol type, IP address and packet length category of the data packets, generating a queue coding sequence, and using the LSTM model to identify sequence features to identify DDoS traffic.
It achieves effective identification of slow attacks and packet header field obfuscated DDoS traffic, improves the identification accuracy, does not rely on the statistical characteristics of network traffic and packet header field values, and enhances the robustness of the model.
Smart Images

Figure CN118869286A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of traffic identification technology, and in particular to a DDoS traffic identification method, device, electronic device, and storage medium. Background Art
[0002] Currently, DDoS (Distributed Denial of Service) traffic identification methods can be mainly divided into three types: statistical feature-based methods, traditional machine learning-based methods, and deep learning-based methods.
[0003] Statistical feature-based methods usually use manually counted traffic features, such as traffic rate and flow duration, to construct conditions for attack judgment. However, such methods rely on manual statistics, and usually have high miss rates and false alarm rates, poor robustness, and require frequent updates to thresholds.
[0004] Machine learning-based methods use algorithms to learn thresholds for various features, reducing the need for manual threshold statistics. However, traditional machine learning algorithms still rely on prior knowledge to select appropriate statistical features. Furthermore, using statistical features of network traffic is susceptible to evasion attacks. For example, attackers can bypass detection by changing the rate of attack packets.
[0005] Deep learning-based methods are widely used for DDoS traffic identification. These methods typically use packet header values, such as the TCP (Transmission Control Protocol) window value, TCP flags, and packet length, or statistical values, such as flow duration, packet rate, and the number of ACK (Acknowledgement) packets, as features to train models. Compared to machine learning-based methods, these methods can effectively improve model robustness, but they are still susceptible to evasion attacks, such as slow attacks and packet header field obfuscation.
[0006] Therefore, how to effectively identify slow attacks and DDoS traffic with obfuscated packet header fields is a problem that needs to be solved urgently. Summary of the Invention
[0007] The main purpose of this application is to provide a DDoS traffic identification method, device, electronic device and storage medium, aiming to solve the technical problem of how to effectively identify slow attacks and DDoS traffic with obfuscated packet header fields.
[0008] To achieve the above objectives, this application proposes a DDoS traffic identification method, which includes:
[0009] Obtaining an IP address of each data packet in the network traffic to be identified, and dividing each data packet into a plurality of queues according to each IP address;
[0010] For any queue to be identified among the multiple queues, multiple data packets are obtained from the queue to be identified as sample data packets, and a packet length category of each sample data packet is determined according to the data packet length of each sample data packet;
[0011] Encoding is performed based on the protocol type of each sample data packet, the IP address of each sample data packet, and the packet length category of each sample data packet to obtain a queue code sequence of the queue to be identified;
[0012] The queue code sequences obtained by traversing each queue to be identified are used to form the network code sequence of the network traffic to be identified;
[0013] A sequence feature of the traffic encoding sequence is obtained, and DDoS traffic is identified based on the sequence feature.
[0014] In one embodiment, the packet length category is determined by a packet length classification model, and the packet length classification model is trained based on training traffic. The method further includes:
[0015] Classifying the training data packets based on protocol types of the training data packets in the training traffic to obtain a plurality of first training data sets;
[0016] Classifying the training data packets in any first training data set according to the IP addresses of the training data packets in the first training data set to obtain a plurality of second training data sets;
[0017] A plurality of training data packets are respectively obtained from each of the second training data sets as model training sets, and a preset clustering model is trained based on the model training sets to obtain the packet length classification model.
[0018] In one embodiment, the step of training the preset clustering model based on the model training set includes:
[0019] Obtaining the data packet length of each training data packet in the model training set, and performing statistics on the data packet length of each obtained training data packet to obtain a statistical distribution result;
[0020] Determining the number of clusters of the preset clustering model based on the statistical distribution result, and configuring the preset clustering model according to the number of clusters;
[0021] The model training set is input into the preset clustering model, and the model training set is processed by the DBSCAN algorithm in the preset clustering model to determine the cluster core points of the preset clustering model.
[0022] In one embodiment, the DDoS traffic is identified using an LSTM model, the LSTM model is trained based on the training traffic, and the method further includes:
[0023] Configuring the number of stacked layers and hidden layers of the LSTM model, wherein the number of stacked layers is positively correlated with the duration of the LSTM model acquiring the dependency relationship of the coding sequence, and the number of hidden layers is positively correlated with the capacity of the LSTM model to receive the coding sequence;
[0024] Obtaining a protocol type of a training data packet in the training traffic and an IP address of the training data packet, and determining a packet length category of the training data packet using the packet length classification model;
[0025] Based on the protocol type of the training data packet, the IP address of the training data packet, and the packet length category of the training data packet, the second training data set is encoded to obtain an encoded training set, and the encoded training set is input into the LSTM model to obtain a model recognition result. The model parameters of the LSTM model are updated through the difference between the model recognition result and the encoded training set label to train the LSTM model.
[0026] In one embodiment, the step of obtaining the IP address of each data packet in the network traffic to be identified and dividing each data packet into a plurality of queues according to each IP address includes:
[0027] Obtaining the source IP address and destination IP address of each data packet in the network traffic to be identified;
[0028] Determining a transmission path for each of the data packets based on each of the source IP addresses and the destination IP address;
[0029] The data packets having the same transmission paths are divided into the same queue.
[0030] In one embodiment, the step of encoding based on the protocol type of each sample data packet, the IP address of each sample data packet, and the packet length category of each sample data packet to obtain the queue code sequence of the queue to be identified includes:
[0031] Determine the protocol type code value of each sample data packet based on a preset protocol type mapping table, and determine the IP address code value of each sample data packet based on a preset IP address mapping table;
[0032] Encoding the packet length category of each sample data packet according to the number of packet length categories of each sample data packet to obtain a packet length category code value of each sample data packet;
[0033] The queue coding sequence is determined based on the protocol type code value of each sample data packet, the IP address code value of each sample data packet, and the packet length category code value of each sample data packet.
[0034] In one embodiment, the DDoS traffic is identified by an LSTM model, wherein the LSTM model is configured with abnormal features of the DDoS traffic. The steps of obtaining sequence features of the encoding sequence and identifying the DDoS traffic based on the sequence features include:
[0035] Acquire sequence features of the encoding sequence through the LSTM model, and compare the sequence features with the abnormal features;
[0036] When an abnormality is detected in the comparison result, it is determined that DDoS traffic exists in the coding sequence.
[0037] In addition, to achieve the above objectives, the present application also proposes a DDoS traffic identification device, which includes:
[0038] a partitioning module, configured to obtain an IP address of each data packet in the network traffic to be identified, and to partition each data packet into a plurality of queues according to each IP address;
[0039] a class determination module, configured to obtain, for each queue to be identified in the plurality of queues, a plurality of data packets from the queue to be identified as sample data packets, and determine a packet length class of each of the sample data packets according to the packet length of each of the sample data packets;
[0040] An encoding module, configured to perform encoding based on the protocol type of each sample data packet, the IP address of each sample data packet, and the packet length category of each sample data packet to obtain an encoding sequence of the network traffic to be identified;
[0041] An identification module is used to obtain sequence features of the coding sequence and identify DDoS traffic based on the sequence features.
[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the DDoS traffic identification method described above.
[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the steps of the DDoS traffic identification method described above are implemented.
[0044] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the DDoS traffic identification method as described above.
[0045] The present application proposes a DDoS traffic identification method. The present application first obtains the IP address of each data packet in the network traffic to be identified, divides each data packet into multiple queues according to each IP address, and provides an effective platform for identifying DDoS traffic by distinguishing different IP addresses of the data packets. For any queue to be identified in the multiple queues, multiple data packets are obtained from the queue to be identified as sample data packets, and the packet length category of each sample data packet is determined based on the packet length of each sample data packet, so as to provide an effective data basis for identifying DDoS traffic by obtaining the packet length category. The sample data packets are encoded based on the protocol type, IP address and packet length category of each sample data packet to obtain a queue code sequence for the queue to be identified, so as to provide a method for forming a digital sequence that is easy to identify DDoS traffic. The queue code sequences obtained by traversing each queue to be identified are combined into a network code sequence for the network traffic to be identified, so as to provide a method for obtaining a numerical sequence for the network traffic to be identified. The sequence characteristics of the traffic code sequence are obtained, and DDoS traffic is identified based on the sequence characteristics. The sequence characteristics of the identification code sequence are used to achieve identification of DDoS traffic.
[0046] In summary, this application encodes the protocol, direction, and packet length information of data packets in network traffic into a sequence, and then identifies the sequence features in the sequence to distinguish DDoS traffic. Since the identified sequence features do not rely on the statistical characteristics of network traffic and the packet header field values, but distinguish DDoS traffic from normal network traffic by identifying the protocol, direction, and packet length information of data packets in network traffic, it can effectively identify DDoS traffic that uses slow attacks and packet header field obfuscation. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0049] Figure 1A flowchart illustrating the first embodiment of the DDoS traffic identification method of this application;
[0050] Figure 2 A schematic diagram of a coding scenario for the DDoS traffic identification method provided in Example 1 of the present application;
[0051] Figure 3 A flowchart illustrating the second embodiment of the DDoS traffic identification method of this application;
[0052] Figure 4 A flowchart illustrating the third embodiment of the DDoS traffic identification method of this application;
[0053] Figure 5 A schematic diagram of a simplified flow chart of the DDoS traffic identification method provided in Example 3 of this application;
[0054] Figure 6 This is a schematic diagram of the module structure of the DDoS traffic identification device according to an embodiment of the present application;
[0055] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the DDoS traffic identification method in the embodiment of the present application.
[0056] The purpose, features and advantages of this application will be further explained with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0057] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.
[0058] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0059] The main solution of the embodiment of the present application is: obtaining the IP address of each data packet in the network traffic to be identified, and dividing each data packet into multiple queues according to each IP (Internet Protocol) address; for any queue to be identified in the multiple queues, obtaining multiple data packets from the queue to be identified as sample data packets, and determining the packet length category of each sample data packet based on the data packet length of each sample data packet; encoding based on the protocol type of each sample data packet, the IP address of each sample data packet and the packet length category of each sample data packet to obtain a queue coding sequence of the queue to be identified; the queue coding sequence obtained by traversing each queue to be identified is used to form a network coding sequence of the network traffic to be identified; obtaining the sequence characteristics of the traffic coding sequence, and identifying DDoS traffic based on the sequence characteristics.
[0060] Because existing DDoS traffic identification methods are still affected by evasion attacks, such as slow attacks and packet header field obfuscation, how to effectively identify slow attacks and DDoS traffic with obfuscated packet header fields is an urgent problem that needs to be solved.
[0061] This application provides a solution that encodes the protocol, direction, and packet length information of data packets in network traffic into a sequence, and then identifies sequence features in the sequence to distinguish DDoS traffic. Because the identified sequence features do not rely on the statistical characteristics of network traffic or packet header field values, but distinguish DDoS traffic from normal network traffic by identifying the protocol, direction, and packet length information of data packets in network traffic, it can effectively identify DDoS traffic that uses slow attacks and packet header field obfuscation.
[0062] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, mobile phone, etc., or an electronic device capable of performing the above functions. The following uses electronic devices as an example to illustrate this embodiment and the following embodiments.
[0063] Based on this, the embodiment of the present application provides a DDoS traffic identification method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the DDoS traffic identification method of the present application.
[0064] In this embodiment, the DDoS traffic identification method includes steps S10 to S50:
[0065] Step S10, obtaining the IP address of each data packet in the network traffic to be identified, and dividing each data packet into multiple queues according to each IP address;
[0066] It should be noted that the network traffic to be identified refers to the total amount of data packets transmitted in the network that require DDoS traffic identification within a certain period of time. The data packet is the smallest unit in network communication. The data packet contains the necessary header information and the actual data content transmitted.
[0067] In addition, it should be noted that a queue refers to a set of data packets in the network traffic to be identified that are sorted and classified according to IP addresses and the time sequence of data packet entry. Data packets in the same queue are configured with the same transmission path.
[0068] It is understandable that since a DDoS attack may use multiple source IP addresses to send a large number of data packets to a destination IP address, or send data packets from a single source IP address to multiple destination IP addresses, performing step S10 can avoid the problem of being unable to determine that the network traffic caused by DDoS traffic is excessive within the same transmission path, thereby improving the accuracy of identifying DDoS traffic in network traffic.
[0069] In a feasible implementation, step S10 may include steps S11 to S13:
[0070] Step S11, obtaining the source IP address and destination IP address of each data packet in the network traffic to be identified;
[0071] It should be noted that the source IP address refers to the IP address of the device that sends the data packet, and the destination IP address refers to the IP address of the device that receives the data packet.
[0072] It is understandable that since a DDoS attacker cannot easily change the source IP address and the destination IP address of a data packet, step S11 is performed to obtain a valid IP address for identifying DDoS traffic.
[0073] Step S12, determining a transmission path for each of the data packets based on the source IP address and the destination IP address;
[0074] It should be noted that the transmission path refers to the path from the source IP address to the destination IP address when the data packet is transmitted in the network.
[0075] It can be understood that since the source IP address and destination IP address of the data packet are required to be simplified, step S12 is performed to provide a simplified way to represent the source IP address and destination IP address by converting the source IP address and destination IP address of the data packet into the transmission path of the data packet.
[0076] Step S13: Divide the data packets with the same transmission paths into the same queue.
[0077] It should be noted that the transmission path always means that the source IP address and destination IP address of different data packets are the same, or the source IP address of a data packet is the destination IP address of another data packet, and the destination IP address of the data packet is the source IP address of the other data packet.
[0078] It is understandable that since identifying DDoS traffic requires monitoring network traffic on the same transmission path, performing step S13 can provide an effective data environment for identifying DDoS traffic.
[0079] In this embodiment, by classifying data packets into different queues according to their IP addresses, the problem of how to provide a suitable data environment for DDoS traffic identification is solved.
[0080] Step S20: for any queue to be identified among the multiple queues, obtain multiple data packets from the queue to be identified as sample data packets, and determine the packet length category of each sample data packet according to the packet length of each sample data packet;
[0081] It should be noted that the sample data packets refer to the data packets selected from the queue to be identified according to the data packet entry sequence, and the packet length categories refer to the different categories divided based on the data packet length.
[0082] It is understandable that since the packet length is determined by the number of bytes of each packet and is highly flexible, step S20 is performed to obtain valid packet length information for identifying DDoS traffic by determining the packet length category based on the packet length.
[0083] Exemplarily, the first 1000 data packets in any queue are selected, and the packet lengths of the first 1000 selected data packets are input into a packet length classification model, and the packet length categories of the selected data packets are determined by the packet length classification model, wherein the packet length classification model is used to convert continuous data packet lengths into discrete categories.
[0084] Step S30, encoding based on the protocol type of each sample data packet, the IP address of each sample data packet, and the packet length category of each sample data packet to obtain a queue code sequence of the queue to be identified;
[0085] It should be noted that the queue coding sequence refers to a sequence that contains the protocol type, IP address and packet length category information of multiple sample data packets in the queue to be identified. Through this queue coding sequence, the protocol type, IP address and packet length category of multiple sample data packets in the queue to be identified can be known.
[0086] It is understandable that since there is currently a lack of a method that can simultaneously reflect the protocol type, IP address and packet length category of a data packet, step S30 is performed to encode the protocol type, IP address and packet length category of multiple sample data packets in the identification queue, thereby providing a method that can simultaneously reflect the protocol type, IP address and packet length category of a data packet.
[0087] In a feasible implementation, step S30 may include steps S31 to S33:
[0088] Step S31, determining the protocol type code value of each sample data packet based on a preset protocol type mapping table, and determining the IP address code value of each sample data packet based on a preset IP address mapping table;
[0089] It should be noted that the preset protocol type mapping table refers to a mapping table that establishes connections between different protocol types of sample data packets and the code values corresponding to the protocol types; the protocol type code value refers to the code value corresponding to the protocol type of the sample data packet in the preset protocol type mapping table; the preset IP address mapping table refers to a mapping table that establishes connections between different IP addresses of the data packet and the code values corresponding to the IP address; the IP address code value refers to the code value corresponding to the IP address of the data packet in the preset IP address mapping table.
[0090] It is understandable that, since there is currently a lack of a method for encoding the protocol type and IP address of a data packet, step S31 is performed to encode the protocol type and IP address of the data packet through a preset mapping table, providing a method for effectively encoding the protocol type and IP address of the data packet.
[0091] Step S32, encoding the packet length category of each sample data packet according to the number of packet length categories of each sample data packet to obtain a packet length category code value of each sample data packet;
[0092] It should be noted that the packet length category code value refers to the coded numerical result after encoding the packet category of each data packet in the queue.
[0093] It is understandable that, since there is currently a lack of a method for encoding the packet length categories of data packets, step S32 can be performed to encode the packet length categories according to the number of packet length categories, thereby providing a method for effectively encoding the packet length categories of data packets.
[0094] Exemplarily, according to the number of packet length categories, the packet length category of each data packet in the queue is One-Hot encoded (single-hot encoding). For example, when the number of packet length categories is 4, the packet length category is encoded into four categories: 00, 01, 10, and 11.
[0095] Step S33: Determine the queue coding sequence based on the protocol type code value of each sample data packet, the IP address code value of each sample data packet, and the packet length category code value of each sample data packet.
[0096] It is understandable that since identifying DDoS traffic requires that the identification data be in an easily readable numerical format, step S33 is performed to provide valid data for identifying DDoS traffic by determining a queue coding sequence.
[0097] For example, to help understand the encoding process of this embodiment, please refer to Figure 2 , Figure 2The left half area represents the actual transmission behavior of the data packet, and the right half area represents the specific encoding result of the feature encoding of the data packet. Based on the preset IP address mapping table, it is known that the transmission direction code value of the data packet transmitted from the client to the server, that is, the IP address code value, is 1, and the transmission direction code value of the data packet transmitted from the server to the client is 0. Based on the preset protocol type mapping table, it is known that when the protocol type of the data packet is TCP (Transmission Control Protocol), the corresponding protocol type code value is 1, and when the protocol type of the data packet is UDP (User Datagram Protocol), the corresponding protocol type code value is 0. According to the case where the data packet lengths are 64, 1420, 64, 1420, 480, 1780, 1880, 1890, and 64 respectively, the number of packet length categories is determined to be 4, and the packet length categories corresponding to the data packet lengths are encoded as 00, 01, 10, and 11.In the figure, when there is a data packet with a protocol type of TCP, a transmission direction of from client to server, and a data packet length of 64, the transmission direction code value of the data packet is determined to be 1, the protocol type code value is 1, and the length category, i.e., the packet length category code value, is 00; when there is a data packet with a protocol type of TCP, a transmission direction of from server to client, and a data packet length of 1420, the transmission direction code value of the data packet is determined to be 0, the protocol type code value is 1, and the length category, i.e., the packet length category code value, is 10; when there is a data packet with a protocol type of TCP, a transmission direction of from server to client, and a data packet length of 1420, the transmission direction code value of the data packet is determined to be 0, the protocol type code value is 1, and the length category, i.e., the packet length category code value, is 10; when there is a data packet with a protocol type of UDP, a transmission direction of from server to client, and a data packet length of 480, the transmission direction code value of the data packet is determined to be 0, the protocol type code value is 0, and the length category, i.e., the packet length category code value, is 01 ; When there is a data packet whose protocol type is UDP, the transmission direction is from the client to the server, and the data packet length is 1780, determine that the transmission direction code value of the data packet is 1, the protocol type code value is 0, and the length category, i.e., the packet length category code value, is 11; when there is a data packet whose protocol type is UDP, the transmission direction is from the client to the server, and the data packet length is 1880, determine that the transmission direction code value of the data packet is 1, the protocol type code value is 0, and the length category, i.e., the packet length category code value, is 11; when there is a data packet whose protocol type is UDP, the transmission direction is from the client to the server, and the data packet length is 1890, determine that the transmission direction code value of the data packet is 1, the protocol type code value is 0, and the length category, i.e., the packet length category code value, is 11; when there is a data packet whose protocol type is TCP, the transmission direction is from the server to the client, and the data packet length is 64, determine that the transmission direction code value of the data packet is 0, the protocol type code value is 1, and the length category, i.e., the packet length category code value, is 00.
[0098] In this embodiment, by encoding the protocol type, IP address and packet length category of the data packet, an effective data basis is provided for identifying DDoS traffic based on the protocol type, IP address and packet length category of the data packet.
[0099] Step S40, composing the queue code sequences obtained by traversing each queue to be identified into the network code sequence of the network traffic to be identified;
[0100] It should be noted that the network coding sequence refers to a coding sequence formed by combining the coding sequences of each queue.
[0101] It is understandable that since DDoS traffic identification of network traffic requires comprehensive consideration of the protocol type, IP address, and packet length category of the data packets in the network traffic, performing step S40 avoids insufficient data used for DDoS traffic identification of network traffic, thereby improving the accuracy of DDoS traffic identification.
[0102] Step S50: Acquire sequence features of the traffic coding sequence, and identify DDoS traffic based on the sequence features.
[0103] It should be noted that sequence features are used to represent attribute data present in a coding sequence.
[0104] It is understandable that, since there is currently no method for identifying DDoS traffic in network traffic by identifying information including packet protocol, IP address, and packet length, step S50 is performed to identify DDoS traffic by obtaining sequence features including packet protocol, IP address, and packet length. This provides a method for effectively identifying DDoS traffic that uses slow attacks and packet header field obfuscation.
[0105] In a feasible implementation, the DDoS traffic is identified by an LSTM model, wherein the LSTM model is configured with abnormal features of the DDoS traffic. Step S50 may further include steps S501 to S502:
[0106] Step S501: obtaining sequence features of the encoding sequence through the LSTM model, and comparing the sequence features with the abnormal features;
[0107] It should be noted that the LSTM model is a special recurrent neural network that solves the gradient vanishing or gradient exploding problems that standard recurrent neural networks are prone to encounter when processing long sequences, thereby enabling it to effectively learn long-distance dependencies.
[0108] In addition, it should be noted that the abnormal features are attribute data used to represent DDoS traffic obtained by training the LSTM model.
[0109] It is understandable that, since there is currently a lack of a method for identifying DDoS traffic based on a network coding sequence containing a data packet protocol type, an IP address, and a packet length category, step S501 is performed to compare the sequence features obtained from the network coding sequence with the trained DDoS traffic anomaly features, thereby providing an effective method for identifying DDoS traffic based on the data packet protocol type, an IP address, and a packet length category.
[0110] Step S502: When an abnormality is detected in the comparison result, it is determined that DDoS traffic exists in the coding sequence.
[0111] Exemplarily, when the comparison result exceeds a preset threshold, it is considered that DDoS traffic exists in the network coding sequence; when the comparison result does not exceed the preset threshold, it is considered that DDoS traffic does not exist in the network coding sequence.
[0112] In this embodiment, the sequence features obtained from the network coding sequence containing the protocol type, IP address and packet length category features of the data packets in the network traffic are compared with the abnormal features of the DDoS traffic obtained by training to identify DDoS traffic, thereby effectively identifying DDoS traffic that has not changed the data packet protocol, IP address and packet length.
[0113] This embodiment provides a DDoS traffic identification method. After encoding the protocol, direction, and packet length information of data packets in network traffic into a sequence, DDoS traffic is identified by identifying sequence features in the sequence. Because the identified sequence features do not rely on the statistical characteristics of network traffic or packet header field values, but instead distinguish DDoS traffic from normal network traffic by identifying the protocol, direction, and packet length information of data packets in network traffic, it can effectively identify DDoS traffic that uses slow attacks and packet header field obfuscation.
[0114] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 3 , Figure 3 This is a flow chart of the second embodiment of the DDoS traffic identification method of the present application.
[0115] The packet length category is determined by a packet length classification model, and the packet length classification model is trained based on training traffic. The DDoS traffic identification method further includes steps S01 to S03:
[0116] Step S01, classifying the training data packets in the training traffic based on the protocol types of the training data packets to obtain a plurality of first training data sets;
[0117] It should be noted that training traffic refers to the data set used for model training, which contains various features and labels required for model learning; training data packet refers to a single data sample used in model training, and each data packet contains a set of input features; the first training data set is a set of training data packets after the training data packets are classified according to the protocol type, and the protocol type of the training data packets in this set is consistent.
[0118] It can be understood that since the packet length distribution of data packets of different protocol types is inconsistent, step S01 is performed to avoid the problem of inaccurate division when dividing the training data packets according to the protocol type, thereby improving the accuracy of the packet length division of the training data packets.
[0119] Exemplarily, according to the protocol type of the training data packets in the training traffic, the training data packets are divided into two categories, TCP and UDP, to obtain two first training data sets, namely a TCP data set and a UDP data set.
[0120] Step S02, classifying the training data packets in any first training data set according to the IP addresses of the training data packets in the first training data set to obtain a plurality of second training data sets;
[0121] It should be noted that the second training data set is a set of training data packets that are sorted and grouped according to the IP addresses and the time sequence in which the training data packets enter the first training data set. The IP addresses of all the training data packets in this set have at most two different IP addresses.
[0122] It is understandable that since DDoS traffic may use multiple source IP addresses to send a large number of data packets to a destination IP address, or send data packets from a single source IP address to multiple destination IP addresses, performing step S02 can avoid the problem of being unable to determine that the network traffic caused by DDoS traffic is excessive within the same transmission path, thereby improving the accuracy of identifying DDoS traffic.
[0123] Step S03: obtaining a plurality of training data packets from each of the second training data sets as model training sets, and training a preset clustering model based on the model training sets to obtain the packet length classification model.
[0124] It should be noted that the model training set refers to the collection of data packets used to train the clustering model.
[0125] In addition, it should be noted that the clustering model is an unsupervised learning algorithm used to automatically group objects in a data set so that the similarity between objects in the same group is high, while the similarity between different groups is low.
[0126] It is understandable that since training the clustering model requires a training set of appropriate data, step S03 is performed to train the clustering model using the training data packet, thereby providing a suitable training set for training the clustering model.
[0127] Exemplarily, the first 1000 training data packets in each second training data set are selected as a model training set, and the clustering model is trained based on the model training set to obtain a packet length classification model.
[0128] In a feasible implementation, the step of training the preset clustering model based on the model training set in step S03 may include steps S031 to S033:
[0129] Step S031, obtaining the data packet length of each training data packet in the model training set, and performing statistics on the data packet length of each obtained training data packet to obtain a statistical distribution result;
[0130] It should be noted that the statistical distribution refers to the packet length distribution of each training data packet in the model training set, which is used to describe how the statistical data packet lengths are distributed.
[0131] It can be understood that since the data packet length in the model training set is highly flexible, step S031 is performed to avoid inaccurate classification of packet length in the clustering model by determining the distribution of data packet length, thereby improving the accuracy of the clustering model in classifying data packet length.
[0132] Step S032, determining the number of clusters of the preset clustering model based on the statistical distribution result, and configuring the preset clustering model according to the number of clusters;
[0133] It should be noted that the number of clusters refers to the number of independent clusters formed when using the clustering algorithm to group data packets.
[0134] It can be understood that since the clustering model requires the number of clusters to match the actual business when processing the data packet length data of the data packet, step S032 is performed to configure the clustering model according to the distribution of the data packet length, thereby avoiding the problem of mismatch between the number of clusters and the actual business and improving the matching degree between the number of clusters and the actual business.
[0135] Step S033: input the model training set into the preset clustering model, and process the model training set in the preset clustering model through the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm to determine the clustering core points of the preset clustering model.
[0136] It should be noted that the DBSCAN algorithm is a density-based clustering algorithm that can discover clusters of any shape and can handle noise and outliers; a cluster core point refers to a data point that contains at least the preset minimum number of points in the neighborhood of the point.
[0137] It can be understood that since an efficient algorithm is required to adapt to clusters of different shapes and sizes when processing the model training set, step S033 is performed to determine the core points of the clustering model by using the DBSCAN algorithm to process the model training set, thereby improving the accuracy of the clustering model in processing the model training set.
[0138] Exemplarily, the model training set is input into the clustering model, the model training set is clustered in the clustering model by the DBSCAN algorithm, the cluster center point is determined according to the distribution of the clustering results, and the cluster center point is used as the cluster core point of the clustering model.
[0139] In this embodiment, the clustering model is accurately trained by determining the packet length distribution of the model training set, so as to improve the accuracy of the clustering model in classifying data packet length data.
[0140] In this embodiment, a clustering model is trained using training traffic to obtain a packet length classification model capable of classifying packet lengths. Identifying DDoS traffic in network traffic requires identifying the packet length characteristics of the packets in the network traffic. Therefore, this embodiment provides a method for obtaining identification feature factors for identifying DDoS traffic in network traffic. The accuracy of obtaining the packet length characteristics used to identify DDoS traffic is improved through the training process.
[0141] Based on the first and / or second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as those in the first and second embodiments can be referred to above and will not be described in detail. Figure 4 , Figure 4 This is a flow chart of the third embodiment of the DDoS traffic identification method of the present application. The DDoS traffic is identified using an LSTM (Long Short Term Memory) model, which is trained based on the training traffic. The method further includes steps S100 to S300:
[0142] Step S100: configuring the number of stacked layers and hidden layers of the LSTM model, wherein the number of stacked layers is positively correlated with the duration of the LSTM model acquiring the dependency relationship of the coding sequence, and the number of hidden layers is positively correlated with the capacity of the LSTM model to receive the coding sequence;
[0143] It should be noted that the number of stacked layers refers to the number of LSTM layers placed consecutively in the LSTM model. Increasing the number of stacked layers can improve the complexity of the model, enabling it to capture more complex patterns and long-term dependencies. The number of hidden layers usually refers to the number of hidden units or neurons in a single LSTM layer, which determines the size and capacity of the model. Increasing the number of hidden layer units can improve the representation ability of the model, enabling it to capture more complex features.
[0144] It is understandable that since the LSTM model needs to adjust its own performance according to actual business, step S100 is performed to improve the performance of the LSTM model by configuring the number of stacked layers and the number of hidden layers of the LSTM model, while reducing the risk of overfitting and improving the generalization ability of the model to adapt to the appropriate training data set.
[0145] Step S200, obtaining the protocol type of the training data packet in the training traffic and the IP address of the training data packet, and determining the packet length category of the training data packet by using the packet length classification model;
[0146] It can be understood that since the purpose of training the LSTM model is to enable the LSTM model to identify the protocol characteristics, IP address characteristics and packet length characteristics of the data packets in the network traffic to be identified, step S200 is performed to provide effective training data for training the LSTM model by determining the protocol type, IP address and packet length category of the training data packets.
[0147] Step S300: Encode the second training data set based on the protocol type of the training data packet, the IP address of the training data packet, and the packet length category of the training data packet to obtain an encoded training set, and input the encoded training set into the LSTM model to obtain a model recognition result. According to the difference between the model recognition result and the encoded training set label, the model parameters of the LSTM model are updated to train the LSTM model.
[0148] It should be noted that the encoded training set refers to the dataset used to directly train the LSTM model.
[0149] It is understandable that since the LSTM model is used to identify DDoS traffic, the data input to the LSTM model must be in a numerical format, so step S300 is performed to improve the validity of the data input to the LSTM model by determining a coding training set.
[0150] In this embodiment, the LSTM model is trained by using the protocol type, IP address, and packet length category of the training data packet, so that the LSTM model can identify the protocol type, IP address, and packet length category characteristics of DDoS traffic in network traffic, thereby improving the accuracy of identifying DDoS traffic in network traffic.
[0151] For example, to help understand the implementation process of the DDoS traffic identification method obtained by combining this embodiment with the above-mentioned embodiment 1 and / or embodiment 2, please refer to Figure 5 , Figure 5 This article provides a brief flowchart of a DDoS traffic identification method. Specifically:
[0152] First, the serialization module preprocesses packets in network traffic. This involves grouping packets into queues based on IP addresses and selecting a first preset number of packets from the queues to input into a packet length classification model. The packet length classification model is then trained using the packet length clustering module, specifically using training traffic. Based on the packet length categories, protocol types, and IP addresses determined by the packet length classification model, feature encoding is performed to generate a coded sequence. This coded sequence is then input into the attack detection model, specifically the LSTM model, to identify DDoS traffic.
[0153] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the DDoS traffic identification method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0154] This application also provides a DDoS traffic identification device, please refer to Figure 6 , the DDoS traffic identification device includes:
[0155] A division module 10 is configured to obtain an IP address of each data packet in the network traffic to be identified, and divide each data packet into a plurality of queues according to each IP address;
[0156] The category determination module 20 is configured to obtain, for any queue to be identified among the multiple queues, multiple data packets from the queue to be identified as sample data packets, and determine the packet length category of each sample data packet according to the packet length of each sample data packet;
[0157] An encoding module 30 is configured to perform encoding based on the protocol type of each sample data packet, the IP address of each sample data packet, and the packet length category of each sample data packet to obtain a queue code sequence of the queue to be identified;
[0158] A traversal module 40 is configured to compose a network code sequence of the network traffic to be identified by traversing the queue code sequences obtained by traversing the queues to be identified;
[0159] The identification module 50 is configured to obtain sequence features of the traffic coding sequence and identify DDoS traffic based on the sequence features.
[0160] Optionally, the packet length category is determined by a packet length classification model, the packet length classification model is trained based on training traffic, and the DDoS traffic identification device is further configured to:
[0161] Classifying the training data packets based on protocol types of the training data packets in the training traffic to obtain a plurality of first training data sets;
[0162] Classifying the training data packets in any first training data set according to the IP addresses of the training data packets in the first training data set to obtain a plurality of second training data sets;
[0163] A plurality of training data packets are respectively obtained from each of the second training data sets as model training sets, and a preset clustering model is trained based on the model training sets to obtain the packet length classification model.
[0164] Optionally, the step of training a preset clustering model based on the model training set includes:
[0165] Obtaining the data packet length of each training data packet in the model training set, and performing statistics on the data packet length of each obtained training data packet to obtain a statistical distribution result;
[0166] Determining the number of clusters of the preset clustering model based on the statistical distribution result, and configuring the preset clustering model according to the number of clusters;
[0167] The model training set is input into the preset clustering model, and the model training set is processed by the DBSCAN algorithm in the preset clustering model to determine the cluster core points of the preset clustering model.
[0168] Optionally, the DDoS traffic is identified by an LSTM model, the LSTM model is trained based on the training traffic, and the DDoS traffic identification device is further configured to:
[0169] Configuring the number of stacked layers and hidden layers of the LSTM model, wherein the number of stacked layers is positively correlated with the duration of the LSTM model acquiring the dependency relationship of the coding sequence, and the number of hidden layers is positively correlated with the capacity of the LSTM model to receive the coding sequence;
[0170] Obtaining a protocol type of a training data packet in the training traffic and an IP address of the training data packet, and determining a packet length category of the training data packet using the packet length classification model;
[0171] Based on the protocol type of the training data packet, the IP address of the training data packet, and the packet length category of the training data packet, the second training data set is encoded to obtain an encoded training set, and the encoded training set is input into the LSTM model to obtain a model recognition result. The model parameters of the LSTM model are updated through the difference between the model recognition result and the encoded training set label to train the LSTM model.
[0172] Optionally, the dividing module 10 is further configured to:
[0173] Obtaining the source IP address and destination IP address of each data packet in the network traffic to be identified;
[0174] Determining a transmission path for each of the data packets based on each of the source IP addresses and the destination IP address;
[0175] The data packets having the same transmission paths are divided into the same queue.
[0176] Optionally, the encoding module 30 is further configured to:
[0177] Determine the protocol type code value of each sample data packet based on a preset protocol type mapping table, and determine the IP address code value of each sample data packet based on a preset IP address mapping table;
[0178] Encoding the packet length category of each sample data packet according to the number of packet length categories of each sample data packet to obtain a packet length category code value of each sample data packet;
[0179] The queue coding sequence is determined based on the protocol type code value of each sample data packet, the IP address code value of each sample data packet, and the packet length category code value of each sample data packet.
[0180] Optionally, the DDoS traffic is identified by an LSTM model, wherein the LSTM model is configured with abnormal features of the DDoS traffic, and the identification module 50 is further configured to:
[0181] Acquire sequence features of the encoding sequence through the LSTM model, and compare the sequence features with the abnormal features;
[0182] When an abnormality is detected in the comparison result, it is determined that DDoS traffic exists in the coding sequence.
[0183] The DDoS traffic identification device provided in this application, employing the DDoS traffic identification method described in the aforementioned embodiments, can address the technical problem of effectively identifying slow-speed attacks and DDoS traffic with obfuscated packet header fields. Compared to the prior art, the DDoS traffic identification device provided in this application achieves the same beneficial effects as the DDoS traffic identification method described in the aforementioned embodiments. Other technical features of the DDoS traffic identification device are the same as those disclosed in the aforementioned embodiments and are not further elaborated here.
[0184] The present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the DDoS traffic identification method of the above-mentioned embodiment 1.
[0185] Reference below Figure 7 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The electronic device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0186] like Figure 7As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 1002 or programs loaded from a storage device 1003 into a random access memory (RAM) 1004. Various programs and data required for the operation of the electronic device are also stored in RAM 1004. The processing device 1001, ROM 1002, and RAM 1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.
[0187] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0188] The electronic device provided in this application, employing the DDoS traffic identification method described in the aforementioned embodiment, can address the technical problem of effectively identifying slow-speed attacks and DDoS traffic with obfuscated packet header fields. Compared to the prior art, the electronic device provided in this application achieves the same beneficial effects as the DDoS traffic identification method described in the aforementioned embodiment. Other technical features of this electronic device are the same as those disclosed in the aforementioned embodiment and are not further elaborated here.
[0189] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0190] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
[0191] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, a computer program) stored thereon, the computer-readable program instructions being used to execute the DDoS traffic identification method in the above-mentioned embodiment.
[0192] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0193] The computer-readable storage medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0194] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the electronic device: obtains the IP address of each data packet in the network traffic to be identified, and divides each data packet into multiple queues according to each IP address; for any queue to be identified in the multiple queues, obtains multiple data packets from the queue to be identified as sample data packets, and determines the packet length category of each sample data packet based on the data packet length of each sample data packet; encodes based on the protocol type of each sample data packet, the IP address of each sample data packet and the packet length category of each sample data packet to obtain a queue coding sequence of the queue to be identified; traverses the queue coding sequences obtained from each queue to be identified to form a network coding sequence of the network traffic to be identified; obtains the sequence characteristics of the traffic coding sequence, and identifies DDoS traffic based on the sequence characteristics.
[0195] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0196] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0197] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.
[0198] The computer-readable storage medium provided in this application stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned DDoS traffic identification method. This computer-readable storage medium can address the technical problem of effectively identifying slow attacks and DDoS traffic with obfuscated packet header fields. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are similar to those of the DDoS traffic identification method provided in the aforementioned embodiments and are not further elaborated here.
[0199] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned DDoS traffic identification method when executed by a processor.
[0200] The computer program product provided in this application can solve the technical problem of effectively identifying slow attacks and DDoS traffic with obfuscated packet header fields. Compared to the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the DDoS traffic identification method provided in the above-mentioned embodiments, and will not be elaborated here.
[0201] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A DDoS traffic identification method, characterized in that: The method includes: Obtaining the IP address of each data packet in the network traffic to be identified, and dividing each data packet into a plurality of queues according to each IP address; For any queue to be identified among the multiple queues, multiple data packets are obtained from the queue to be identified as sample data packets, and according to the data packet length of each of the sample data packets, a packet length category of each of the sample data packets is determined; Encoding is performed based on the protocol type of each of the sample data packets, the IP address of each of the sample data packets, and the packet length category of each of the sample data packets to obtain a queue coding sequence of the queue to be identified; The queue code sequences obtained by traversing each queue to be identified are used to form the network code sequence of the network traffic to be identified; A sequence feature of the traffic encoding sequence is obtained, and DDoS traffic is identified based on the sequence feature.
2. The method according to claim 1, characterized in that The packet length category is determined by a packet length classification model, and the packet length classification model is trained based on training traffic. The method further includes: Based on the protocol type of the training data packets in the training traffic, the training data packets are classified to obtain a plurality of first training data sets; Classifying the training data packets in any first training data set according to the IP addresses of the training data packets in the first training data set to obtain a plurality of second training data sets; A plurality of training data packets are respectively obtained from each of the second training data sets as model training sets, and a preset clustering model is trained based on the model training sets to obtain the packet length classification model.
3. The method according to claim 2, characterized in that The step of training the preset clustering model based on the model training set includes: Obtaining the data packet length of each training data packet in the model training set, and performing statistics on the obtained data packet length of each training data packet to obtain a statistical distribution result; Determining the number of clusters of the preset clustering model based on the statistical distribution result, and configuring the preset clustering model according to the number of clusters; The model training set is input into the preset clustering model, and the model training set is processed by the DBSCAN algorithm in the preset clustering model to determine the clustering core points of the preset clustering model.
4. The method according to claim 2, characterized in that The DDoS traffic is identified by an LSTM model, the LSTM model is trained based on the training traffic, and the method further includes: Configure the number of stacked layers and hidden layers of the LSTM model, wherein the number of stacked layers is positively correlated with the duration of the LSTM model acquiring the dependency relationship of the coding sequence, and the number of hidden layers is positively correlated with the capacity of the LSTM model to receive the coding sequence; Acquire the protocol type of the training data packet in the training traffic and the IP address of the training data packet, and determine the packet length category of the training data packet through the packet length classification model; Based on the protocol type of the training data packet, the IP address of the training data packet and the packet length category of the training data packet, the second training data set is encoded to obtain an encoded training set, and the encoded training set is input into the LSTM model to obtain a model recognition result. Through the difference between the model recognition result and the encoded training set label, the model parameters of the LSTM model are updated to train the LSTM model.
5. The method according to claim 1, characterized in that The step of obtaining the IP address of each data packet in the network traffic to be identified, and dividing each data packet into a plurality of queues according to each IP address comprises: Obtaining the source IP address and destination IP address of each data packet in the network traffic to be identified; Determining a transmission path for each of the data packets based on each of the source IP addresses and the destination IP address; The data packets having the same transmission paths are divided into the same queue.
6. The method according to claim 1, characterized in that The step of encoding based on the protocol type of each of the sample data packets, the IP address of each of the sample data packets, and the packet length category of each of the sample data packets to obtain the queue coding sequence of the queue to be identified comprises: Based on a preset protocol type mapping table, determine the protocol type code value of each of the sample data packets, and based on a preset IP address mapping table, determine the IP address code value of each of the sample data packets; According to the number of packet length categories of each of the sample data packets, the packet length category of each of the sample data packets is encoded to obtain a packet length category code value of each of the sample data packets; The queue coding sequence is determined based on the protocol type code value of each of the sample data packets, the IP address code value of each of the sample data packets, and the packet length category code value of each of the sample data packets.
7. The method according to claim 1, characterized in that The DDoS traffic is identified by an LSTM model, wherein the LSTM model is configured with abnormal features of the DDoS traffic, and the steps of obtaining sequence features of the encoding sequence and identifying the DDoS traffic based on the sequence features include: Acquire sequence features of the encoding sequence through the LSTM model, and compare the sequence features with the abnormal features; When an abnormality is detected in the comparison result, it is determined that DDoS traffic exists in the encoding sequence.
8. A DDoS traffic identification device, characterized in that: The device comprises: A division module, used for obtaining the IP address of each data packet in the network traffic to be identified, and dividing each data packet into a plurality of queues according to each IP address; A category determination module, for obtaining a plurality of data packets from any queue to be identified among the plurality of queues as sample data packets, and determining a packet length category of each of the sample data packets according to the packet length of each of the sample data packets; An encoding module, used for encoding based on the protocol type of each of the sample data packets, the IP address of each of the sample data packets and the packet length category of each of the sample data packets, to obtain a queue encoding sequence of the queue to be identified; A traversal module, used for traversing queue code sequences obtained by traversing each queue to be identified to form a network code sequence of the network traffic to be identified; The identification module is used to obtain the sequence characteristics of the traffic coding sequence and identify the DDoS traffic based on the sequence characteristics.
9. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the DDoS traffic identification method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the DDoS traffic identification method according to any one of claims 1 to 7 are implemented.
