Automatic penetration testing method based on generative model and dynamic partition

By adopting automatic penetration testing methods based on generative models and dynamic partitioning in the power Internet of Things system, the problems of low efficiency in detecting security vulnerabilities and difficulty in adapting to large-scale scenarios in the prior art are solved, and efficient and accurate security vulnerability detection is achieved.

CN119538261APending Publication Date: 2025-02-28STATE GRID LIAONING SHENYANG ELECTRIC POWER SUPPLY COMPANY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411598296.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently and accurately detect security vulnerabilities caused by complex structures and large-scale in power IoT systems, and traditional manual testing relies on professional knowledge and experience and is inefficient; methods based on reinforcement learning have problems of action space explosion and learning reward sparseness in large-scale scenarios.

Method used

Automatic penetration testing methods based on generative models and dynamic partitioning are adopted, comprehensive security data is collected through generative models, combined with the reward mechanism of expert experience and knowledge, and structured models are generated using formal language as the knowledge base for penetration testing, and the target object scale is adjusted through dynamic partitioning to reduce the problem of action space explosion.

Benefits of technology

It improves the efficiency and accuracy of penetration testing, reduces the dependence on testers' professional knowledge and experience, adapts to large-scale scenarios, avoids the problem of learning reward sparsity, and achieves more efficient security vulnerability detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538261A_ABST
    Figure CN119538261A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of safety testing of an electric power internet of things system, and particularly relates to an automatic penetration testing method based on a generative model and dynamic partition, which comprises the following steps: identifying assets of a target system by using a scanning tool; searching potential vulnerabilities and penetration tools through a generative model based on the identified assets of the target system; establishing a test script of the penetration tool; establishing a penetration test structured model according to the potential vulnerabilities, the penetration tool and the test script; evaluating the number of nodes covered by the penetration test structured model and partitioning the network topology of the target system; performing vulnerability scanning and scoring on each partition; establishing a new partition by taking the equipment with the highest score as a starting point; a penetration test is carried out in the new partition, and nodes which can be penetrated are found; the automatic penetration test method provided by the invention aims to solve the problem of security vulnerability detection caused by a complex structure and a huge scale of an electric power Internet of Things system, and improves the efficiency and accuracy of penetration test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of security testing of electric power Internet of Things systems, and in particular relates to an automatic penetration testing method based on a generative model and dynamic partitioning. Background Art

[0002] With the rapid development of the power Internet of Things, the complexity and scale of its systems are increasing, and security issues are becoming increasingly prominent. In the field of penetration testing, existing technologies are mainly divided into manual penetration testing methods and reinforcement learning-based penetration testing methods.

[0003] The manual penetration testing method requires professional technicians to select the test tool set based on their experience and continuously try the target object. This method has many disadvantages, such as being time-consuming and inefficient; it requires extremely high professional knowledge and experience of the tester, and it completely relies on the tester's experience, resulting in possible limitations in the test results.

[0004] Although penetration testing methods based on reinforcement learning use artificial intelligence models to replace manual attempts, they also face some problems. For example, the target object cannot be too large, otherwise it is easy to cause the action space explosion problem and is not suitable for large-scale scenarios; and in practice there is a problem of sparse learning rewards, that is, many times no reward is obtained after the action is executed, which affects the learning effect.

[0005] In actual applications, for example, in a small program of a power system, it is necessary to manually capture packets and modify data multiple times to discover a structured query language SQL injection method. This testing method, which is highly dependent on expert experience and time-consuming and laborious, is difficult to meet the needs of penetration testing of the emerging vulnerabilities in the rapid development of the power Internet of Things. In order to avoid security risks such as data leakage and system hacking attacks brought by the power Internet of Things, a more efficient and accurate penetration testing method is urgently needed. Summary of the invention

[0006] The present invention proposes an automatic penetration testing method based on a generative model and dynamic partitioning, which aims to solve the problem of security vulnerability detection brought about by the complex structure and large scale of the power Internet of Things system and improve the efficiency and accuracy of penetration testing.

[0007] Aiming at the deficiencies of the prior art, the present invention proposes an automatic penetration testing method based on generative model and dynamic partitioning, aiming to solve the following two key problems:

[0008] (I) An improved generative model is proposed, which collects comprehensive security information, combines the reward mechanism of expert experience knowledge, and uses formal language to generate structured models as the knowledge base of penetration testing. This model aims to solve the problem that traditional manual testing methods rely on the professional knowledge and experience of testers.

[0009] (ii) A dynamic partitioning approach can be used to dynamically adjust the size of the target object, effectively reducing the problem of action space explosion caused by the large size of the target object, and improving the feasibility and efficiency of the test.

[0010] To achieve the above object, the present invention adopts the following specific technical scheme: an automatic penetration testing method based on a generative model and dynamic partitioning, comprising:

[0011] Use scanning tools to identify the assets of the target system;

[0012] Based on the identified target system assets, potential vulnerabilities and penetration tools are collected through generative models;

[0013] Create test scripts for penetration tools;

[0014] Establish a penetration test structured model based on potential vulnerabilities, penetration tools, and test scripts;

[0015] Evaluate the number of nodes covered by the penetration test structured model and partition the network topology of the target system;

[0016] Scan and score each partition for vulnerabilities;

[0017] Create a new partition using the highest-scoring device as the starting point;

[0018] Conduct penetration testing in the new partition to find nodes that can be penetrated;

[0019] Repeat the partitioning and penetration testing steps until the penetration testing objectives are achieved.

[0020] Furthermore, the identification of the assets of the target system using the scanning tool at least includes: hardware information, operating system, version number, system components, communication protocols and service ports.

[0021] Furthermore, the sources of potential vulnerabilities and penetration tools collected through the generative model include at least: Common Vulnerabilities and Exposures (CVE), the U.S. National Computer Vulnerability Database (NVD), the China National Information Security Vulnerability Database (CNNVD), penetration tools, security books and papers.

[0022] Furthermore, the penetration test structured model established according to potential vulnerabilities, penetration tools and test scripts is expressed by the formula:

[0023] Id l =<(v1|T,S),(v2|T,S),...,(v M |T,S)> (1)

[0024] Where Idl represents the assets of the target system, l=1,2,...,N; V represents the potential vulnerability, V={v1,v2,...,v M},v i ∈V; T and S represent the available penetration tools and test scripts respectively.

[0025] Furthermore, after establishing the penetration test structured model, a reward learning mechanism is established based on the matching of potential vulnerabilities and penetration tools and the execution efficiency of penetration tools; the reward learning mechanism specifically includes: l A collection of vulnerabilities and tools in i ,T j ), using the generative model to automatically generate a feature vector Z that describes the vulnerability characteristics v , the eigenvector Z v At least including vulnerability type, risk level, affected components, difficulty of exploitation, detection frequency, patch status, exposure time and potential impact; then establish a feature vector Z describing the penetration tool based on expert experience T , the eigenvector Z T At least including supported vulnerability types, detection accuracy, component detection capabilities, operation complexity, patch management, response time and history; and using the unique hot encoding technology to convert each feature into a numerical vector; then using the cosine similarity function to calculate the similarity A of the feature vector v,T ,

[0026]

[0027] If A v,T >0 means that the penetration tool T can be used to exploit the potential vulnerability v, otherwise it is considered that it cannot be used; in addition, S T Represents the execution efficiency of penetration tool T; the reward mechanism function is established by integrating two factors:

[0028] Qv,T=α1Av,T+α2ST (3)

[0029] Among them, α1 and α2 represent weight factors;

[0030] Feed the reward learning mechanism back to the generative model for optimization training until all vulnerabilities and tool sets (v i ,T j ) all satisfy A v,T >0.

[0031] Furthermore, the step of evaluating the number of nodes covered by the penetration test structured model and partitioning the network topology of the target system specifically includes: evaluating the number of nodes that the penetration test structured model can cover under the constraints. According to the evaluation results, the network topology of the target system is partitioned, and the number of nodes in each area does not exceed the number of nodes obtained by the evaluation results.

[0032] Furthermore, the vulnerability scanning and scoring of each partition specifically includes: performing vulnerability scanning on each area in a distributed manner to obtain scanning results, scoring the scanning results of each area according to the security vulnerability scoring system CVSS, and calculating the device corresponding to the highest score.

[0033] Furthermore, the establishment of a new partition with the highest-scoring device as the starting point specifically includes: starting from the device corresponding to the highest score, establishing a partition with a number of nodes not exceeding the number of nodes according to the direction of the penetration test path determined by the overall goal. A new partition is created; and within the partition, the vulnerability scores of all nodes are marked in descending order.

[0034] Furthermore, the penetration test is carried out in the new partition to find the next node that can be penetrated specifically including: adding a long short-term memory network to the penetration test structured model, recording the historical rewards of the execution action through the long short-term memory network, and when the penetration test structured model is learning, passing the recorded information to the model to correct the weights of each node in the model;

[0035] The initial weight of the penetration test structured model is w i (t), the output of the long short-term memory network is E(t), where t represents time; β represents the weight coefficient, and the modified weight is expressed as:

[0036] wi(t+1)=wi(t)+βE(t) (4).

[0037] The present invention can achieve the following technical effects:

[0038] The present invention proposes a penetration test knowledge base collection method based on a generative model, which can not only comprehensively collect relevant information of penetration testing, but also reduce the dependence of traditional manual testing methods on the professional knowledge and experience of testers;

[0039] The present invention uses expert experience knowledge in the traditional generative model to establish a reward learning mechanism, which can effectively avoid the generative model from giving a large amount of invalid and poorly adapted information, and improve the execution accuracy of the subsequent penetration testing process; BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a manual penetration testing method in the prior art;

[0041] Figure 2It is a penetration testing method based on reinforcement learning in the prior art;

[0042] Figure 3 It is the overall framework of the automatic penetration testing method disclosed in the present invention;

[0043] Figure 4 The penetration test structured model disclosed in the present invention;

[0044] Figure 5 The improved penetration test model disclosed in the present invention;

[0045] Figure 6 The present invention is a flowchart of the automatic penetration testing method disclosed in the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.

[0047] The existing technologies can be roughly divided into two types:

[0048] The first is based on manual penetration testing methods, such as Figure 1 As shown in the figure, this method requires professional technicians to select test tool sets based on experience and try them continuously according to the characteristics of the target object. In the end, two results are obtained: 1) The target object is penetrated and the target object needs to be reinforced according to the test results; 2) The target object is not penetrated; after trying all known penetration methods, the target object still cannot be penetrated, and the conclusion is that the target object does not need to be reinforced.

[0049] The second is the penetration testing method based on reinforcement learning, such as Figure 2 As shown; this method replaces manual attempts with artificial intelligence models, uses reinforcement learning theory, continuously learns the penetration process, and improves the penetration method until the penetration is completed.

[0050] The disadvantages of manual penetration testing methods are that they are time-consuming and inefficient. They also require a high level of professional knowledge and experience from testers, and are completely dependent on the experience of testers. Therefore, the test results may have certain limitations.

[0051] The shortcomings of the reinforcement learning-based method are: the scale of the target object cannot be too large, which easily causes the action space explosion problem and is not suitable for large-scale scenarios; and in practice there is a problem of sparse learning rewards, and many times no reward is obtained after the action is performed, which in turn affects the learning effect.

[0052] refer to Figure 1-6, an automatic penetration testing method based on generative model and dynamic partitioning, the solution proposed by the present invention is as follows Figure 3 As shown in the figure, it includes two parts: the establishment of a penetration test structured model and penetration testing. The main purpose of establishing a penetration test structured model is to use the generative model to automatically generate a knowledge base that can be used for penetration testing. The main purpose of penetration testing is to use penetration tools to identify potential vulnerabilities and security risks in the target system.

[0053] The establishment of the penetration test structured model includes the following steps:

[0054] Use scanning tools to identify the assets of the target system;

[0055] Furthermore, the assets of the target system are identified using a scanning tool including at least: hardware information, operating system, version number, system components, communication protocols and service ports.

[0056] Based on the identified target system assets, potential vulnerabilities and penetration tools are collected through generative models;

[0057] Furthermore, the sources of potential vulnerabilities and penetration tools collected through the generative model include at least: Common Vulnerabilities and Exposures (CVE), the U.S. National Computer Vulnerability Database (NVD), the China National Information Security Vulnerability Database (CNNVD), penetration tools, security books and papers.

[0058] Create test scripts for penetration tools;

[0059] Establish a penetration test structured model based on potential vulnerabilities, penetration tools, and test scripts;

[0060] Furthermore, a penetration test structured model is established based on potential vulnerabilities, penetration tools and test scripts, which is expressed by the formula:

[0061] Id l =<(v1|T,S),(v2|T,S),...,(v M |T,S)> (1)

[0062] Where Id l represents the assets of the system, l=1,2,...,N; V represents the potential vulnerability, V={v1,v2,...,v M},v i ∈V; T and S represent the available penetration tools and test scripts respectively.

[0063] Furthermore, after establishing the structured model of penetration testing, a reward learning mechanism is established based on expert experience, based on the matching of potential vulnerabilities and penetration tools and the execution efficiency of penetration tools. A negative reward mechanism is given to knowledge with poor adaptability, added fabricated components, knowledge that is not suitable for the power Internet of Things system (knowledge of general IT systems, such as Internet cloud-related penetration knowledge, etc.), and knowledge that cannot be executed, while a positive reward mechanism is given to effective knowledge.

[0064] Specifically, the reward learning mechanism includes: l A collection of vulnerabilities and tools in i ,T j ), using the generative model to automatically generate a feature vector Z that describes the vulnerability characteristics v , the eigenvector Z v At least including vulnerability type, risk level, affected components, difficulty of exploitation, detection frequency, patch status, exposure time and potential impact; then establish a feature vector Z describing the penetration tool based on expert experience T , the eigenvector Z T At least including supported vulnerability types, detection accuracy, component detection capabilities, operation complexity, patch management, response time and history; and using the unique hot encoding technology to convert each feature into a numerical vector; then using the cosine similarity function to calculate the similarity A of the feature vector v,T ,

[0065]

[0066] If A v,T >0 means that the penetration tool T can be used to exploit the potential vulnerability v, otherwise it is considered unusable. In addition, define S T Represents the execution efficiency of penetration tool T, and establishes a reward mechanism function by integrating two factors:

[0067] Qv,T=α1Av,T+α2ST (3)

[0068] Among them, α1 and α2 represent weight factors;

[0069] Then the reward mechanism is fed back to the generative model for optimization training until all sets (v i ,T j ) all satisfy A v,T >0.

[0070] The penetration test includes the following steps:

[0071] Evaluate the number of nodes covered by the penetration test structured model and partition the network topology of the target system;

[0072] Furthermore, the number of nodes covered by the penetration test structured model is evaluated and the network topology of the target system is partitioned. Specifically, the number of nodes that can be covered by the penetration test structured model under certain constraints is evaluated. According to the evaluation results, the network topology of the target system is partitioned, and the number of nodes in each area does not exceed the number of nodes obtained by the evaluation results.

[0073] Scan and score each partition for vulnerabilities;

[0074] Furthermore, vulnerability scanning and scoring are performed on each partition, specifically including: performing vulnerability scanning on each area in a distributed manner to obtain scanning results, scoring the scanning results of each area according to the security vulnerability scoring system CVSS, calculating the device with the highest score, and marking it as a "vulnerable device".

[0075] Create a new partition using the highest-scoring device as the starting point;

[0076] Furthermore, the establishment of a new partition with the highest-scoring device as the starting point specifically includes: starting from the device with the highest score, that is, starting from the "easily penetrated device", according to the direction of the penetration test path determined by the overall goal, establishing a node number not exceeding the number of nodes A new partition is created; and within the partition, the vulnerability scores of all nodes are marked in descending order.

[0077] Conduct penetration testing in the new partition to find nodes that can be penetrated;

[0078] In the newly created partition, call the test tool v i |T,S conducts penetration testing, finds the next node that can be penetrated, and marks it as a "vulnerable device".

[0079] There are two problems with using artificial intelligence learning models for automated penetration testing: 1) The model has poor memory and often repeats invalid actions; 2) It lacks professional knowledge of the target object and cannot better understand the actual needs of the target object. In order to enable the model to have memory during the penetration test and improve the test efficiency, a long short-term memory network (LSTM) is added to the penetration test structured model. Figure 5 As shown, the historical rewards of executing actions are recorded through the long short-term memory network LSTM. When the penetration test structured model is learned, the recorded information is passed to the model to correct the weights of each node in the model.

[0080] Specifically, assuming that the initial weight of the penetration test model is w i(t), the output of the long short-term memory network LSTM is E(t), where t represents time; β represents the weight coefficient; then the modified weight is expressed as:

[0081] wi(t+1)=wi(t)+βE(t) (4).

[0082] Finally, repeat the partitioning and penetration testing steps until the penetration testing goal is achieved; specifically, adjust the test object based on the tester's experience and vulnerability score, and repeat the partitioning and penetration testing process until the penetration testing goal is achieved; finally, generate a test report based on the test results.

[0083] The present invention also proposes an automatic penetration testing system based on a generative model and dynamic partitioning, which is used to implement an automatic penetration method based on a generative model and dynamic partitioning, including:

[0084] An asset identification module, wherein the asset identification module uses a scanning tool to identify the assets of the target system, and the identification content includes at least hardware information, operating system, version number, system components, communication protocols and service ports;

[0085] A vulnerability and tool collection module, which collects potential vulnerabilities and penetration tools through a generative model based on the identified target system assets, and the sources of which include at least Common Vulnerabilities and Exposures (CVE), the U.S. National Computer Vulnerability Database (NVD), the China National Information Security Vulnerability Database (CNNVD), penetration tools, security books and papers;

[0086] A test script establishment module, wherein the test script establishment module is used to establish a test script for a penetration tool;

[0087] A structured model building module, wherein the structured model building module builds a penetration test structured model based on potential vulnerabilities, penetration tools and test scripts;

[0088] A partitioning module, wherein the partitioning module evaluates the number of nodes covered by the penetration test structured model and partitions the network topology of the target system, evaluates the number of nodes that the penetration test structured model can cover under constraints, and partitions the network topology of the target system according to the evaluation results;

[0089] The vulnerability scanning and scoring module uses a distributed method to perform vulnerability scanning on each partition, scores the scanning results according to the security vulnerability scoring system CVSS, and calculates the device with the highest score.

[0090] A new partition establishment module takes the device with the highest score as the starting point, establishes a new partition according to the direction of the penetration test path determined by the overall goal, and marks the vulnerability scores of all nodes in the partition in descending order.

[0091] A penetration test execution module, wherein the penetration test execution module carries out a penetration test in a new partition, adds a long short-term memory network to the penetration test structured model, records the historical rewards of the execution actions through the long short-term memory network, passes the recorded information to the model to correct the weight of each node when the penetration test structured model is learned, finds the nodes that can be penetrated, and repeats the partitioning and penetration test steps until the penetration test goal is completed.

[0092] The present invention also provides a storage medium on which a computer-readable program is stored. When the computer-readable program is called, an automatic penetration method based on a generative model and dynamic partitioning is executed.

[0093] It is understood that the storage medium may be a magnetic medium, such as a floppy disk, a hard disk, a magnetic tape; an optical medium, such as a DVD; or a semiconductor medium, such as a solid state disk Solid State Disk, SSD, etc. In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0094] Although the embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. Those skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

[0095] The above specific implementations of the present invention do not constitute a limitation on the protection scope of the present invention. Any other corresponding changes and modifications made based on the technical concept of the present invention should be included in the protection scope of the claims of the present invention.

Claims

1. An automatic penetration testing method based on generative models and dynamic partitioning, characterized in that: include: Use scanning tools to identify the assets of the target system; Based on the identified target system assets, potential vulnerabilities and penetration tools are collected through generative models; Create test scripts for penetration tools; Establish a penetration test structured model based on potential vulnerabilities, penetration tools, and test scripts; Evaluate the number of nodes covered by the penetration test structured model and partition the network topology of the target system; Scan and score each partition for vulnerabilities; Create a new partition using the highest-scoring device as the starting point; Conduct penetration testing in the new partition to find nodes that can be penetrated; Repeat the partitioning and penetration testing steps until the penetration testing objectives are achieved.

2. The automatic penetration testing method based on generative model and dynamic partitioning according to claim 1 is characterized in that: The identification of the target system's assets using a scanning tool includes at least: hardware information, operating system, version number, system components, communication protocols, and service ports.

3. The automatic penetration testing method based on generative model and dynamic partitioning according to claim 1 is characterized in that: The sources of potential vulnerabilities and penetration tools collected through the generative model include at least: Common Vulnerabilities and Exposures (CVE), the U.S. National Computer Vulnerability Database (NVD), the China National Information Security Vulnerability Database (CNNVD), penetration tools, security books and papers.

4. The automatic penetration testing method based on generative model and dynamic partitioning according to claim 1 is characterized in that: The penetration test structured model established based on potential vulnerabilities, penetration tools and test scripts is expressed by the formula: Id l =<(v1|T,S),(v2|T,S),...,(v M |T,S)> (1) Where Id l represents the assets of the target system, l=1,2,...,N; V represents the potential vulnerability, V={v1,v2,...,v M },v i ∈V; T and S represent the available penetration tools and test scripts respectively.

5. The automatic penetration testing method based on generative model and dynamic partitioning according to claim 4 is characterized in that: After establishing the penetration test structured model, a reward learning mechanism is established based on the matching of potential vulnerabilities and penetration tools and the execution efficiency of penetration tools. The reward learning mechanism specifically includes: l A collection of vulnerabilities and tools in i ,T j ), using the generative model to automatically generate a feature vector Z that describes the vulnerability characteristics v , the eigenvector Z v At least including vulnerability type, risk level, affected components, difficulty of exploitation, detection frequency, patch status, exposure time and potential impact; then establish a feature vector Z describing the penetration tool based on expert experience T , the eigenvector Z T At least including supported vulnerability types, detection accuracy, component detection capabilities, operation complexity, patch management, response time and history; and using the unique hot encoding technology to convert each feature into a numerical vector; then using the cosine similarity function to calculate the similarity A of the feature vector v,T , If A v,T >0 means that the penetration tool T can be used to exploit the potential vulnerability v, otherwise it is considered that it cannot be used; in addition, S T Represents the execution efficiency of penetration tool T; establishes a reward mechanism function: Qv,T=α1Av,T+α2ST (3) Among them, α1 and α2 represent weight factors; Feed the reward learning mechanism back to the generative model for optimization training until all vulnerabilities and tool sets (v i ,T j ) all satisfy A v,T >0.

6. The automatic penetration testing method based on generative model and dynamic partitioning according to claim 1 is characterized in that: The step of evaluating the number of nodes covered by the penetration test structured model and partitioning the network topology of the target system specifically includes: evaluating the number of nodes that the penetration test structured model can cover under the constraints. According to the evaluation results, the network topology of the target system is partitioned, and the number of nodes in each area does not exceed the number of nodes obtained by the evaluation results.

7. The automatic penetration testing method based on generative model and dynamic partitioning according to claim 6 is characterized in that: The vulnerability scanning and scoring of each partition specifically includes: performing vulnerability scanning on each area in a distributed manner to obtain scanning results, scoring the scanning results of each area according to the security vulnerability scoring system CVSS, and calculating the device corresponding to the highest score.

8. The automatic penetration testing method based on generative model and dynamic partitioning according to claim 1 is characterized in that: The said conducting penetration test in the new partition and finding the next node that can be penetrated specifically includes: adding a long short-term memory network in the penetration test structured model, recording the historical rewards of the execution action through the long short-term memory network, and passing the recorded information to the model when the penetration test structured model is learning, so as to correct the weights of each node in the model; The initial weight of the penetration test structured model is w i (t), the output of the long short-term memory network is E(t), where t represents time; β represents the weight coefficient, and the modified weight is expressed as: wi(t+1)=wi(t)+βE(t) (4).

9. An automatic penetration testing system based on a generative model and dynamic partitioning, used to implement an automatic penetration method based on a generative model and dynamic partitioning as described in any one of claims 1 to 8, characterized in that: include: An asset identification module, wherein the asset identification module uses a scanning tool to identify assets of a target system; A vulnerability and tool collection module, which collects potential vulnerabilities and penetration tools through a generative model based on the identified target system assets; A test script establishment module, wherein the test script establishment module is used to establish a test script for a penetration tool; A structured model building module, wherein the structured model building module builds a penetration test structured model based on potential vulnerabilities, penetration tools and test scripts; A partitioning module, wherein the partitioning module evaluates the number of nodes covered by the penetration test structured model and partitions the network topology of the target system; A vulnerability scanning and scoring module, which performs vulnerability scanning on each partition in a distributed manner and scores the scanning results according to the security vulnerability scoring system CVSS; A new partition establishment module, wherein the new partition establishment module takes the device with the highest score as the starting point and establishes a new partition according to the penetration test path direction determined by the overall goal; A penetration test execution module is used to carry out penetration testing in the new partition, find nodes that can be penetrated, and repeat the partitioning and penetration testing steps until the penetration test goal is achieved.

10. A storage medium, characterized in that: A computer-readable program is stored thereon, and when the computer-readable program is called, an automatic penetration method based on a generative model and dynamic partitioning as described in any one of claims 1-8 is executed.