Network security situation awareness method, computer equipment and storage medium
By using the BiLSTM network, the improved ResNeXt network and the dual attention mechanism model in network security situational awareness, the problem of low accuracy in network security situational awareness in the existing technology is solved, and more efficient network attack detection and prediction are achieved.
Patent Information
- Application Number
- CN202410846710.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-27
AI Technical Summary
Existing network security situational awareness methods have low accuracy and cannot effectively predict potential attacks and risks when facing complex and changing network threats. Especially in emerging wireless networks, traditional IDS is difficult to detect due to equipment vulnerabilities and limited resources. Detect attacks promptly.
A network security situational awareness model based on BiLSTM network, improved ResNeXt network and dual attention mechanism is adopted. Through dynamic snake convolution and dual attention mechanism, the core characteristics and contextual information of network traffic data are captured to improve network security situational awareness. Accuracy.
It improves the accuracy of network security situational awareness, can effectively capture long-term dependencies and suppress gradient problems, enhances attention to important features, and improves the detection and prediction capabilities of network attacks.
Smart Images

Figure CN118590885A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to a network security situation awareness method, computer equipment and storage medium. Background Art
[0002] Communication and network technologies, especially wireless networks, have developed rapidly in recent years. However, networks are also facing increasing security risks, posing a major threat to user privacy and security. Some common network security threats include data interception, cracking, transmission interference, configuration problems, free-riding, and denial of service attacks. Traditionally, intrusion detection systems (IDS) are used to detect attacks and provide security by identifying unauthorized use or abuse of computer systems. However, emerging wireless networks, such as the Internet of Things, lack standardization, have limited resources, have device vulnerabilities, and are often produced by manufacturers who do not pay attention to security. As a result, emerging wireless networks face more security issues and threats than traditional networks, resulting in a large number of increasingly complex attacks that cannot be detected by IDS in a timely manner. The mobility and flexibility of nodes also make it more difficult for incident handlers or network administrators to make appropriate and timely decisions. This contradiction has exacerbated the rapid development and application of various new network technologies.
[0003] Network Security Situational Awareness (NSSA) is designed to monitor, analyze, and predict network security situations in real time, and provide timely and effective countermeasures. Intelligent NSSA systems can monitor and capture various types of threats, analyze them, and develop plans to avoid further attacks. The comprehensive design of intelligent NSSA systems will help decision makers understand the current and upcoming security status of the network. Network security situational awareness is a major component of the intelligent NSSA system. It is an important active defense against network risks and threats, involving assessing the network security status based on the current situation and predicting the future network security status based on historical data, predicting the probability, severity, and impact of potential attacks and risks.
[0004] However, in actual situations, the cycle of network data may change dynamically, such as low-frequency and multi-stage attacks in the industrial Internet of Things and hidden behaviors in the network, which makes it impossible for attack graphs, generalized Bayesian classification neural networks, Markov correlation models, evidence reasoning rules, BiGRU neural networks and other machine learning methods to meet the needs of comprehensive situation prediction, and the accuracy of network security situation awareness is low. Summary of the invention
[0005] The purpose of the present invention is to provide a network security situation awareness method, computer equipment and storage medium, which can improve the accuracy of network security situation awareness.
[0006] To achieve the above object, the present invention provides the following solutions:
[0007] A network security situation awareness method, comprising:
[0008] Get current network traffic data;
[0009] According to the current network traffic data, based on the network security situation awareness model, the security situation of the current network is predicted to determine the category of the current network; wherein the category of the current network includes normal network communication and various types of network attacks; the network security situation awareness model is pre-trained using a training sample set;
[0010] The network security situation awareness model includes a BiLSTM network, an improved ResNeXt network, a dual attention network and a fully connected layer connected in sequence; the improved ResNeXt network is: dynamic snake convolution is used to replace the ordinary convolution of the residual module in ResNeXt.
[0011] To achieve the above object, the present invention provides the following solutions:
[0012] A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned network security situation awareness method.
[0013] To achieve the above object, the present invention provides the following solutions:
[0014] A computer-readable storage medium stores a computer program, which implements the above-mentioned network security situation awareness method when executed by a processor.
[0015] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects: the network security situation awareness model used in the present invention is based on a BiLSTM network, a ResNeXt network improved by dynamic snake convolution, and a dual attention mechanism, which pays more attention to the core structural characteristics, can capture information in spatial and channel dimensions, effectively capture long-term dependencies, and suppress gradient problems, thereby improving the accuracy of network security situation awareness. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0017] Figure 1 A flowchart of the network security situation awareness method provided by the present invention;
[0018] Figure 2 This is a schematic diagram of the structure of the network security situation awareness model;
[0019] Figure 3 This is a schematic diagram of the construction process of the network security situation awareness model;
[0020] Figure 4 It is a schematic diagram of the structure of the BiLSTM network;
[0021] Figure 5 Coordinate calculation graph for dynamic snake convolution;
[0022] Figure 6 Schematic diagram of the spatial attention module;
[0023] Figure 7 Schematic diagram of the channel attention module;
[0024] Figure 8 Schematic diagram of the structure of the residual module in the improved ResNeXt network. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The purpose of the present invention is to provide a network security situation awareness method, computer equipment and storage medium, which can improve the accuracy of network security situation awareness by extracting features from the core of network traffic data through an improved model and paying more attention to contextual information.
[0027] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Example 1
[0029] like Figure 1 As shown, this embodiment provides a network security situation awareness method, including:
[0030] Step 1: Get current network traffic data.
[0031] Step 2: According to the current network traffic data, based on the network security situation awareness model, the security situation of the current network is predicted to determine the category of the current network. The category of the current network includes normal network communication and various types of network attacks. The network security situation awareness model is pre-trained using a training sample set.
[0032] like Figure 2 As shown, the network security situation awareness model includes a BiLSTM network, an improved ResNeXt network, a dual attention network and a fully connected layer connected in sequence. The improved ResNeXt network is: a dynamic snake convolution is used to replace the ordinary convolution of the residual module in ResNeXt.
[0033] The BiLSTM network can effectively process sequence data and capture its important features; the improved ResNeXt network can extract core features through dynamic snake convolution operations; finally, the features are weighted through the dual attention mechanism to enhance the network security situation awareness model's attention to important features. Therefore, the network security situation awareness model can improve the accuracy of network security situation awareness.
[0034] Specifically, Figure 3 As shown, the construction process of the network security situation awareness model includes:
[0035] (1) Obtain a network security dataset, which includes a plurality of network flow data and a category label for each network flow data.
[0036] In this embodiment, the network security dataset uses the UNSW-NB15 dataset. The network traffic data in the UNSW-NB15 dataset is presented in the form of network data packets, and each data packet contains multiple feature values. The following are some specific features of the network traffic data in the UNSW-NB15 dataset:
[0037] Source IP address and destination IP address: Indicates the source and destination IP addresses of the data packet.
[0038] Source port number and destination port number: Indicates the source and destination port numbers of the data packet.
[0039] Protocol: Indicates the network protocol used by the data packet, such as Transmission Control Protocol (TCP), User Datagram Protocol (UDP), or Internet Control Message Protocol (ICMP).
[0040] Flow identifier: used to identify the flow to which a data packet belongs, that is, a group of associated data packets.
[0041] Packet length: Indicates the length of the packet, usually in bytes.
[0042] Timestamp: indicates the capture timestamp of the data packet.
[0043] Flag bit: used to indicate the status or characteristics of the data packet, such as the synchronization sequence number (SYN), confirmation character (ACK), and completion (FIN) flag of the TCP connection.
[0044] The characteristic values of each layer protocol of the data packet: such as IP header information, TCP header information or UDP header information, etc.
[0045] The types of network attacks include denial of service, distributed denial of service and malware.
[0046] (2) Preprocessing the network traffic data in the network security data set to obtain a training sample set. The preprocessing includes data cleaning, digitization, standardization and normalization. The training sample set is divided into a training set and a test set.
[0047] (3) Using the training sample set, the network security situation awareness model is iteratively trained until the maximum number of iterations is reached or the loss function converges. In the present invention, the network security situation awareness model is referred to as the BDSCResNeXt model.
[0048] Specifically, the training sample set is input into the BiLSTM network. The BiLSTM network is used to process network traffic data and extract its features. The data processed by the BiLSTM network is input into the improved ResNeXt network. The improved ResNeXt network is used to perform deep feature extraction and classification on the input data. Then the outputs of the BiLSTM network and the improved ResNeXt network are spliced together to form a comprehensive feature vector. The comprehensive feature vector is weighted by the dual attention network to enhance the network security situation awareness model's attention to important features. Finally, the processed features are expanded into a one-dimensional tensor and used as the output of the network security situation awareness model.
[0049] In the forward propagation, after the input data is processed by a series of layers, if the include_top parameter is True, the final classification is performed through global average pooling and fully connected layers.
[0050] Compare the output of the network security situation awareness model with the category label, perform back propagation on the loss function (cross entropy loss is selected in this embodiment) according to the number of samples predicted correctly, calculate the gradient, and update the parameters of the model through the optimizer (AdaBelief is selected in this embodiment). Update the number of training steps and the total number of training steps. At the end of each epoch, print the accuracy of the current epoch.
[0051] Specifically, first load the dataset and create training and test data loaders. Then define the cybersecurity situation awareness model and move it to the appropriate device (GPU or CPU). Next, set the loss function and optimizer, and specify the number of training rounds. In each training round, iterate the training data loader, calculate the loss and accuracy of the model, and update the model parameters through back propagation. In each test round, iterate the test data loader and calculate the accuracy of the model on the test set. Finally, output the training and test accuracy.
[0052] Furthermore, step 2 specifically includes:
[0053] Step 21: Perform preliminary feature extraction on the current network traffic data through a BiLSTM network to obtain preliminary feature data.
[0054] The BiLSTM network processes sequence data in the UNSW-NB15 dataset. Network traffic data is usually generated in time order, so each network connection or data packet can be regarded as a sequence. The BiLSTM network can perform time series modeling on network traffic data and capture the relationship and contextual information between connections.
[0055] like Figure 4As shown in the figure, the BiLSTM network is used to process input data and extract its features. The input of BiLSTM is features, initial hidden state and memory cells. After internal calculation, new memory cells and new hidden states are obtained. The hidden state can be connected to the softmax output or continue to be calculated with the features of the next round. The BiLSTM network includes a forget gate, an input gate and an output gate. The forget gate, input gate and output gate all generate a weight, which is multiplied by an output to control the size of the output. That is, the forget gate determines the forget value of the memory cell of this main line according to the input features and hidden layer, the input gate determines the replenishment value of the memory cell of this main line according to the input features and hidden layer, and the output gate determines the value taken from the memory cell as the new hidden state output according to the input features and hidden layer. The specific formula is as follows:
[0056] Forget gate part:
[0057] Forget gate: f t =σ(U f h t-1 +W f x t );
[0058] Mainline forgotten: k t =c t-1 ⊙f t ;
[0059] Input gate part:
[0060] Input gate: i t =σ(U i h t-1 +W i x t );
[0061] Supply source: g t =tanh(U g h t-1 +W g x t );
[0062] Gate control supply size: j t =g t ⊙i t ;
[0063] Mainline supply: c t =j t +k t ;
[0064] Output gate part:
[0065] Output gate: o t =σ(U o h t-1 +Wo x t );
[0066] Mainline generates output: h t =tanh(c t )⊙o t ;
[0067] Among them, f t is the value of the forget gate at time t, i t is the value of the input gate at time t, o t is the value of the output gate at time t, x t is the input at time t, h t-1 is the hidden layer state value at time t-1, h t is the hidden layer state value at time t, g t is the time t for h t-1 and x t Initial feature extraction of k t is the calculation result of the forget gate at time t, j t is the calculation result of the input gate at time t, c t is the cell state at time t, c t-1 is the cell state at time t-1, W f For the Forgotten Gate t-1 The weight coefficient, W i h is the input gate t-1 The weight coefficient, W o h is the output gate t-1 The weight coefficient, W g h is the feature extraction process t-1 The weight coefficient, U f For the Forgotten Gate t The weight coefficient, U i is the input gate x t The weight coefficient, U o is the output gate x t The weight coefficient, U g is the feature extraction process x t The weight coefficient, tanh represents the tangent hyperbolic function, σ represents the activation function Sigmoid, and ⊙ is the Hadamard product.
[0068] The network parameters of the BiLSTM network include: the dimension of the input feature, that is, the length of the feature vector input at each time step; the dimension of the hidden layer, that is, the output dimension of the LSTM unit; the length of the feature vector input in the LSTM network; the dimension of the hidden layer in the LSTM network; the number of layers in the LSTM network; the flag of whether the LSTM network is bidirectional, which is set to True here, indicating that a bidirectional LSTM is constructed; the dimension of the input feature of the fully connected layer, that is, the dimension of the hidden state output by the LSTM multiplied by 2 (because it is bidirectional); the dimension of the output feature of the fully connected layer, that is, the number of categories of the classifier.
[0069] Step 22: Perform deep feature extraction on the preliminary feature data through an improved ResNeXt network to obtain deep feature data.
[0070] The improved ResNeXt network processes other features in the UNSW-NB15 dataset, such as numerical features. It can be used to extract feature representations of non-sequential data. It can capture the relationship between features through convolution operations and model and extract numerical features.
[0071] The improved ResNeXt network specifically includes: dynamic snake convolution, batch normalization, activation function, maximum pooling and other operations, and constructs residual modules of different layers by calling the _make_layer method.
[0072] Dynamic snake convolution adds continuity constraints to the design of the convolution kernel; each convolution position is based on its previous position and freely chooses the swing direction, thereby ensuring the continuity of perception while freely choosing. On the one hand, dynamic snake convolution can freely fit the structural learning features, and on the other hand, it can not deviate too far from the target structure under the constraints, so as to pay more attention to the core structural characteristics.
[0073] For a standard 3×3 two-dimensional convolution kernel K, it is expressed as:
[0074] K={(x-1,y-1),(x-1,y),...,(x+1,y+1)}.
[0075] The center coordinate of the two-dimensional convolution kernel K is K m =(x m ,y m ).
[0076] In order to make the convolution kernel more flexible to focus on the complex geometric features of the target, a deformation offset Δ is introduced, and an iterative strategy is adopted, such as Figure 5 As shown, the next viewing position of each target to be processed is selected in turn, ensuring continuity of attention and not spreading the perceptual field too far due to large deformation shifts.
[0077] The dynamic snake convolution kernel specifically includes: all biases that control the deformation of a single convolution kernel are learned in the network at one time, and there is only one range constraint for this bias, namely the receptive field range; controlling the deformation of all convolutions depends on the final loss constraint feedback of the entire network, and the change process is free; adding continuity constraints to the design of the convolution kernel, each convolution position is based on its previous position, and the swing direction can be freely selected, thereby ensuring the continuity of the perception while freely selecting.
[0078] In dynamic snake convolution, each grid position represents the sampling position of the convolution kernel on the input feature map. By accumulating these positions, a linear morphological structure can be formed, which helps to extract directional features.
[0079] The difference between dynamic snake convolution and ordinary convolution is as follows:
[0080] Convolution kernel shape: Ordinary convolution uses a fixed-shape convolution kernel, usually a rectangle or square. The size and shape of the convolution kernel remain unchanged throughout the convolution process. Dynamic snake convolution forms a linear morphological structure by accumulating offset parameters, which can realize convolution kernels of different shapes and directions. The convolution kernel of dynamic snake convolution can adaptively change shape according to task requirements, which has greater flexibility.
[0081] Sampling method: Ordinary convolution uses a fixed sampling method at each position, usually sampling the surrounding pixels symmetrically around the central pixel. This sampling method is suitable for extracting local features. Dynamic snake convolution accumulates offset parameters and samples along a straight line or curve at each position, which can extract features with more directional and shape perception. Dynamic snake convolution can better capture long-distance contextual information and global features.
[0082] Number of parameters: The number of parameters of ordinary convolution is fixed, which is related to the size of the convolution kernel and the number of channels of the input feature map. The number of parameters of dynamic snake convolution is variable, depending on the shape of the convolution kernel and the sampling method. Since the shape of the convolution kernel of dynamic snake convolution is dynamically adjusted, the number of parameters can vary depending on the input data.
[0083] In dynamic snake convolution, the standard convolution kernel is linearized along the x-axis and y-axis. Taking the x-axis as an example, the specific position of each grid in the convolution kernel is expressed as: K m±c =(x m±c ,y m±c), where c = {0, 1, 2, 3, 4} represents the horizontal distance from the center grid. Each grid position represents the sampling position of the convolution kernel on the input feature map. By accumulating these positions, a linear morphological structure can be formed, which helps to extract directional features. m±c The selection of is a cumulative process. From the center position K m Initially, the position of the grid away from the center depends on the position of the previous grid: m In comparison, K m+1 An offset Δ={δ|δ∈[-1,1]} is added. Therefore, the offset needs to be accumulated to ensure that the convolution kernel conforms to the linear morphology structure.
[0084] Figure 5 The change in the x-axis direction is expressed as follows:
[0085]
[0086] The change in the y-axis direction is expressed as follows:
[0087]
[0088] Among them, Δy is the y-axis offset, and Δx is the x-axis offset.
[0089] Since the offset Δ is usually a fraction, bilinear interpolation is implemented as follows:
[0090] K1=∑ K 'B(K',K1)·K';
[0091] Among them, K1 represents the fractional position, K' represents the enumeration of all integer spatial positions, B(·) is the bilinear interpolation kernel, which is divided into two one-dimensional kernels, B(K1,K') = b(K 1x ,K' x )·b(K 1y ,K' y ), b(·) represents a one-dimensional interpolation kernel function, which is used to calculate the weight in a single dimension. In this formula, b(K 1x ,K' x ) and b(K 1y ,K' y ) represent the one-dimensional interpolation kernel function on the x-axis and y-axis respectively, K 1x , K' x , K 1y , K' y Represents the position of the score relative to the position of the nearest neighbor data point on the corresponding axis.
[0092] Bilinear interpolation is used to convert fractional positions to positive positions. When fractional positions need to be located on a discrete pixel grid, bilinear interpolation can estimate the pixel value of the fractional position by taking a weighted average of the nearest integer positions. This interpolation method can make the pixel values of the fractional positions more continuous and smooth, thereby achieving more accurate positioning and transformation effects.
[0093] Step 23: Concatenate the preliminary feature data and the deep feature data to obtain a comprehensive feature vector.
[0094] The outputs of the BiLSTM network and the improved ResNeXt network are fused to comprehensively utilize the different types of feature information they have learned. By concatenating their feature vectors in dimension 1, the sequence and non-sequence features can be combined into a comprehensive feature vector. The fusion strategy can comprehensively consider the temporal relationship in the data and the relationship between other features.
[0095] Step 24: The spatial dependency and channel dependency of the comprehensive feature vector are learned through a dual attention network to obtain spatial dependency features and channel dependency features.
[0096] Specifically, the dual attention network includes a position attention module (PAM) and a channel attention module (CAM). The dual attention network is divided into two dimensions and can collect rich contextual information.
[0097] The spatial dependency relationship of the comprehensive feature vector is learned through the spatial attention module to obtain the spatial dependency feature.
[0098] like Figure 6 As shown, first, the comprehensive feature vector A (C×H×W) is convolved through three convolutional layers to obtain the first feature vector B, the second feature vector C and the third feature vector D. Then, the first feature vector B, the second feature vector C and the third feature vector D are reshaped into two-dimensional features (C×N), N=H×W, to obtain the first two-dimensional feature, the second two-dimensional feature and the third two-dimensional feature. Then, the first two-dimensional feature is transposed (N×C) and multiplied with the second two-dimensional feature (C×N), and then passed through the Softmax function to obtain the two-dimensional spatial attention map S (N×N). Then, the transpose of the third two-dimensional feature (C×N) and the two-dimensional spatial attention map S (N×N) is matrix multiplied, multiplied by the spatial scale coefficient α, and reshaped into a three-dimensional feature (C×H×W) to obtain a three-dimensional spatial attention map. Finally, the three-dimensional spatial attention map is added to the comprehensive feature vector A to obtain the spatial dependency feature E. 1Where C is the number of channels of the comprehensive feature vector, H is the height of the comprehensive feature vector, and W is the width of the comprehensive feature vector. α is initialized to 0 and gradually learns to obtain a larger weight.
[0099]
[0100] in, is the feature of the jth position in the spatially dependent feature, that is, the weighted sum of the features at all positions and the original features, S ji is the influence of the i-th position on the j-th position in the two-dimensional spatial attention map, N is the total number of positions, and A j is the feature of the jth position in the comprehensive feature vector, D i is the feature at the jth position in the third eigenvector.
[0101] It can be seen from the above formula that the value of each point of the final output spatial dependency feature E is the result of the weighted sum of the original features (comprehensive feature vectors) at each position.
[0102] The channel-dependent feature is obtained by learning the dependency of the comprehensive feature vector on the channel through the channel attention module.
[0103] like Figure 7 As shown, first, the comprehensive feature vector A is reshaped into a two-dimensional feature to obtain a fourth two-dimensional feature (C×N). Then, the fourth two-dimensional feature set is transposed (N×C) and multiplied with the fourth two-dimensional feature, and then the two-dimensional channel attention map X (C×C) is obtained through the Softmax function. The two-dimensional channel attention map is then transposed, matrix multiplication is performed with the fourth two-dimensional feature (C×N), and multiplied by the channel scale coefficient β, and then reshaped into a three-dimensional feature (C×H×W) to obtain a three-dimensional channel attention map. Finally, the three-dimensional channel attention map is added to the comprehensive feature vector to obtain the channel-dependent feature E. 2 . Among them, β is initialized to 0 and gradually learns to get larger weights.
[0104]
[0105] in, is the feature of the jth position in the channel-dependent feature, A i is the feature of the i-th position in the comprehensive feature vector, A j is the feature of the jth position in the comprehensive feature vector.
[0106] Step 25: Perform feature fusion processing on the space-dependent feature and the channel-dependent feature to obtain a dual attention feature.
[0107] Specifically, the spatial dependency features and channel dependency features are first element-wise summed to complete feature fusion, and then a convolution is performed to generate the final prediction map, namely the dual attention feature.
[0108] Step 26: Expand the dual attention feature into a one-dimensional tensor and classify it through a fully connected layer to determine the category of the current network.
[0109] The network security situation awareness model used in the present invention is based on the advantages of BiLSTM network, improved ResNeXt network and dual attention mechanism, pays more attention to the core structural characteristics, can capture information in spatial and channel dimensions, effectively capture long-term dependencies, and suppress gradient problems, thereby improving the accuracy of network security situation awareness.
[0110] In order to verify the network security situation awareness method in Example 1, the CICIDS2017 data set is used for training and testing. The specific process is as follows:
[0111] S1: Obtain a network security dataset publicly available on the Internet and perform data preprocessing on the dataset. The CICIDS2017 (Canadian Institute for Cybersecurity Intrusion Detection Systems2017) network intrusion detection dataset is used in the present invention to evaluate and study the performance of network intrusion detection systems. This dataset contains a large amount of simulated network traffic data, which is used to simulate various network attacks and normal network communications. The CICIDS2017 dataset contains multiple types of network traffic, including normal network communications and various types of network attacks, such as DoS (denial of service), DDoS (distributed denial of service), malware, etc. Each data sample in the dataset has a corresponding label, indicating whether the data flow belongs to normal communication or different types of network attacks, which is helpful for supervised learning and evaluation of model performance.
[0112] ① Data cleaning: Processing missing values: Detect and process missing values in the data set, and fill or delete them; Processing duplicate values: Detect and process duplicate samples in the data set; Processing outliers: Detect and process outliers in the data set, use statistical methods or rule-based methods to identify outliers, and perform appropriate processing.
[0113] ②Digitization: Convert non-numeric data (such as categorical data) in the data set into numerical data for subsequent modeling and analysis. One-hot encoding is used.
[0114] ③ Standardization: Standardizing numerical features to make them obey the standard normal distribution helps improve the convergence speed and stability of model training.
[0115] ④ Normalization: Scale the numerical features to the same range to avoid the impact of different dimensions of different features on the modeling results, and use the min-max normalization method to normalize the feature values to between 0 and 1.
[0116] S2: Build the BDSCResNeXt model and input the preprocessed data into the model for training and testing, including:
[0117] ①First, input into the BiLSTM network. The shape of the input data is [batch_size, max_len, n_class], where batch_size represents the number of samples in each batch, max_len represents the sequence length of each sample, and n_class represents the feature dimension of each time step. During the forward calculation process, the input data passes through a multi-layer bidirectional LSTM (BiLSTM) network. First, the dimension of the input data is transposed by the transposition method to make it conform to the input format of the LSTM network. Then, the sequence data is processed through the LSTM layer, including the initialization of the hidden state, the operation of the LSTM unit, and the output of the hidden state. Finally, the output is performed through the fully connected layer to map the hidden state to the target category space. Finally, the BiLSTM network returns the result of the forward calculation, and the output result dimension is [batch_size, n_class], which represents the category probability distribution corresponding to each sample.
[0118] ② Input the output features obtained above into the improved ResNeXt network. The input data is first extracted through a dynamic snake convolution, followed by a batch normalization layer and a ReLU activation function, and then a maximum pooling operation is performed, and then the first layer, the second layer, and the third layer are input in turn. The first layer, the second layer, and the third layer each contain a residual module, and the first layer, the second layer, and the third layer are used to extract features at different levels. The features are then globally pooled through an average pooling operation, and then flattened into vectors through a flattening layer, and finally classified through a fully connected layer.
[0119] like Figure 8 As shown in the figure, in each residual module, the output of the last layer is added to the initial input and then ReLU is used to obtain the final output. Each residual module contains three consecutive snake dynamic convolution layers, each of which is followed by a batch normalization layer and a ReLU activation function. The input of the residual module passes through an optional downsampling layer to match the dimension of the main path. Finally, the output of the residual module is added to the input and another ReLU activation function is used to produce the final output.
[0120] ③ The outputs of the BiLSTM network and the improved ResNeXt network are concatenated to form a comprehensive feature vector. Subsequently, the comprehensive feature vector is weighted by the dual attention network to enhance the model's attention to important features. Finally, the processed features are expanded into a one-dimensional tensor and used as the output of the model.
[0121] S3: Perform training and testing. Load the dataset and create training and test data loaders. Then define the model and move it to the appropriate device. Next, set the loss function and optimizer and specify the number of training rounds. In each training round, iterate the training data loader and calculate the loss and accuracy of the model, and update the model parameters through backpropagation. In each test round, iterate the test data loader and calculate the accuracy of the model on the test set. Finally, output the training and test accuracy.
[0122] Example 2
[0123] A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the network security situation awareness method in Example 1.
[0124] Example 3
[0125] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the network security situation awareness method in Example 1.
[0126] Example 4
[0127] A computer program product includes a computer program, which implements the network security situation awareness method in Example 1 when executed by a processor.
[0128] Example 5
[0129] A computer device, which may be a database. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store pending transactions. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the network security situation awareness method in Example 1 is implemented.
[0130] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present invention may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided by the present invention may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.
[0132] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0133] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A network security situation awareness method, It is characterized in that The network security situation awareness method comprises: Get current network traffic data; According to the current network traffic data, based on the network security situation awareness model, the security situation of the current network is predicted to determine the category of the current network; wherein the category of the current network includes normal network communication and various types of network attacks; the network security situation awareness model is pre-trained using a training sample set; The network security situation awareness model includes a BiLSTM network, an improved ResNeXt network, a dual attention network and a fully connected layer connected in sequence; the improved ResNeXt network is: dynamic snake convolution is used to replace the ordinary convolution of the residual module in ResNeXt.
2. The network security situation awareness method according to claim 1, It is characterized in that The training process of the network security situation awareness model includes: Acquire a network security data set; the network security data set includes a plurality of network flow data and a category label for each network flow data; Preprocessing the network traffic data in the network security data set to obtain a training sample set; the preprocessing includes data cleaning, digitization, standardization and normalization processing; The network security situation awareness model is iteratively trained using the training sample set until a maximum number of iterations is reached or the loss function converges.
3. The network security situation awareness method according to claim 2, It is characterized in that The network traffic data includes source IP address, destination IP address, source port number, destination port number, protocol, flow identifier, data packet length, timestamp, flag bit and characteristic values of each layer protocol of the data packet.
4. The network security situation awareness method according to claim 1, It is characterized in that The types of network attacks include denial of service, distributed denial of service and malware.
5. The network security situation awareness method according to claim 1, It is characterized in that According to the current network traffic data, based on the network security situation awareness model, the security situation of the current network is predicted to determine the category of the current network, specifically including: Performing preliminary feature extraction on the current network traffic data through a BiLSTM network to obtain preliminary feature data; Performing deep feature extraction on the preliminary feature data through an improved ResNeXt network to obtain deep feature data; Concatenating the preliminary feature data and the deep feature data to obtain a comprehensive feature vector; The spatial dependency and channel dependency of the comprehensive feature vector are respectively learned through a dual attention network to obtain spatial dependency features and channel dependency features; Performing feature fusion processing on the space-dependent feature and the channel-dependent feature to obtain a dual attention feature; The dual attention features are expanded into a one-dimensional tensor and classified through a fully connected layer to determine the category of the current network.
6. The network security situation awareness method according to claim 5, It is characterized in that The dual attention network includes a spatial attention module and a channel attention module; The spatial dependency and channel dependency of the comprehensive feature vector are learned through a dual attention network to obtain spatial dependency features and channel dependency features, including: Learning the spatial dependency of the comprehensive feature vector through a spatial attention module to obtain a spatial dependency feature; The channel-dependent feature is obtained by learning the dependency of the comprehensive feature vector on the channel through the channel attention module.
7. The network security situation awareness method according to claim 6, It is characterized in that The spatial dependency relationship of the comprehensive feature vector is learned through the spatial attention module to obtain spatial dependency features, which specifically include: The comprehensive feature vector is convolved through three convolutional layers to obtain a first feature vector, a second feature vector and a third feature vector; Reshape the first feature vector, the second feature vector and the third feature vector into two-dimensional features respectively to obtain a first two-dimensional feature, a second two-dimensional feature and a third two-dimensional feature; Transpose the first two-dimensional feature and multiply it with the second two-dimensional feature, and then pass it through the Softmax function to obtain a two-dimensional spatial attention map; Performing a matrix multiplication operation on the third two-dimensional feature and the transpose of the two-dimensional spatial attention map, multiplying the result by a spatial scale coefficient, and reshaping the result into a three-dimensional feature to obtain a three-dimensional spatial attention map; The three-dimensional spatial attention map is added to the comprehensive feature vector to obtain a spatial dependency feature.
8. The network security situation awareness method according to claim 6, It is characterized in that The channel attention module is used to learn the dependency of the comprehensive feature vector on the channel to obtain the channel dependency feature, which specifically includes: Reshaping the comprehensive feature vector into a two-dimensional feature to obtain a fourth two-dimensional feature; Transposing the fourth two-dimensional feature set and multiplying the result with the fourth two-dimensional feature, and then passing the result through a Softmax function to obtain a two-dimensional channel attention map; After transposing the two-dimensional channel attention map, perform matrix multiplication operation with the fourth two-dimensional feature, multiply it by the channel scale coefficient, and then reshape it into a three-dimensional feature to obtain a three-dimensional channel attention map; The three-dimensional channel attention map is added to the comprehensive feature vector to obtain a channel-dependent feature.
9. A computer device, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the network security situation awareness method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the network security situation awareness method described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Information processing method and device, equipment and storage medium
CN116915511A
Network anomaly detection method and device based on GMD imaging and improved ResNeXt
CN117197543A
Lightweight multi-modal medical image classification method for improving ResNeXt neural network
CN117274662A
Train coupler attitude estimation method based on dynamic snakelike convolution
CN118229778A
Cited By
Network security situation assessment method, system and equipment
CN119420527A
Network security situation awareness method based on deep neural network
CN119484065A
Network security situation awareness method based on deep neural network
CN119484065B
Network attack detection method and system based on multi-modal feature fusion
CN119696859A
A network attack detection method and system based on multi-modal feature fusion
CN119696859B
