Network intrusion detection and protection method based on machine learning

By acquiring and preprocessing historical data, a network intrusion detection and protection learning model is established, which solves the problem of poor universality of intrusion detection and protection in power grid network systems, improves detection accuracy and computer stability, and achieves effective detection of intrusion behavior. protection.

CN118784306APending Publication Date: 2024-10-15ELECTRIC POWER SCI RES INST OF STATE GRID XINJIANG ELECTRIC POWER CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410887759.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing technology lacks network intrusion detection and protection technical solutions suitable for power grid network systems. The model training is based on the NSL-KDD data set and has poor universality, making it difficult to effectively detect and protect intrusion behaviors in the power grid network.

Method used

By acquiring and preprocessing historical intrusion data and protection data, a network intrusion detection and protection learning model is established, and the intrusion occurrence time, objects and behaviors are used to define the intrusion training set and test set, and the model is preset and trained to realize the detection of network intrusion. and protection.

Benefits of technology

It improves the accuracy and efficiency of network intrusion detection, reduces the false alarm rate, provides intuitive feedback of interception information, improves computer operation stability, and enables data interception of malicious IP addresses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784306A_ABST
    Figure CN118784306A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of network security, and discloses a network intrusion detection and protection method based on machine learning. The method comprises the steps of obtaining historical intrusion data of a network, obtaining historical protection data of the network, training a network intrusion detection and protection learning model to obtain a network intrusion detection and protection model, and operating the network intrusion detection and protection model. According to the application, a data basis is provided for training the network intrusion detection and protection learning model by acquiring the historical intrusion data, and a data basis is provided for training the network intrusion detection and protection learning model by acquiring the historical protection data; technical support is provided for obtaining the network intrusion detection and protection model through the preset network intrusion detection and protection learning model, and finally detection and protection of network intrusion are realized through operating the network intrusion detection and protection model.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] The present application relates to the field of network security technology, and specifically to a network intrusion detection and protection method based on machine learning. Background Art

[0002] As the power grid architecture becomes increasingly complete, network information transmission between sub-grids becomes increasingly frequent, and with it come the inevitable emergence of network security issues.

[0003] Chinese patent number CN202210590554.6 discloses a network intrusion detection system based on machine learning. The present invention discloses a network intrusion detection system based on machine learning, which belongs to the field of intrusion detection technology, including an initial sample data module, a data acquisition module, a data preprocessing module, a data storage module, a machine learning module, an intrusion detection module, a feedback alarm module and a security management module; the present invention has excellent image recognition capabilities with the help of convolutional neural networks, and by converting intrusion detection problems into image detection problems, it is beneficial to improve the accuracy and detection rate of network intrusion behavior detection, while reducing the false alarm rate, and can more intuitively feed back interception information and network intrusion behavior ratios to staff, improve staff analysis efficiency, and at the same time automatically initiate data interception for malicious IP addresses, greatly improving computer operation stability. However, its model training is based on the NSL-KDD data set, and its universality is poor.

[0004] In summary, the prior art lacks a technical solution for network intrusion detection and protection that can be applied to power grid network systems. Summary of the invention

[0005] The purpose of this application is to provide a network intrusion detection and protection method based on machine learning to solve the technical problems raised in the above background technology.

[0006] To achieve the above objectives, this application discloses the following technical solutions:

[0007] The present application discloses a network intrusion detection and protection method based on machine learning, comprising:

[0008] S1: Obtain historical intrusion data of the network, the historical intrusion data including the intrusion occurrence time, intrusion object and intrusion behavior, and pre-process the historical intrusion data to obtain an intrusion training set and an intrusion test set;

[0009] S2: Acquire historical protection data of the network, the historical protection data including the protection occurrence time, protection object and protection behavior, and pre-process the historical protection data to obtain a protection training set and a protection test set;

[0010] S3: Preset a network intrusion detection and protection learning model, wherein the network intrusion detection and protection learning model is configured to complete training based on the protection training set and the protection test set to obtain a network intrusion detection and protection model;

[0011] S4: Run the network intrusion detection and protection model to detect and protect against network intrusion.

[0012] Preferably, the moment when the network encounters an intrusion is defined as the moment when the intrusion occurs; the link in the network that encounters the intrusion is defined as the intrusion object, and the link includes uploading, transmitting and downloading; and the event that occurs after the network encounters the intrusion is defined as the intrusion behavior.

[0013] Preferably, the preprocessing of the historical intrusion data specifically includes:

[0014] Performing intrusion data cleaning on the historical intrusion data, wherein the intrusion data cleaning comprises the following steps:

[0015] A1: Delete invalid intrusion data caused by network operation errors in the historical intrusion data;

[0016] A2: Delete invalid intrusion objects that have no impact on the normal operation of the network from the intrusion objects;

[0017] A3: Delete invalid intrusion behaviors that have no impact on the normal operation of the network.

[0018] Preferably, obtaining the intrusion training set and the intrusion test set specifically includes:

[0019] The historical intrusion data after intrusion data cleaning is randomly sampled, and the sampled data is defined as the intrusion training set, and the remaining sampled historical intrusion data after data cleaning is defined as the intrusion test set.

[0020] Preferably, the moment when the network starts to perform protection behavior after encountering an intrusion is defined as the protection occurrence moment, the link in the network targeted by the protection behavior is defined as the protection object, and the protection strategy and actual operation taken in the face of the intrusion are defined as the protection behavior.

[0021] Preferably, the preprocessing of the historical protection data specifically includes:

[0022] The historical protection data is cleaned, and the protection data cleaning includes the following steps:

[0023] B1: Deleting invalid protection data in the historical protection data caused by network operation errors;

[0024] B2: deleting invalid protection objects that have no effect on preventing intrusion among the protection objects;

[0025] B3: Delete the invalid protection behaviors that have no effect on preventing intrusion, and number the remaining protection behaviors;

[0026] Data matching is performed on the historical protection data after protection data cleaning, and the data matching configuration is as follows: the historical protection data after protection data cleaning corresponding to the protection occurrence time closest to the intrusion occurrence time is captured, and a one-to-one corresponding first relationship is established between the captured historical protection data and the historical intrusion data corresponding to the intrusion training set and the intrusion test set.

[0027] Preferably, obtaining the protection training set and the protection test set specifically includes:

[0028] The first relationship is randomly sampled, the sampled data is defined as the protection training set, and the remaining first relationship is defined as the protection test set.

[0029] Preferably, the preset network intrusion detection and protection learning model specifically includes:

[0030] The network intrusion detection and protection learning model is specifically:

[0031]

[0032] Among them, t1 is the time when the invasion occurs, t 2.i is the protection occurrence time of the protection action numbered i, Δt response.i is the response time of the protection action numbered i, t 3.i is the moment when the protection action numbered i completes the prevention of intrusion, Δt done.i is the completion time of the protection action numbered i, link=upload means the link is upload, link=download means the link is download, link=pass means the link is transmission, α2 is the weight parameter of the completion time of the protection action numbered i, α1 is the weight parameter of the response time of the protection action numbered i, PSI i is the protection speed index of the protection action numbered i, OUT = min (PRI i ) indicates that the network intrusion detection and protection learning model outputs the protection behavior with the smallest protection speed index among all protection behaviors.

[0033] Preferably, the network intrusion detection and protection learning model is configured to complete training based on the protection training set and the protection test set to obtain a network intrusion detection and protection model, specifically including:

[0034] C1: inputting the first relation of the protection training set as input into the network intrusion detection and protection learning model;

[0035] C2: The network intrusion detection and protection learning model calculates and outputs the protection behavior with the smallest protection speed index among various protection behaviors, and verifies the output result. If the verification passes, C1-C2 is directly executed. If the verification fails, the first relationship corresponding to the output result is marked and then C1-C2 is executed;

[0036] C3: After the first relationship after marking passes the verification of C1-C2, count the results and define the count result as the number of model updates. A threshold of the number of model updates is preset. When the number of model updates is less than or equal to the threshold, C1-C3 is executed, otherwise C4 is executed.

[0037] C4: Input the first relationship in the protection test set as an input into the trained network intrusion detection and protection learning model, calculate and output the trained network intrusion detection and protection model, and when the output passes the verification, it indicates that the calculation is successful. Calculate the accuracy of the trained network intrusion detection and protection model, preset a success rate threshold, and when the success rate is greater than or equal to the success rate threshold, use the network intrusion detection and protection learning model being tested as the network intrusion detection and protection model, otherwise execute steps C1-C4 until the success rate is greater than or equal to the success rate threshold.

[0038] Preferably, step S4 further comprises:

[0039] D1: acquiring real-time intrusion data, parsing the real-time intrusion data and obtaining the intrusion object of the real-time data, and matching a plurality of protection behaviors corresponding to the real-time intrusion object based on the first relationship;

[0040] D2: parsing the real-time intrusion data and obtaining the intrusion occurrence time of the real-time data, and inputting the intrusion occurrence time and the matched multiple protection behaviors as input quantities into the network intrusion detection and protection model;

[0041] D3: The network intrusion detection and protection model calculates and outputs the protection behavior with the smallest protection speed index among various protection behaviors, and uses the protection behavior to prevent the intrusion.

[0042] Beneficial effects: The network intrusion detection and protection method based on machine learning of the present application provides a data basis for training a network intrusion detection and protection learning model by acquiring historical intrusion data, provides a data basis for training a network intrusion detection and protection learning model by acquiring historical protection data, provides technical support for obtaining a network intrusion detection and protection model by presetting a network intrusion detection and protection learning model, and realizes detection and protection of network intrusions by running the network intrusion detection and protection model. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0044] Figure 1 A flowchart of a network intrusion detection and protection method based on machine learning provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The technical solutions in the embodiments of the present application are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0046] In this article, the term "comprising" is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "comprising..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0047] This embodiment discloses Figure 1 A network intrusion detection and protection method based on machine learning is shown, comprising:

[0048] S1: Obtain historical intrusion data of the network, which includes the time of intrusion, intrusion object and intrusion behavior, and pre-process the historical intrusion data to obtain intrusion training set and intrusion test set;

[0049] S2: Obtain historical protection data of the network, which includes the time when protection occurs, the protection object, and the protection behavior, and pre-process the historical protection data to obtain a protection training set and a protection test set;

[0050] S3: presetting a network intrusion detection and protection learning model, the network intrusion detection and protection learning model is configured to complete training based on a protection training set and a protection test set to obtain a network intrusion detection and protection model;

[0051] S4: Run the network intrusion detection and protection model, and detect and protect against network intrusions.

[0052] By obtaining historical intrusion data, a data basis is provided for training network intrusion detection and protection learning models. By obtaining historical protection data, a data basis is provided for training network intrusion detection and protection learning models. By presetting network intrusion detection and protection learning models, technical support is provided for obtaining network intrusion detection and protection models. By running network intrusion detection and protection models, network intrusion detection and protection are realized.

[0053] Specifically, the moment when the network encounters an intrusion is defined as the moment when the intrusion occurs; the link in the network that encounters the intrusion is defined as the intrusion object, which includes uploading, transmission and downloading; the event that occurs after the network encounters an intrusion is defined as the intrusion behavior.

[0054] By dividing the intrusion objects, the precise positioning of the protection objects is achieved.

[0055] Specifically, the historical intrusion data is preprocessed, including:

[0056] Perform intrusion data cleaning on historical intrusion data. Intrusion data cleaning includes the following steps:

[0057] A1: Delete invalid intrusion data caused by network operation errors in historical intrusion data;

[0058] A2: Delete invalid intrusion objects that have no impact on the normal operation of the network.

[0059] A3: Delete invalid intrusion behaviors that have no impact on the normal operation of the network.

[0060] By cleaning up the historical intrusion data, the purpose of streamlining the historical intrusion data is achieved, thereby reducing the amount of calculation and optimizing the model.

[0061] Specifically, the intrusion training set and the intrusion test set are obtained, including:

[0062] The historical intrusion data after intrusion data cleaning is randomly sampled, and the sampled data is defined as an intrusion training set, and the remaining historical intrusion data after data cleaning is defined as an intrusion test set.

[0063] Specifically, the moment when the network starts to take protective actions after encountering an intrusion is defined as the protection occurrence moment, the link in the network targeted by the protective action is defined as the protection object, and the protective strategy and actual operation taken in the face of the intrusion are defined as the protective action.

[0064] Specifically, the historical protection data is preprocessed, including:

[0065] Perform protection data cleaning on historical protection data. Protection data cleaning includes the following steps:

[0066] B1: Delete invalid protection data in historical protection data caused by network operation errors;

[0067] B2: Delete invalid protection objects that have no effect on preventing intrusion;

[0068] B3: Delete the invalid protection behaviors that have no effect on preventing intrusion, and number the remaining protection behaviors;

[0069] By cleaning the historical protection data, the purpose of streamlining the historical protection data is achieved, thereby reducing the amount of calculation and optimizing the model.

[0070] Data matching is performed on the historical protection data after protection data cleaning, and the data matching configuration is: capturing the historical protection data after protection data cleaning corresponding to the protection occurrence time closest to the intrusion occurrence time after the intrusion occurrence time, and establishing a one-to-one first relationship between the captured historical protection data and the historical intrusion data corresponding to the intrusion training set and the intrusion test set.

[0071] Specifically, the protection training set and the protection test set are obtained, including:

[0072] The first relation is randomly sampled, the sampled data is defined as a protection training set, and the remaining first relation is defined as a protection test set.

[0073] It should be noted that the first relationship includes both historical protection data and historical protection data.

[0074] Specifically, the preset network intrusion detection and protection learning model includes:

[0075] Network intrusion detection and protection learning model, specifically:

[0076]

[0077] Among them, t1 is the time when the invasion occurs, t 2.i is the protection occurrence time of the protection action numbered i, Δt response.i is the response time of the protection action numbered i, t 3.i is the moment when the protection action numbered i completes the prevention of intrusion, Δt done.i is the completion time of the protection action numbered i, link=upload means the link is upload, link=download means the link is download, link=pass means the link is transmission, α2 is the weight parameter of the completion time of the protection action numbered i, α1 is the weight parameter of the response time of the protection action numbered i, PSI i is the protection speed index of the protection action numbered i, OUT = min (PRI i ) indicates that the network intrusion detection and protection learning model outputs the protection behavior with the smallest protection speed index among all protection behaviors.

[0078] Specifically, the network intrusion detection and protection learning model is configured to complete training based on the protection training set and the protection test set to obtain the network intrusion detection and protection model, specifically including:

[0079] C1: The first relation of the protection training set is used as input into the network intrusion detection and protection learning model;

[0080] C2: The network intrusion detection and protection learning model calculates and outputs the protection behavior with the smallest protection speed index among various protection behaviors, and verifies the output result. If the verification passes, C1-C2 is directly executed. If the verification fails, the first relationship corresponding to the output result is marked and then C1-C2 is executed;

[0081] It should be noted that the method for verifying the output result in this embodiment may be, but is not limited to, judging whether the output result of the network intrusion detection and protection learning model is passed based on historical real records.

[0082] C3: After the first relationship after marking passes the verification of C1-C2, count the results and define the count result as the number of model updates. A threshold of the number of model updates is preset. When the number of model updates is less than or equal to the threshold, C1-C3 is executed, otherwise C4 is executed.

[0083] C4: The first relationship in the protection test set is input as an input to the trained network intrusion detection and protection learning model. The trained network intrusion detection and protection model is calculated and output. When the output passes the verification, it means that the calculation is successful. The accuracy of the trained network intrusion detection and protection model is calculated, and a success rate threshold is preset. When the success rate is greater than or equal to the success rate threshold, the network intrusion detection and protection learning model being tested is used as the network intrusion detection and protection model. Otherwise, steps C1-C4 are executed until the success rate is greater than or equal to the success rate threshold.

[0084] Specifically, step S4 also includes:

[0085] D1: Acquire real-time intrusion data, parse the real-time intrusion data and obtain the intrusion object of the real-time data, and match multiple protection behaviors corresponding to the real-time intrusion object based on the first relationship;

[0086] D2: Analyze the real-time intrusion data and obtain the intrusion occurrence time of the real-time data, and input the intrusion occurrence time and the matched multiple protection behaviors into the network intrusion detection and protection model as input;

[0087] D3: The network intrusion detection and protection model calculates and outputs the protection behavior with the smallest protection speed index among various protection behaviors, and uses this protection behavior to prevent the intrusion.

[0088] In summary, the network intrusion detection and protection method based on machine learning in this embodiment provides a data basis for training the network intrusion detection and protection learning model by acquiring historical intrusion data, provides a data basis for training the network intrusion detection and protection learning model by acquiring historical protection data, provides technical support for obtaining the network intrusion detection and protection model by presetting the network intrusion detection and protection learning model, and realizes detection and protection of network intrusion by running the network intrusion detection and protection model.

[0089] In the embodiments provided in the present application, it should be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code or any appropriate combination thereof. For hardware implementation, the processor can be implemented in one or more of the following units: application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), processor, controller, microcontroller, microprocessor, other electronic units designed to implement the functions described herein or their combination. For software implementation, part or all of the flow of the embodiment can be completed by instructing the relevant hardware through a computer program. When implemented, the above program can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein the communication medium includes any medium that is convenient for transmitting a computer program from one place to another. The storage medium can be any available medium that a computer can access. The computer-readable storage medium can include but is not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer.

[0090] Finally, it should be noted that the above is only a preferred embodiment of the present application and is not intended to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A network intrusion detection and protection method based on machine learning, characterized in that: include: S1: Obtain historical intrusion data of the network, the historical intrusion data including the intrusion occurrence time, intrusion object and intrusion behavior, and pre-process the historical intrusion data to obtain an intrusion training set and an intrusion test set; S2: Obtain historical protection data of the network, the historical protection data including the protection occurrence time, protection object and protection behavior, and pre-process the historical protection data to obtain a protection training set and a protection test set; S3: Preset a network intrusion detection and protection learning model, wherein the network intrusion detection and protection learning model is configured to complete training based on the protection training set and the protection test set to obtain a network intrusion detection and protection model; S4: Run the network intrusion detection and protection model to detect and protect against network intrusion.

2. The network intrusion detection and protection method based on machine learning according to claim 1 is characterized in that: The moment when the network encounters an intrusion is defined as the moment when the intrusion occurs; the link in the network that encounters the intrusion is defined as the intrusion object, and the link includes uploading, transmitting and downloading; the event that occurs after the network encounters the intrusion is defined as the intrusion behavior.

3. The network intrusion detection and protection method based on machine learning according to claim 2 is characterized in that: The preprocessing of the historical intrusion data specifically includes: Performing intrusion data cleaning on the historical intrusion data, wherein the intrusion data cleaning comprises the following steps: A1: Delete invalid intrusion data caused by network operation errors in the historical intrusion data; A2: Delete invalid intrusion objects that have no impact on the normal operation of the network from the intrusion objects; A3: Delete invalid intrusion behaviors that have no impact on the normal operation of the network.

4. The network intrusion detection and protection method based on machine learning according to claim 3 is characterized in that: The intrusion training set and the intrusion test set are obtained, specifically including: The historical intrusion data after intrusion data cleaning is randomly sampled, and the sampled data is defined as the intrusion training set, and the remaining sampled historical intrusion data after data cleaning is defined as the intrusion test set.

5. The network intrusion detection and protection method based on machine learning according to claim 4 is characterized in that: The moment when the network starts to take protective actions after encountering an intrusion is defined as the protection occurrence moment, the link in the network targeted by the protective action is defined as the protection object, and the protective strategy and actual operation taken in the face of the intrusion are defined as the protective action.

6. The network intrusion detection and protection method based on machine learning according to claim 5 is characterized in that: The preprocessing of the historical protection data specifically includes: The historical protection data is cleaned, and the protection data cleaning includes the following steps: B1: Deleting invalid protection data in the historical protection data caused by network operation errors; B2: deleting invalid protection objects that have no effect on preventing intrusion among the protection objects; B3: Delete the invalid protection behaviors that have no effect on preventing intrusion, and number the remaining protection behaviors; Data matching is performed on the historical protection data after protection data cleaning, and the data matching configuration is as follows: the historical protection data after protection data cleaning corresponding to the protection occurrence time closest to the intrusion occurrence time is captured, and a one-to-one corresponding first relationship is established between the captured historical protection data and the historical intrusion data corresponding to the intrusion training set and the intrusion test set.

7. The network intrusion detection and protection method based on machine learning according to claim 6 is characterized in that: The protection training set and the protection test set obtained specifically include: The first relationship is randomly sampled, the sampled data is defined as the protection training set, and the remaining first relationship is defined as the protection test set.

8. The network intrusion detection and protection method based on machine learning according to claim 7 is characterized in that: The preset network intrusion detection and protection learning model specifically includes: The network intrusion detection and protection learning model is specifically: Among them, t1 is the time when the invasion occurs, t 2.i is the protection occurrence time of the protection action numbered i, Δt response.i is the response time of the protection action numbered i, t 3.i is the moment when the protection action numbered i completes the prevention of intrusion, Δt done.i is the completion time of the protection action numbered i, link=upload means the link is upload, link=download means the link is download, link=pass means the link is transmission, α2 is the weight parameter of the completion time of the protection action numbered i, α1 is the weight parameter of the response time of the protection action numbered i, PSI i is the protection speed index of the protection action numbered i, OUT = min (PRI i ) indicates that the network intrusion detection and protection learning model outputs the protection behavior with the smallest protection speed index among all protection behaviors.

9. The network intrusion detection and protection method based on machine learning according to claim 8 is characterized in that: The network intrusion detection and protection learning model is configured to complete training based on the protection training set and the protection test set to obtain a network intrusion detection and protection model, specifically including: C1: inputting the first relation of the protection training set as input into the network intrusion detection and protection learning model; C2: The network intrusion detection and protection learning model calculates and outputs the protection behavior with the smallest protection speed index among various protection behaviors, and verifies the output result. If the verification passes, C1-C2 is directly executed. If the verification fails, the first relationship corresponding to the output result is marked and then C1-C2 is executed; C3: After the first relationship after marking passes the verification of C1-C2, count the results and define the count result as the number of model updates. A threshold of the number of model updates is preset. When the number of model updates is less than or equal to the threshold, C1-C3 is executed, otherwise C4 is executed. C4: Input the first relationship in the protection test set as an input into the trained network intrusion detection and protection learning model, calculate and output the trained network intrusion detection and protection model, and when the output passes the verification, it indicates that the calculation is successful. Calculate the accuracy of the trained network intrusion detection and protection model, preset a success rate threshold, and when the success rate is greater than or equal to the success rate threshold, use the network intrusion detection and protection learning model being tested as the network intrusion detection and protection model, otherwise execute steps C1-C4 until the success rate is greater than or equal to the success rate threshold.

10. The network intrusion detection and protection method based on machine learning according to claim 9 is characterized in that: Step S4 also includes: D1: acquiring real-time intrusion data, parsing the real-time intrusion data and obtaining the intrusion object of the real-time data, and matching a plurality of protection behaviors corresponding to the real-time intrusion object based on the first relationship; D2: parsing the real-time intrusion data and obtaining the intrusion occurrence time of the real-time data, and inputting the intrusion occurrence time and the matched multiple protection behaviors as input quantities into the network intrusion detection and protection model; D3: The network intrusion detection and protection model calculates and outputs the protection behavior with the smallest protection speed index among various protection behaviors, and uses the protection behavior to prevent the intrusion.