A network traffic intrusion detection and analysis method, system, medium and device
By combining the network traffic intrusion detection and analysis method of Suricata, Filebeat, Logstash and secGPT large models, the problem that existing technology cannot identify complex network traffic risks is solved, and more efficient and accurate network security detection is achieved, which is suitable for IPv6 network environments.
Patent Information
- Application Number
- CN202411124283.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-08-16
Smart Images

Figure CN118659925B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security, and in particular to a network flow intrusion detection and analysis method, system, medium and equipment. Background Art
[0002] As the use of IPv6 increases, the number and complexity of vulnerabilities detected in many network security systems are also increasing. At present, both individuals and enterprises have higher and higher requirements for their data security, network security, and information security. When faced with some complex network traffic analysis and processing situations, the existing network traffic intrusion detection and analysis methods cannot analyze traffic with potential risks or hidden risks, and cannot provide users with relatively safe protection. Summary of the invention
[0003] To this end, the technical problem to be solved by the present invention is to provide a network traffic intrusion detection and analysis method, system, medium and equipment. The present invention aims to solve some complex network traffic analysis and processing situations. For example, when capturing network traffic packets for processing and parsing into a database, it may be possible to determine through analysis that a traffic line does not seem to have any risks but may actually have risks.
[0004] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0005] A network traffic intrusion detection and analysis method comprises the following steps:
[0006] S1) Collect network traffic;
[0007] S2) performing protocol analysis on the network traffic collected in step S1) and selecting a corresponding analyzer according to the analysis result to analyze the network traffic collected in step S1) and detecting and analyzing a part of the network traffic collected in step S1) by Suricata;
[0008] S3) Using Filebeat to collect logs of the network traffic analyzed and processed in step S2);
[0009] S4) using Logstash to collect, enrich and convert the logs collected in step S3), wherein the converted data is in JSON format;
[0010] S5) Analyze the data in JSON format obtained in step S4) using the trained n-1 generation secGPT large model and output the analysis results. At the same time, train the n-1 generation secGPT large model using the JSON format data obtained in step S4) to obtain the n-1 generation secGPT large model and use the n-1 generation secGPT large model for the next network traffic intrusion detection, where n is a natural number greater than or equal to 1; when training the n-1 generation secGPT large model, use the logits maximization loss to normalize the normalized exponential function softmax of the n-1 generation secGPT large model, where logits is the unprocessed score of the model output layer, and the logits maximization loss calculation formula and the normalized exponential function softmax calculation formula are respectively:
[0011]
[0012] Among them, e is a natural constant; z is the maximum logits value, that is, the largest value in the logits vector output by the secGPT large model; xi is the i-th type input x.
[0013] In the above-mentioned network traffic intrusion detection and analysis method, in step S5), both the n-1th generation secGPT large model and the n-th generation secGPT large model are equipped with a human feedback reinforcement selector; when training the n-1th generation secGPT large model, the training of the n-1th generation secGPT large model is adjusted by selecting the output result of the human feedback reinforcement selector.
[0014] The above network traffic intrusion detection and analysis method, when training the n-1th generation secGPT large model, performs hyperparameter settings, pre-training settings, and Sample Efficient Fine-Tuning training configuration on the n-1th generation secGPT large model according to the situation.
[0015] In the above network traffic intrusion detection and analysis method, in step S2), when performing protocol analysis on the network traffic collected in step S1) and selecting a corresponding analyzer based on the analysis result, Zeek uses payload to find the correct analyzer based on a set of features that match the protocol content.
[0016] The above network traffic intrusion detection and analysis method further includes the following steps:
[0017] S6) Visualizing the analysis results obtained in step S5) using a visualization tool.
[0018] The above network traffic intrusion detection and analysis method uses matplotlib or other visualization BI tools as visualization tools.
[0019] A system for performing network traffic intrusion analysis using the above-mentioned network traffic intrusion detection and analysis method comprises:
[0020] Network traffic collection module, used to collect network traffic;
[0021] The protocol analysis module is used to analyze the protocols used in network traffic;
[0022] Suricata module, used to detect and analyze network traffic;
[0023] Filebeat module, used to collect logs of the processing results of the protocol analysis module and Suricata module;
[0024] Logstash module, which is used to collect, enrich, and transform the data in the log files collected by the Filebeat module;
[0025] Elasticsearch module, used to convert the data processed by the Logstash module into text data;
[0026] secGPT large model module, used to detect and analyze the data processed by the Elasticsearch module and output the analysis results;
[0027] The network traffic collection module is communicated with the protocol analysis module and the Suricata module respectively, the protocol analysis module and the Suricata module are communicated with the Filebeat module respectively, the Filebeat module is communicated with the Elasticsearch module, and the ELasticsearch module is communicated with the secGPT large model module.
[0028] The above system also includes a visualization module that is communicatively connected to the secGPT large model module.
[0029] A computer-readable storage medium stores a computer program, which implements the above-mentioned network traffic intrusion detection and analysis method when executed by a processor.
[0030] A computer device includes a readable storage medium, a processor, and a computer program stored in the readable storage medium and executable on the processor, wherein the computer program implements the above-mentioned network traffic intrusion detection and analysis method when executed by the processor.
[0031] The technical solution of the present invention achieves the following beneficial technical effects:
[0032] 1. The use of large model technology can train more accurate network security models, such as intrusion detection, malware detection, etc., thereby improving the accuracy and efficiency of IPv6 network security protection.
[0033] 2. The vocabulary size of Baichuan-13b, the base of secGPT, is also 125,696, which better balances computational efficiency and model performance.
[0034] 3. Network security protection is more adapted to actual scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a working principle diagram of the network traffic intrusion detection and analysis system in the present invention;
[0036] Figure 2 This is a flow chart of the network traffic intrusion detection analysis in the present invention;
[0037] Figure 3 A schematic diagram of a computer device capable of performing network traffic intrusion detection and analysis. DETAILED DESCRIPTION
[0038] The present invention is further described below with reference to examples.
[0039] like Figure 1 As shown, the network traffic intrusion detection and analysis system in the present invention includes a network traffic collection module, a protocol analysis module, a Suricata module, a Filebeat module, a Logstash module, an Elasticsearch module, a secGPT large model module and a visualization module. The network traffic collection module is communicated with the protocol analysis module and the Suricata module respectively, the protocol analysis module and the Suricata module are communicated with the Filebeat module respectively, the Filebeat module is communicated with the Elasticsearch module, the ELasticsearch module is communicated with the secGPT large model module, and the secGPT large model module is communicated with the visualization module.
[0040] In the present invention, the network traffic collection module is used to collect network traffic. In this embodiment, TCPDump is used to capture network traffic and obtain the IPv6 address, port number, data packet protocol, TCP sequence number, TCP window size, etc. of the network traffic source; the protocol analysis module is used to analyze the protocol used in the network traffic independently of the port; the Suricata module is used to detect and analyze the network traffic; the Filebeat module is used to collect logs of the protocol analysis module and the processing results of the Suricata module; the Logstash module is used to collect, enrich and convert the data in the log file collected by the Filebeat module; the Elasticsearch module is used to convert the data processed by the Logstash module into text data; the secGPT large model module is used to detect and analyze the data processed by the Elasticsearch module and output the analysis results. The architecture of the secGPT large model is Baichuan-13b, and Baichuan-13b is based on the transformer architecture, so some transformer formulas are also applicable in Baichuan-13b; the visualization tool in the visualization module is matplotlib or other visualization BI tools.
[0041] Before the protocol analysis module performs protocol analysis, Zeek can find the correct analyzer through a set of features that match the protocol content through the payload. When the features of the protocol in the network traffic match the features of a certain protocol pre-stored in the protocol analysis module, the analyzer corresponding to the pre-stored protocol is selected. Otherwise, the corresponding analyzer can be closed and the correct analyzer can be selected. At the same time, multiple analyzers can be used to analyze the protocol of network traffic. Among them, the payload represents the actual data part of the data packet in the Zeek workflow, providing support for subsequent tasks such as detecting malicious traffic, identifying protocol types, and extracting file content.
[0042] Suricata is a TCP / IP protocol stack parsing and security data analysis engine. It can perform real-time intrusion detection (IDS), inline intrusion prevention (IPS), network security monitoring (NSM) and offline PCAP processing. In scenarios using IPv6, Suricata uses a powerful and extensive rule and signature language to inspect network traffic. At the same time, Suricata can also upgrade alarm rules and configure the suricata.yaml file to change the required configuration items and parameters.
[0043] like Figure 2As shown, when the network traffic intrusion detection and analysis system of the present invention detects and analyzes the intrusion situation in the network traffic, the detection and analysis of the network traffic intrusion is realized through the following steps:
[0044] S1) Collect network traffic;
[0045] S2) Performing protocol analysis on the network traffic collected in step S1) and selecting a corresponding analyzer according to the analysis result. Analyzing the network traffic collected in step S1), and detecting and analyzing a part of the network traffic collected in step S1) by Suricata, wherein the preset Suricata rules are used to make Suricata not detect files.rules and app-layer-events.rules in this part of the network traffic; wherein, when performing protocol analysis on the network traffic collected in step S1) and selecting a corresponding analyzer according to the analysis result, zeek uses payload to find the correct analyzer according to a set of features matching the protocol content;
[0046] S3) Using Filebeat to collect logs of the network traffic analyzed and processed in step S2);
[0047] S4) using Logstash to collect, enrich and convert the logs collected in step S3), wherein the Grok filter in Logstash is used to parse the enriched logs and convert the .log files into JSON format files;
[0048] S5) Analyze the data in JSON format obtained in step S4) using the trained n-1 generation secGPT large model and output the analysis results. At the same time, train the n-1 generation secGPT large model using the JSON format data obtained in step S4) to obtain the n-1 generation secGPT large model and use the n-1 generation secGPT large model for the next network traffic intrusion detection, where n is a natural number greater than or equal to 1; when training the n-1 generation secGPT large model, use the logits maximization loss to normalize the normalized exponential function softmax of the n-1 generation secGPT large model, where logits is the unprocessed score of the model output layer, and the logits maximization loss calculation formula and the normalized exponential function softmax calculation formula are respectively:
[0049]
[0050] Among them, e is a natural constant; z is the maximum logits value, that is, the largest value in the logits vector output by the secGPT large model; xi is the i-th type input x;
[0051] S6) Visualizing the analysis results obtained in step S5) using a visualization tool.
[0052] In step S5), both the n-1 generation secGPT large model and the n-1 generation secGPT large model have built-in human feedback reinforcement selectors; when training the n-1 generation secGPT large model, the training of the n-1 generation secGPT large model is adjusted by selecting the output result of the human feedback reinforcement selector. And when training the n-1 generation secGPT large model, the hyperparameter setting, pre-training setting and Sample EfficientFine-Tuning training configuration of the n-1 generation secGPT large model are performed according to the situation.
[0053] When training the first generation secGPT model, the secGPT model is trained with local IPv6 simulated attacks and the data set that comes with the secGPT model. Then, when detecting and analyzing actual network traffic intrusions, the secGPT model is trained with the actual analysis results. Specifically, the text is divided into tokens using the tokenizer.py in the secGPT model. Then, according to actual needs, the data set consisting of the actual analysis results is combined with the data set that comes with the secGPT model. The secGPT model is trained with the combined data set. The hyperparameters, pre-training configuration, and Sample EfficientFine-Tuning (SFT) training configuration of the secGPT model are set according to actual conditions. The parameters are modified in the train.py file in the secGPT model.
[0054] When using the Reinforcement Learning with Human Feedback (RLHF) selector to adjust the secGPT large model, the RLHF selector will output three different answers each time. After visualizing the answers, technicians can choose the best answer according to their needs, thereby providing valuable data for the subsequent RLHF selector to fine-tune the secGPT large model, which will help the secGPT model further improve the quality of its output, help ensure that the secGPT model output meets user expectations, and play a greater role in areas such as network security.
[0055] The reason for using the logits maximization loss to normalize the normalized exponential function softmax of the n-1th generation secGPT large model is that the logits (referring to the unprocessed score of the model output layer) in the large language model will be very large. If a logits value is too large, the probability of the softmax function will be close to 1. After normalizing the normalized exponential function softmax of the n-1th generation secGPT large model by using the logits maximization loss, softmax will amplify the probability of categories with higher original scores when processing xi, so it can better distinguish the possibilities of different categories, and it can also make the secGPT large model more stable during training.
[0056] The reason for using Filebeat to collect logs of processed network traffic is that the .log files collected and processed by suricata and zeek are complex and disorganized. However, since the amount of data that Filebeat can transport is small, logstash is used to collect, enrich, and convert the data in Filebeat. Through simple configuration, various external data can be collected and saved in the index, which can improve the efficiency of data collection.
[0057] Based on the above-mentioned device automated operation and maintenance password management method, accordingly, this example also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, it implements the following steps: collecting network traffic, selecting an analyzer according to the protocol in the network traffic, and using the analyzer and Suricata to detect and analyze the network traffic, and then using Filebeat to collect logs of the analyzed network traffic, and then using Logstash to collect, enrich and convert the collected logs, and then using Elasticsearch to convert the processed data into text data, and then using the trained n-1th generation secGPT large model to detect and analyze the aforementioned text data, and visualize the analysis results, and at the same time use the aforementioned text data to train the n-1th generation secGPT large model.
[0058] like Figure 3As shown, based on the above-mentioned device automated operation and maintenance password management method and computer-readable storage medium, in this embodiment, a computer device is also provided, which includes a readable storage medium, a processor, and a computer program stored on the readable storage medium and executable on the processor, wherein the readable storage medium and the processor are both arranged on a bus, and the processor implements the following steps when executing the computer program: collecting network traffic, selecting an analyzer according to the protocol in the network traffic, and using the analyzer and Suricata to detect and analyze the network traffic, and then using Filebeat to collect logs of the analyzed network traffic, and then using Logstash to collect, enrich and convert the collected logs, and then using Elasticsearch to convert the processed data into text data, and then using the trained n-1th generation secGPT large model to detect and analyze the aforementioned text data, and visualize the analysis results, and at the same time use the aforementioned text data to train the n-1th generation secGPT large model.
[0059] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the claims of this patent application.
Claims
1. A network traffic intrusion detection and analysis method, characterized in that: The steps include: S1) Collect network traffic; S2) Performing protocol analysis on the network traffic collected in step S1) and selecting a corresponding analyzer according to the analysis results. The network traffic collected in step S1) is analyzed, and a part of the network traffic collected in step S1) is detected and analyzed by Suricata. When performing protocol analysis on the network traffic collected in step S1) and selecting a corresponding analyzer according to the analysis results, Zeek uses payload to find the correct analyzer according to a set of features that match the protocol content. S3) Using Filebeat to collect logs of the network traffic analyzed and processed in step S2); S4) using Logstash to collect, enrich and convert the logs collected in step S3), wherein the converted data is in JSON format; S5) Analyze the data in JSON format obtained in step S4) using the trained n-1 generation secGPT large model and output the analysis results, and at the same time, train the n-1 generation secGPT large model using the data in JSON format obtained in step S4) to obtain the n-1 generation secGPT large model and use the n-1 generation secGPT large model for the next network traffic intrusion detection, wherein n is a natural number greater than or equal to 1; both the n-1 generation secGPT large model and the n-generation secGPT large model have built-in human feedback reinforcement selectors; when training the n-1 generation secGPT large model, adjust the training of the n-1 generation secGPT large model by selecting the output result of the human feedback reinforcement selector; when training the n-1 generation secGPT large model, set hyperparameters, pre-training settings and Sample for the n-1 generation secGPT large model according to the situation EfficientFine-Tuning training configuration; when training the n-1th generation secGPT large model, the normalized exponential function softmax of the n-1th generation secGPT large model is normalized using the logits maximization loss, where logits is the unprocessed score of the model output layer, and the logits maximization loss calculation formula and the normalized exponential function softmax calculation formula are: Among them, e is a natural constant; z is the maximum logits value, that is, the largest value in the logits vector output by the secGPT large model; xi is the i-th type input x.
2. The network traffic intrusion detection and analysis method according to claim 1, characterized in that: The following steps are also included: S6) Visualizing the analysis results obtained in step S5) using a visualization tool.
3. The network traffic intrusion detection and analysis method according to claim 2 is characterized in that: The visualization tool is matplotlib or other visualization BI tools.
4. A system for performing network traffic intrusion analysis using the network traffic intrusion detection and analysis method according to claim 1, characterized in that: include: Network traffic collection module, used to collect network traffic; The protocol analysis module is used to analyze the protocols used in network traffic; Suricata module, used to detect and analyze network traffic; Filebeat module, used to collect logs of the processing results of the protocol analysis module and Suricata module; Logstash module, used to collect, enrich and transform the data in the log files collected by the Filebeat module; Elasticsearch module, used to convert the data processed by the Logstash module into text data; secGPT large model module, used to detect and analyze the data processed by the Elasticsearch module and output the analysis results; The network traffic collection module is communicated with the protocol analysis module and the Suricata module respectively, the protocol analysis module and the Suricata module are communicated with the Filebeat module respectively, the Filebeat module is communicated with the Elasticsearch module, and the ELasticsearch module is communicated with the secGPT large model module.
5. The system according to claim 4, characterized in that It also includes a visualization module that is communicatively connected to the secGPT large model module.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the network traffic intrusion detection and analysis method described in any one of claims 1 to 3 is implemented.
7. A computer device comprising a readable storage medium, a processor, and a computer program stored on the readable storage medium and executable on the processor, characterized in that: When the computer program is executed by a processor, the network traffic intrusion detection and analysis method described in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Power terminal equipment intrusion detection method
CN113079150A
Network intrusion protection system and method based on data identification
CN116614313A
