Network traffic generation method, device, and storage medium
By performing structured parsing and multi-agent logic matching on network traffic generation requirements, network traffic that meets the requirements is generated, solving the problems of poor generation quality and single path in existing technologies, and realizing high-quality network traffic generation.
Patent Information
- Application Number
- CN202611607841.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-16
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies suffer from poor network traffic generation quality, are susceptible to illusion interference, suffer from syntax errors and protocol logic inconsistencies, lack structured expression of generation requirements, resulting in insufficient constraints on the generation process and a single path.
The network traffic generation requirements are structured and parsed by intelligent agents to generate a structured task list. Multiple intelligent agents are then used for logical matching and evaluation to generate candidate strategies and network traffic that meet the requirements.
It improves the quality and controllability of network traffic generation, avoids generation deviations and homogenization, and ensures the consistency and feasibility of the generation process.
Smart Images

Figure CN123164029A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network security testing technology, specifically to methods, devices, and storage media for generating network traffic. Background Technology
[0002] Currently, with the continuous growth of network services, tasks such as network security testing, protocol consistency verification, and intrusion detection system evaluation place higher demands on the quality and controllability of network traffic data. However, in related technologies, traffic code generation schemes based on large models generally adopt a single-round independent generation mode, which is susceptible to illusion interference and prone to problems such as syntax errors and protocol logic inconsistencies. At the same time, generation requirements are usually given in the form of natural language or scattered parameters, lacking a unified structured expression, resulting in insufficient constraints on the generation process and a single generation path. Therefore, there is a problem of poor quality in network traffic generation. Summary of the Invention
[0003] This invention provides a method, device, and storage medium for generating network traffic to solve the problem of poor quality network traffic generation.
[0004] In a first aspect, the present invention provides a method for generating network traffic, comprising: In response to the network traffic generation command, the first intelligent agent performs structured parsing of the network traffic generation requirements and generates a structured task book, in which the network traffic generation requirements correspond to the network traffic generation command. Using the first intelligent agent, a set of candidate policies is generated based on the structured parameters in the structured task book; Using a second intelligent agent, the structured parameters in the structured task book are logically matched with each candidate policy in the candidate policy set to generate a generation plan corresponding to each candidate policy; the generation plan includes traffic generation path and resource control parameters. For each candidate strategy, a third agent is used to generate candidate network traffic corresponding to the candidate strategy based on resource control parameters and traffic generation path; The fourth intelligent agent is used to evaluate each candidate network traffic and determine the target traffic generation strategy based on the evaluation results. The target traffic generation strategy is used to generate network traffic based on network traffic generation requirements.
[0005] The network traffic generation method provided in this invention, in response to a network traffic generation command, utilizes a first intelligent agent to perform structured parsing of the network traffic generation requirements, generating a structured task book. This transforms non-standardized natural language requirements into standardized task information, avoiding traffic generation deviations caused by ambiguous requirement expressions. Using the first intelligent agent, a candidate strategy set is generated based on the structured parameters in the structured task book. This allows for differentiated exploration of network traffic generation paths from multiple dimensions, broadening the coverage of traffic generation schemes and avoiding the problem of homogenized traffic generation results. A second intelligent agent logically matches the structured parameters in the structured task book with each candidate strategy in the candidate strategy set, generating a generation plan corresponding to each candidate strategy, including the traffic generation path and resource control parameters. This eliminates candidate strategies that conflict with the constraints of the structured task book or are resource-infeasible, ensuring the feasibility of the candidate strategies. For each candidate strategy, a third intelligent agent generates candidate network traffic corresponding to the candidate strategy based on the resource control parameters and the traffic generation path, realizing the transformation from candidate strategies to traffic data. By using a fourth intelligent agent to evaluate each candidate network traffic and determine the target traffic generation strategy based on the evaluation results, the target scheme that meets the quality constraints can be selected, thereby improving the quality of network traffic generation.
[0006] In one optional implementation, the network traffic generation requirements are parsed in a structured manner to generate a structured task list, including: Semantic completion is performed on network traffic generation requirements to obtain traffic generation semantics; The semantics of traffic generation are decomposed to obtain multiple requirement parameters; The required parameters are processed in a structured manner to generate a structured task specification.
[0007] The network traffic generation method provided in this invention, by semantically completing the network traffic generation requirements, can fill in the missing key information in the requirements, avoiding semantic ambiguity and information incompleteness. By decomposing the semantics of traffic generation, multiple requirement parameters are obtained, achieving a refined breakdown of network traffic generation requirements and avoiding misunderstandings caused by mixed elements. By structuring each requirement parameter to generate a structured task book, scattered traffic requirement parameters can be mapped to a standardized set of fields, ensuring the standardization of requirement parameter expression.
[0008] In one optional implementation, the structured parameters in the structured task book are logically matched with each candidate strategy in the candidate strategy set to generate a generation plan corresponding to each candidate strategy, including: Logical matching is performed between the structured parameters in the structured task book and each candidate policy in the candidate policy set to obtain the logical matching results; For each candidate strategy, if the logical matching result represents logical alignment, then the first execution model corresponding to each candidate strategy is matched from the model pool. The model pool corresponds to the second agent and includes multiple execution models. Using the first execution model, a generation plan corresponding to the candidate strategy is generated.
[0009] The network traffic generation method provided in this invention performs logical matching between the structured parameters in the structured task book and each candidate strategy in the candidate strategy set to obtain a logical matching result. This verifies the compatibility between each candidate strategy and the structured task book, avoiding abnormal traffic generation due to mismatch between the candidate strategy and the structured task book. For each candidate strategy, if the logical matching result indicates logical alignment, a first execution model corresponding to each candidate strategy is matched from the model pool, and a generation plan corresponding to the candidate strategy is generated using the first execution model. This allows for adaptation of the execution model based on the differences between each candidate strategy, avoiding the problem of homogenized traffic generation results.
[0010] In one alternative implementation, it further includes: For each candidate strategy, if the logical matching result does not represent the logical alignment, the candidate strategy is corrected based on the structured parameters in the structured task book to obtain the target candidate strategy; Match the second execution model corresponding to the target candidate strategy from the model pool; The second execution model is used to generate a generation plan corresponding to the target candidate strategy.
[0011] The network traffic generation method provided in this invention, for each candidate strategy, if the logical matching result does not represent the logical alignment, corrects the candidate strategy based on the structured parameters in the structured task book to obtain the target candidate strategy. This method can correct candidate strategies that do not match the structured task book to match strategies, improving the utilization rate of candidate strategies. A second execution model corresponding to the target candidate strategy is matched from the model pool, and a generation plan corresponding to the target candidate strategy is generated using the second execution model. This method can adapt the execution model according to the characteristics of the corrected candidate strategy, ensuring the feasibility of the generation plan.
[0012] In one optional implementation, candidate network traffic corresponding to the candidate strategy is generated based on resource control parameters and traffic generation path, including: Parse the structured parameters in the structured task book and generate constraints; Based on resource control parameters, traffic generation paths, and constraints, generate traffic construction code; Based on the traffic identifier corresponding to the traffic construction code, the traffic construction code is distributed to the target execution environment for execution, and packet capture data and execution results are obtained during the execution process; the packet capture data includes traffic data files and parsed digests; the target execution environment corresponds to the traffic identifier corresponding to the traffic construction code; The candidate network traffic includes traffic construction code, packet capture data, and execution results.
[0013] The network traffic generation method provided in this invention generates constraints by parsing structured parameters in a structured task book, ensuring consistency between the traffic generation process and network traffic generation requirements. Based on resource control parameters, traffic generation paths, and constraints, traffic construction code is generated, enabling the transformation from a generation plan to executable code, while avoiding deviations from expectations due to missing constraints. Based on the traffic identifier corresponding to the traffic construction code, the code is distributed to the target execution environment for execution, acquiring packet capture data and results during execution. This avoids interference between different traffic construction codes during execution, ensuring the accuracy of packet capture data and results.
[0014] In one optional implementation, each candidate network traffic is evaluated, and a target traffic generation strategy is determined based on the evaluation results. The target traffic generation strategy is used to generate network traffic based on network traffic generation requirements, including: The execution success rate is determined by analyzing the execution results corresponding to each candidate network traffic. Analyze the packet capture data corresponding to each candidate network traffic to determine the protocol parsing efficiency; The traffic data files corresponding to the packet capture data of each candidate network traffic are compared with the traffic data corresponding to the network traffic generation requirements to determine the feature similarity. Based on the fusion results of execution success rate, protocol parsing efficiency, and feature similarity, the target traffic generation strategy is determined.
[0015] The network traffic generation method provided in this invention analyzes the execution results of each candidate network traffic to determine the execution success rate, quantifying the execution status of the candidate traffic construction code and eliminating candidate strategies that fail to execute. By analyzing the packet capture data corresponding to each candidate network traffic, the method determines the protocol parsing efficiency, quantifying the proportion of candidate network traffic successfully decoded and eliminating candidate strategies with non-compliant protocols. By comparing the traffic data files corresponding to the packet capture data of each candidate network traffic with the traffic data corresponding to the network traffic generation requirement, the method determines the feature similarity, quantifying the consistency between the candidate network traffic and the traffic corresponding to the network traffic generation requirement. Based on the fusion result of execution success rate, protocol parsing efficiency, and feature similarity, the target traffic generation strategy is determined. This allows for a comprehensive evaluation of candidate network traffic from multiple dimensions, avoiding the one-sidedness of evaluation by a single indicator.
[0016] In one optional implementation, a target traffic generation strategy is determined based on a fusion of execution success rate, protocol parsing efficiency, and feature similarity, including: For each candidate network traffic, if the execution success rate is greater than the preset execution threshold and the protocol parsing success rate is greater than the preset parsing threshold, then the candidate strategy corresponding to the candidate network traffic is retained. The remaining candidate strategies are ranked based on feature similarity, and the candidate strategy with the highest feature similarity is determined as the target traffic generation strategy.
[0017] The network traffic generation method provided in this invention, for each candidate network traffic, retains the candidate strategy corresponding to the candidate network traffic if the execution success rate is greater than a preset execution threshold and the protocol parsing efficiency is greater than a preset parsing threshold. This dual constraint of execution success rate and protocol parsing efficiency ensures the executability of the candidate strategy. The retained candidate strategies are ranked based on feature similarity, and the candidate strategy with the highest feature similarity is determined as the target traffic generation strategy, thus filtering out the candidate strategy most suitable for the network traffic generation requirements.
[0018] In one alternative implementation, it further includes: If the execution success rate is less than the preset execution threshold, and / or the protocol parsing success rate is less than the preset parsing threshold, then a traffic repair strategy will be generated. The traffic repair strategy is fed back to the second agent to obtain the current iteration number; Using a second intelligent agent, the execution model corresponding to each candidate strategy is re-matched; If the current iteration count has not reached the maximum iteration count carried in the candidate strategy, and the target traffic generation strategy has been determined, then the iteration stops; If the current iteration count reaches the maximum iteration count carried in the candidate strategy, the iteration will be forcibly stopped, and an abnormal traffic generation alarm message will be generated.
[0019] The network traffic generation method provided in this invention generates a traffic repair strategy if the execution success rate is less than a preset execution threshold and / or the protocol parsing success rate is less than a preset parsing threshold. This strategy can provide traffic repair strategies for candidate strategies that are of substandard quality, improving the utilization rate of candidate strategies. The traffic repair strategy is fed back to the second agent to obtain the current iteration count, and the execution model corresponding to each candidate strategy is re-matched using the second agent, realizing a closed-loop iterative optimization from evaluation results to candidate strategy execution. If the current iteration count has not reached the maximum iteration count carried in the candidate strategy, and the target traffic generation strategy is determined, the iteration stops, which can stop the iteration in time after obtaining the target traffic generation strategy, avoiding waste of computing resources. If the current iteration count reaches the maximum iteration count carried in the candidate strategy, the iteration is forcibly stopped, and a traffic generation anomaly alarm message is generated, realizing effective control of the iterative optimization process and avoiding getting stuck in an infinite iteration loop; at the same time, the generation of traffic generation anomaly alarm message facilitates the investigation of the cause of traffic generation failure, improving the controllability of anomalies in the traffic generation process.
[0020] Secondly, the present invention provides a network traffic generation apparatus, comprising: The task generation module is used to respond to network traffic generation instructions by using the first intelligent agent to perform structured parsing of network traffic generation requirements and generate a structured task book, in which the network traffic generation requirements correspond to the network traffic generation instructions. The candidate policy generation module is used to generate a set of candidate policies based on the structured parameters in the structured task book using the first intelligent agent. The plan generation module is used to use a second intelligent agent to logically match the structured parameters in the structured task book with each candidate policy in the candidate policy set, and generate a generation plan corresponding to each candidate policy; the generation plan includes traffic generation path and resource control parameters; The candidate traffic generation module is used to generate candidate network traffic corresponding to each candidate strategy by using a third-party intelligent agent based on resource control parameters and traffic generation path. The target policy generation module is used to evaluate each candidate network traffic using a fourth intelligent agent and determine the target traffic generation policy based on the evaluation results. The target traffic generation policy is used to generate network traffic based on network traffic generation requirements.
[0021] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the network traffic generation method described in the first aspect or any corresponding embodiment thereof.
[0022] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the network traffic generation method described in the first aspect or any corresponding embodiment thereof.
[0023] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the network traffic generation method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0024] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0025] Figure 1 This is a schematic diagram of an application scenario according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a first method for generating network traffic according to an embodiment of the present invention; Figure 3 This is a schematic diagram of a second process for generating network traffic according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the third process of generating network traffic according to an embodiment of the present invention; Figure 5 This is a structural block diagram of a network traffic generation apparatus according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0028] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0029] As an optional application scenario of this invention, such as Figure 1 As shown, application 101 is installed in electronic device 110, and user 130 can interact with application 101 through electronic device 110 and / or access device of electronic device 110.
[0030] For example, application 101 can be any application that provides network traffic generation services. For instance, application 101 could be a network security testing application, such as a protocol conformance verification application, an intrusion detection evaluation application, etc. Figure 1 In the application scenario shown, if application 101 is active, electronic device 110 can display interface 102 of application 101. User 130 can input network traffic generation requirements through interface 102, such as specifying the target protocol, session flow, generation scale, etc. Interface 102 can include various pages that application 101 can provide, such as requirement input page, parameter configuration page, generation result display page, etc.
[0031] In some embodiments, electronic device 110 is communicatively connected to server 120 to provide services to application 101. Server 120 executes a method involving a first intelligent agent, a second intelligent agent, a third intelligent agent, and a fourth intelligent agent: the first intelligent agent performs structured parsing of network traffic generation requirements to generate a structured task book and a candidate strategy set; the second intelligent agent performs logical matching of the structured task book and the candidate strategy set to generate a traffic execution plan; the third intelligent agent generates candidate network traffic based on resource control parameters and traffic generation paths; the fourth intelligent agent evaluates each candidate network traffic, determines the target traffic generation strategy, and finally generates network traffic that meets user requirements based on the strategy.
[0032] In some embodiments, electronic device 110 is communicatively connected to server 120 to provide services to application 101. Electronic device 110 may be a mobile terminal, fixed terminal, or portable terminal, etc., including but not limited to desktop computers, laptop computers, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof. In some embodiments, electronic device 110 may also support any type of interface, and server 120 may be various types of computing systems or servers capable of providing computing power, including but not limited to mainframes, edge computing nodes, computing devices in cloud environments, etc.
[0033] It should be noted that, Figure 1 This is merely an example of an application scenario and does not limit the scope of protection of this invention.
[0034] The embodiments of the present invention will now be described with reference to the accompanying drawings. It should be understood that the pages shown in the drawings are merely examples, and various page designs are possible in practice. The various graphic elements on the page may have different arrangements and different visual representations; one or more elements may be omitted or replaced, and one or more other elements may also be present, without any limitation in the embodiments of the present invention. Furthermore, the embodiments described below primarily pertain to electronic device 110. It should be understood that the actions described relative to electronic device 110 can be performed by application 101 on electronic device 110, or can be performed by application 101 in conjunction with its server (e.g., server 120).
[0035] Currently, with the continuous growth of network services, tasks such as network security testing, protocol consistency verification, and intrusion detection system evaluation place higher demands on the quality and controllability of network traffic data. This not only requires coverage of network interaction behaviors across multiple protocols and scenarios but also demands that traffic be reproduced at scale according to preset rules to support testing and verification at different stages. The relevant technologies mainly involve traffic code generation schemes based on a single large model; however, such schemes still face many limitations in practical applications, specifically: (1) It basically adopts a single-round independent generation mode, which is easily affected by illusion interference. The traffic generation code is prone to problems such as syntax errors and inconsistent protocol logic. In addition, the execution verification step is lacking in the generation process, making it difficult to guarantee the executability and protocol compliance of the traffic generation code.
[0036] (2) The generation requirements are usually given in natural language or in the form of scattered parameters. They lack a unified structured expression and are difficult to accurately describe the protocol structure, session flow and quality objectives, resulting in insufficient constraints on the traffic generation process, a single generation path and difficulty in reusing the generation results.
[0037] Based on this, the technical solution of the present invention utilizes a first intelligent agent to perform structured analysis of network traffic generation requirements, generate a structured task book, and generate a candidate strategy set based on the structured parameters in the structured task book; utilizes a second intelligent agent to logically match the structured parameters in the structured task book with each candidate strategy in the candidate strategy set, and generate a generation plan corresponding to each candidate strategy; for each candidate strategy, a third intelligent agent generates candidate network traffic corresponding to the candidate strategy based on resource control parameters and traffic generation path; and utilizes a fourth intelligent agent to evaluate each candidate network traffic, and determines the target traffic generation strategy based on the evaluation results.
[0038] According to an embodiment of the present invention, a method for generating network traffic is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0039] This embodiment provides a method for generating network traffic, which can be used in the aforementioned electronic devices, such as laptops and desktop computers. Figure 2 This is a flowchart of a method for generating network traffic according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: In response to the network traffic generation instruction, the first intelligent agent performs structured parsing of the network traffic generation requirements to generate a structured task book.
[0040] Network traffic generation commands are instruction signals that trigger the network traffic generation process.
[0041] Network traffic generation requirements refer to the business demands included in network traffic generation instructions, and correspond to network traffic generation instructions. For example, network traffic generation requirements can be expressed in the form of natural language text or specific parameters, such as "generate 100 HTTP GET session traffic entries, with a message length of 64 to 256 bytes".
[0042] The first intelligent agent refers to a software module or computational entity with semantic understanding and structured processing capabilities, used to perform structured parsing of network traffic generation requirements. For example, the first intelligent agent can be a large language model, or a model or rule engine with natural language processing capabilities.
[0043] Structured parsing refers to the process of transforming unstructured network traffic generation requirements into structured parameters.
[0044] A structured task specification refers to a data structure that describes network traffic generation requirements using structured parameters. For example, a structured task specification may include protocol element parameters, session constraint parameters, and generation control parameters.
[0045] Protocol element parameters refer to parameters that describe the basic attributes of network traffic communication protocols, including target protocol type (e.g., TCP, HTTP), communication role (e.g., client or server), and traffic direction (e.g., uplink or downlink). Session constraint parameters refer to parameters that describe the constraints of session establishment and interaction processes, including session state constraints (e.g., handshake, transmission) and session interaction step sequences. Generation control parameters refer to parameters used to describe and manage the network traffic generation process, including generation scale (e.g., number of packets or sessions) and quality thresholds (e.g., execution success rate threshold).
[0046] Specifically, after the user inputs their network traffic generation requirements through a text box, they click the "Generate Traffic" button to trigger the network traffic generation instruction. The first intelligent agent reads the network traffic generation requirements corresponding to this instruction and performs structured parsing. The parsed structured parameters are then mapped according to the template of the structured task book to generate a structured task book.
[0047] Step S202: Using the first intelligent agent, a set of candidate strategies is generated based on the structured parameters in the structured task book.
[0048] A candidate strategy set refers to a collection of multiple candidate strategies, where each candidate strategy describes an implementation method for traffic generation. For example, a candidate strategy set may include traffic generation methods (such as protocol-based library encapsulation, packet template filling, or session script reproduction), payload construction methods (such as fixed payload, random payload), field sampling methods (such as uniform random sampling, constrained range sampling, or target distribution sampling), and field dependencies (such as length field varying with payload).
[0049] Specifically, the first intelligent agent reads the structured parameters in the structured task book, parses the structured parameters from multiple dimensions, integrates the parsing results to obtain multiple candidate strategies, and generates a candidate strategy set.
[0050] Step S203: Using the second intelligent agent, logically match the structured parameters in the structured task book with each candidate policy in the candidate policy set to generate a generation plan corresponding to each candidate policy.
[0051] The second intelligent agent refers to a software module or computational entity with logical verification and resource matching capabilities, used to logically match the structured parameters in the structured task book with each candidate policy in the candidate policy set. For example, the second intelligent agent can be a scheduling module with rule reasoning capabilities, or a decision engine that integrates constraint verification and resource allocation functions.
[0052] Logical matching refers to comparing the structured parameters in the structured task statement with each candidate policy in the candidate policy set to determine if there is a conflict. For example, if the structured task statement requires the protocol to be HTTP, but a candidate policy implicitly contains UDP semantics, then there is a conflict between the two.
[0053] A generation plan is a scheme used to guide the execution of candidate strategies, including traffic generation paths and resource control parameters.
[0054] The traffic generation path refers to the execution process of generating corresponding traffic by implementing candidate strategies. This includes, for example, which large model to use and the execution order. Resource control parameters refer to the resource constraints required during the process of generating corresponding traffic by implementing candidate strategies. These parameters include, for example, the number of parallel generation attempts, the maximum number of attempts, and dynamic termination conditions.
[0055] Specifically, a second intelligent agent reads the structured parameters in the structured task book and each candidate policy in the candidate policy set. Then, the structured parameters are compared with each candidate policy to determine whether each candidate policy conforms to the structured parameters. For candidate policies that pass logical matching, a traffic generation path is generated, and resource control parameters are configured to obtain the generation plan corresponding to each candidate policy.
[0056] Step S204: For each candidate strategy, a third agent generates candidate network traffic corresponding to the candidate strategy based on resource control parameters and traffic generation path.
[0057] A third intelligent agent refers to a software module or computing entity capable of executing a traffic generation plan. It is used to execute candidate strategies according to the generation plan and obtain candidate network traffic corresponding to the candidate strategies. For example, a third intelligent agent can be a computing engine that integrates a traffic generation tool interface, or it can be a traffic generation execution module deployed on the server side.
[0058] Candidate network traffic refers to network traffic data obtained after executing a candidate strategy.
[0059] Specifically, a third intelligent agent is used to read the generation plan corresponding to each candidate strategy. Under the constraints of resource control parameters, the generation plan is executed according to the traffic generation path in the generation plan to generate candidate network traffic corresponding to the candidate strategy.
[0060] Step S205: Using the fourth intelligent agent, evaluate the traffic of each candidate network and determine the target traffic generation strategy based on the evaluation results.
[0061] The fourth agent refers to a software module or computing entity with evaluation and optimization capabilities, used to evaluate candidate network traffic and determine the target traffic generation strategy. For example, the fourth agent can be a decision engine integrating a strategy optimization algorithm, or a quality evaluation module deployed on a server.
[0062] The target traffic generation strategy refers to the optimal candidate strategy obtained after evaluation and screening, which is used to generate network traffic based on network traffic generation requirements.
[0063] Specifically, a fourth agent is used to read the candidate network traffic corresponding to the candidate strategies, and each candidate network traffic is evaluated to obtain the evaluation results. Based on all the evaluation results, the candidate strategy corresponding to the candidate network traffic with the best overall performance is determined as the target traffic generation strategy.
[0064] The network traffic generation method provided in this invention, in response to a network traffic generation command, utilizes a first intelligent agent to perform structured parsing of the network traffic generation requirements, generating a structured task book. This transforms non-standardized natural language requirements into standardized task information, avoiding traffic generation deviations caused by ambiguous requirement expressions. Using the first intelligent agent, a candidate strategy set is generated based on the structured parameters in the structured task book. This allows for differentiated exploration of network traffic generation paths from multiple dimensions, broadening the coverage of traffic generation schemes and avoiding the problem of homogenized traffic generation results. A second intelligent agent logically matches the structured parameters in the structured task book with each candidate strategy in the candidate strategy set, generating a generation plan corresponding to each candidate strategy, including the traffic generation path and resource control parameters. This eliminates candidate strategies that conflict with the constraints of the structured task book or are resource-infeasible, ensuring the feasibility of the candidate strategies. For each candidate strategy, a third intelligent agent generates candidate network traffic corresponding to the candidate strategy based on the resource control parameters and the traffic generation path, realizing the transformation from candidate strategies to traffic data. By using a fourth intelligent agent to evaluate each candidate network traffic and determine the target traffic generation strategy based on the evaluation results, the target scheme that meets the quality constraints can be selected, thereby improving the quality of network traffic generation.
[0065] This embodiment provides a method for generating network traffic, which can be used in the aforementioned electronic devices, such as laptops and desktop computers. Figure 3 This is a flowchart of a method for generating network traffic according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps: Step S301: In response to the network traffic generation instruction, the first intelligent agent performs structured parsing of the network traffic generation requirements to generate a structured task book.
[0066] Specifically, step S301 includes: Step S3011: Semantic completion is performed on the network traffic generation requirements to obtain traffic generation semantics.
[0067] Semantic completion refers to supplementing and improving the missing, ambiguous, or unspecified parameters in the network traffic generation requirements.
[0068] Specifically, the first intelligent agent is used to analyze the network traffic generation requirements, identify missing, ambiguous or unexplained parameters, and supplement and improve the network traffic generation requirements based on the default values of the task template and prior knowledge of the protocol to obtain traffic generation semantics.
[0069] For missing required parameters, such as protocol type, communication role, traffic direction, and generation scale, they will be supplemented based on prior protocol knowledge or the default values in the task specification template. For ambiguous parameters, they will be supplemented based on prior protocol knowledge. For parameters not explicitly given, such as quality threshold, they will be supplemented based on the default values in the task specification template.
[0070] Protocol prior knowledge refers to the set of knowledge about various network protocol specifications and traffic characteristics, including protocol type definitions, message structure, field value ranges, session interaction processes, state transition rules, etc. For example, protocol prior knowledge includes that the HTTP protocol uses a request-response model, and that the TCP protocol includes a three-way handshake and a four-way handshake.
[0071] Step S3012: Decompose the traffic generation semantics to obtain multiple requirement parameters.
[0072] Specifically, the first intelligent agent is used to analyze the semantics of traffic generation, identifying parameters in different dimensions such as protocol, role, scale, and fields. These parameters are then broken down according to these dimensions to obtain multiple requirement parameters. For example, the requirement "generate 100 bidirectional HTTP GET requests and responses, with a message length of 64 to 256 bytes" is broken down into multiple requirement parameters such as: "protocol type: HTTP", "request method: GET", "communication role: client, server", "traffic direction: bidirectional", "generation scale: 100 messages", and "message length range: 64 to 256 bytes".
[0073] Step S3013: Perform structured processing on each requirement parameter to generate a structured task book.
[0074] Specifically, based on the template of the structured task specification, each requirement parameter is mapped to its corresponding slot to obtain the structured task specification. For example, "Protocol Type: HTTP" is mapped to the "Target Protocol Type" slot.
[0075] In the above implementation, semantic completion of network traffic generation requirements can fill in missing key information, avoiding semantic ambiguity and information incompleteness. By decomposing the semantics of traffic generation, multiple requirement parameters are obtained, achieving a refined breakdown of network traffic generation requirements and avoiding misunderstandings caused by mixed elements. By structuring each requirement parameter to generate a structured task book, scattered traffic requirement parameters can be mapped to a standardized set of fields, ensuring the standardization of requirement parameter expression.
[0076] Step S302: Using the first intelligent agent, a candidate policy set is generated based on the structured parameters in the structured task book. For details, please refer to [link to relevant documentation]. Figure 2 Step S202 of the illustrated embodiment will not be described again here.
[0077] Step S303: Using the second intelligent agent, logically match the structured parameters in the structured task book with each candidate policy in the candidate policy set to generate a generation plan corresponding to each candidate policy.
[0078] Specifically, step S303 includes: Step S3031: Logically match the structured parameters in the structured task book with each candidate strategy in the candidate strategy set to obtain the logical matching result.
[0079] Logical matching result refers to the judgment result obtained after logical matching, including logical alignment and logical misalignment.
[0080] Specifically, the second agent reads the structured parameters from the structured task book through the data access interface, and iterates through each candidate policy in the candidate policy set. It compares the structured parameters with each candidate policy to determine whether each candidate policy conforms to the structured parameters, thus obtaining a logical matching result. For example, if the target protocol type of the structured parameters is HTTP, and the candidate policy is encapsulated based on an HTTP protocol library, the logical matching result is characterized as logical alignment; if the candidate policy is encapsulated based on a UDP protocol library, the logical matching result is characterized as logical misalignment.
[0081] Step S3032: For each candidate strategy, if the logical matching result indicates logical alignment, then the first execution model corresponding to each candidate strategy is matched from the model pool.
[0082] A model pool refers to a collection of models that correspond to the second agent and include multiple execution models.
[0083] Specifically, a second agent iterates through each candidate strategy and reads the corresponding logical matching result. If the logical matching result indicates logical alignment, the candidate strategy is matched against the labels corresponding to each execution model in the model pool based on its construction method, protocol type, field sampling method, and other feature parameters. The execution model with the highest fit between the candidate strategy's feature parameters and the corresponding label is selected as the first execution model. For example, for a candidate strategy based on an HTTP protocol construction library, execution model A, which is proficient in HTTP protocol construction, is matched from the model pool and selected as the first execution model for that candidate strategy.
[0084] Step S3033: Using the first execution model, generate the generation plan corresponding to the candidate strategy.
[0085] Specifically, the first execution model is integrated with each candidate strategy to determine the traffic generation path. Resource control parameters are then configured for each candidate strategy to obtain the generation plan corresponding to each candidate strategy.
[0086] Step S3034: For each candidate strategy, if the logical matching result does not represent the logical alignment, the candidate strategy is corrected based on the structured parameters in the structured task book to obtain the target candidate strategy.
[0087] Specifically, a second agent iterates through each candidate policy and reads the corresponding logical matching result. If the logical matching result indicates logical misalignment, the candidate policy is parsed to identify parameters that conflict with the structured parameters in the structured task book. The conflicting parameters are then corrected based on the structured parameters to obtain the target candidate policy.
[0088] Step S3035: Match the second execution model corresponding to the target candidate strategy from the model pool.
[0089] Specifically, based on the feature parameters such as the construction method, protocol type, and field sampling method of the target candidate strategy, it is matched with the labels corresponding to each execution model in the model pool. The execution model with the highest fit between the feature parameters of the target candidate strategy and the labels corresponding to the execution model is selected as the second execution model.
[0090] Step S3036: Using the second execution model, generate a generation plan corresponding to the target candidate strategy.
[0091] Specifically, the second execution model is integrated with the target candidate strategy to determine the traffic generation path. Resource control parameters are then configured for the target candidate strategy to obtain the corresponding generation plan.
[0092] Step S304: For each candidate strategy, a third-party agent generates candidate network traffic corresponding to the candidate strategy based on resource control parameters and traffic generation paths. For details, please refer to [link to details]. Figure 2 Step S204 of the illustrated embodiment will not be described again here.
[0093] Step S305: Using the fourth intelligent agent, each candidate network traffic is evaluated, and a target traffic generation strategy is determined based on the evaluation results. This target traffic generation strategy is used to generate network traffic based on network traffic generation requirements. For details, please refer to [link to details]. Figure 2 Step S205 of the illustrated embodiment will not be described again here.
[0094] The network traffic generation method provided in this invention performs logical matching between the structured parameters in the structured task book and each candidate strategy in the candidate strategy set to obtain a logical matching result. This verifies the compatibility between each candidate strategy and the structured task book, avoiding abnormal traffic generation due to mismatch between candidate strategies and the structured task book. For each candidate strategy, if the logical matching result indicates logical alignment, a first execution model corresponding to each candidate strategy is matched from the model pool, and a generation plan corresponding to the candidate strategy is generated using the first execution model. This adapts the execution model according to the differences of each candidate strategy, avoiding the problem of homogenized traffic generation results. For each candidate strategy, if the logical matching result indicates logical misalignment, the candidate strategy is corrected based on the structured parameters in the structured task book to obtain a target candidate strategy. This corrects candidate strategies that do not match the structured task book to matching strategies, improving the utilization rate of candidate strategies. A second execution model corresponding to the target candidate strategy is matched from the model pool, and a generation plan corresponding to the target candidate strategy is generated using the second execution model. This adapts the execution model according to the characteristics of the corrected candidate strategy, ensuring the feasibility of the generation plan.
[0095] This embodiment provides a method for generating network traffic, which can be used in the aforementioned electronic devices, such as laptops and desktop computers. Figure 4 This is a flowchart of a method for generating network traffic according to an embodiment of the present invention, such as... Figure 4 As shown, the process includes the following steps: Step S401: In response to the network traffic generation command, the first intelligent agent performs structured parsing of the network traffic generation requirements to generate a structured task list. For details, please refer to [link to relevant documentation]. Figure 3 Step S301 of the illustrated embodiment will not be described again here.
[0096] Step S402: Using the first intelligent agent, a candidate policy set is generated based on the structured parameters in the structured task book. For details, please refer to [link to relevant documentation]. Figure 2Step S202 of the illustrated embodiment will not be described again here.
[0097] Step S403: Using the second intelligent agent, logical matching is performed between the structured parameters in the structured task book and each candidate policy in the candidate policy set to generate a generation plan corresponding to each candidate policy. For details, please refer to [link to relevant documentation]. Figure 3 Step S303 of the illustrated embodiment will not be described again here.
[0098] Step S404: For each candidate strategy, a third agent generates candidate network traffic corresponding to the candidate strategy based on resource control parameters and traffic generation path.
[0099] Specifically, step S404 includes: Step S4041: Parse the structured parameters in the structured task book and generate constraints.
[0100] Constraints are rules derived from structured parameters and used to constrain traffic construction. For example, if the structured parameters are "protocol type: HTTP", "generation scale: 100 messages", and "message length range: 64 to 256 bytes", the resulting constraints are: the protocol is fixed as HTTP, the number of sessions generated is 100, and the minimum message length is 64 bytes and the maximum message length is 256 bytes.
[0101] Specifically, a third intelligent agent reads the structured parameters in the structured task book through a data access interface, performs semantic transformation on the structured parameters, and generates constraints.
[0102] Step S4042: Generate traffic construction code based on resource control parameters, traffic generation path, and constraints.
[0103] Traffic construction code refers to executable code used to construct network traffic. After execution, traffic construction code can generate network traffic that meets the requirements according to the constraints.
[0104] Specifically, based on resource control parameters and constraints, the third agent invokes the execution model in the traffic generation path, executes the corresponding candidate strategy, and generates traffic construction code.
[0105] Step S4043: Based on the traffic identifier corresponding to the traffic construction code, distribute the traffic construction code to the target execution environment for execution, and obtain packet capture data and execution results during the execution process.
[0106] A traffic identifier is a unique identifier bound to the traffic construction code. It is used to distinguish the code corresponding to different candidate strategies and to match the corresponding target execution environment. For example, a traffic identifier can be a UUID (Universally Unique Identifier) or other unique identifiers.
[0107] The target execution environment refers to the controlled environment (such as a container, virtual machine, or sandbox) used to run traffic construction code, which corresponds to the traffic identifier corresponding to the traffic construction code. That is, each traffic identifier corresponds to a target execution environment.
[0108] The candidate network traffic includes traffic construction code, packet capture data, and execution results. Packet capture data refers to network traffic data captured during execution in the target execution environment, including traffic data files and parsed digests. Traffic data files are files that record actual network traffic, such as PCAP (Packet Capture) files. Parsed digests are summary information obtained after real-time decoding of network traffic data. Execution results refer to the output of the traffic construction code after running in the target execution environment, such as error backtracking information, exception types, and execution logs.
[0109] Specifically, the third agent reads the traffic identifier bound to the traffic construction code through a data access interface and matches the corresponding target execution environment based on the traffic identifier. The traffic construction code is then sent to the corresponding target execution environment via file copy, network transmission, or mounting a shared directory. The traffic construction code is then executed in the target execution environment, and during execution, network traffic data is captured using a packet capture tool; simultaneously, the output results are collected to obtain the packet capture data and the execution results.
[0110] In the above implementation, by parsing the structured parameters in the structured task book and generating constraints, the consistency between the traffic generation process and the network traffic generation requirements is ensured. Based on resource control parameters, traffic generation paths, and constraints, traffic construction code is generated, enabling the transformation from a generation plan to executable code, while avoiding deviations from expectations due to missing constraints. Based on the traffic identifier corresponding to the traffic construction code, the traffic construction code is distributed to the target execution environment for execution, acquiring packet capture data and execution results during the process. This avoids mutual interference between different traffic construction codes during execution and ensures the accuracy of packet capture data and execution results.
[0111] Step S405: Using the fourth intelligent agent, evaluate each candidate network traffic and determine the target traffic generation strategy based on the evaluation results. The target traffic generation strategy is used to generate network traffic based on network traffic generation requirements.
[0112] Specifically, step S405 includes: Step S4051: Analyze the execution results corresponding to each candidate network traffic to determine the execution success rate.
[0113] The execution success rate refers to the percentage of times the traffic construction code corresponding to candidate network traffic successfully runs. For example, the execution success rate can be calculated at the session level or the packet level. If the packet generation scale in the candidate policy is 50 and the number of successfully generated packets is 48, then the execution success rate is 96%.
[0114] Specifically, the fourth agent traverses the traffic of each candidate network, reads the corresponding execution results through the data access interface, analyzes the exception types and execution logs in the execution results, counts the number of successfully executed sessions or packets, and calculates the execution success rate.
[0115] Step S4052: Analyze the packet capture data corresponding to each candidate network traffic to determine the protocol parsing efficiency.
[0116] Protocol parsing efficiency refers to the proportion of packets in the captured data that can be correctly identified and parsed by the target protocol parser out of all packets. It is used to measure the protocol conformity of network traffic packets. For example, if the captured data for each candidate network traffic consists of 1000 packets, and 950 packets can be correctly identified and parsed as HTTP packets, the protocol parsing efficiency is 95%.
[0117] Specifically, the fourth agent traverses the candidate network traffic, reads the corresponding packet capture data through the data access interface, calls parsing tools such as Wireshark and tshark, or reads the parsing status of the parsing digest in the packet capture data to determine whether each packet has been successfully decoded. Based on the parsing results, the number of successfully decoded packets is counted, and the protocol parsing efficiency is calculated.
[0118] Step S4053: Compare the traffic data files corresponding to the packet capture data of each candidate network traffic with the traffic data corresponding to the network traffic generation requirements to determine the feature similarity.
[0119] Feature similarity refers to the degree of similarity in traffic characteristics between the traffic data files corresponding to the packet capture data of each candidate network traffic and the traffic data corresponding to the network traffic generation requirements. For example, traffic characteristics can include packet length distribution, arrival interval distribution, session duration, and payload characteristics. Feature similarity can be calculated using distribution consistency measures, such as Kullback-Leibler divergence, Earth Mover's Distance (EMD), and cosine similarity.
[0120] Specifically, the fourth agent traverses each candidate network traffic, reads the traffic data file corresponding to each packet capture through the data access interface, and simultaneously reads the traffic data corresponding to the network traffic generation requirements. It extracts the traffic features from the traffic data files and compares them, calculating feature similarity using a distribution consistency metric.
[0121] Step S4054: Based on the fusion results of execution success rate, protocol parsing efficiency, and feature similarity, determine the target traffic generation strategy.
[0122] Specifically, the success rate of execution, the efficiency of protocol parsing, and feature similarity are used to perform hierarchical screening or ranking decisions to obtain the fusion result corresponding to each candidate strategy. Based on the fusion result, the candidate strategy with the best overall performance is selected as the target traffic generation strategy.
[0123] In some optional implementations, step S4054 above includes: Step a1: For each candidate network traffic, if the execution success rate is greater than the preset execution threshold and the protocol parsing success rate is greater than the preset parsing threshold, then the candidate strategy corresponding to the candidate network traffic is retained.
[0124] Step a2: Sort the remaining candidate strategies based on feature similarity, and determine the candidate strategy with the highest feature similarity as the target traffic generation strategy.
[0125] The preset execution threshold refers to the minimum threshold value that is set in advance to determine whether the execution success rate meets the standard.
[0126] The preset parsing threshold refers to the minimum threshold value that is set in advance to determine whether the protocol's parsing efficiency meets the standard.
[0127] The preset execution threshold and preset parsing threshold can be determined based on the structured parameters (such as quality threshold) in the structured task book.
[0128] Specifically, the fourth agent traverses all candidate network traffic, reading the corresponding execution success rate and protocol parsing efficiency. Simultaneously, it reads the structured parameters of the thresholds stored in the structured task book through the data access interface to obtain the preset execution threshold and preset parsing threshold. The execution success rate and protocol parsing efficiency are numerically compared with the preset execution threshold and preset parsing threshold, respectively. When the execution success rate is greater than the preset execution threshold and the protocol parsing efficiency is greater than the preset parsing threshold, the candidate strategy corresponding to that candidate network traffic is retained. The feature similarity corresponding to the retained candidate network traffic is read through the data access interface, and the feature similarity is sorted in descending order from high to low. The candidate strategy with the highest feature similarity is determined as the target traffic generation strategy.
[0129] In the above implementation, for each candidate network traffic, if the execution success rate is greater than a preset execution threshold and the protocol parsing efficiency is greater than a preset parsing threshold, then the candidate strategy corresponding to the candidate network traffic is retained. This dual constraint of execution success rate and protocol parsing efficiency ensures the executability of the candidate strategy. The retained candidate strategies are then ranked based on feature similarity, and the candidate strategy with the highest feature similarity is determined as the target traffic generation strategy, thus selecting the candidate strategy most suitable for the network traffic generation requirements.
[0130] The network traffic generation method provided in this invention analyzes the execution results of each candidate network traffic to determine the execution success rate, quantifying the execution status of the candidate traffic construction code and eliminating candidate strategies that fail to execute. By analyzing the packet capture data corresponding to each candidate network traffic, the method determines the protocol parsing efficiency, quantifying the proportion of candidate network traffic successfully decoded and eliminating candidate strategies with non-compliant protocols. By comparing the traffic data files corresponding to the packet capture data of each candidate network traffic with the traffic data corresponding to the network traffic generation requirement, the method determines the feature similarity, quantifying the consistency between the candidate network traffic and the traffic corresponding to the network traffic generation requirement. Based on the fusion result of execution success rate, protocol parsing efficiency, and feature similarity, the target traffic generation strategy is determined. This allows for a comprehensive evaluation of candidate network traffic from multiple dimensions, avoiding the one-sidedness of evaluation by a single indicator.
[0131] In some alternative implementations, it also includes: Step b1: If the execution success rate is less than the preset execution threshold, and / or the protocol parsing success rate is less than the preset parsing threshold, then a traffic repair strategy is generated.
[0132] Step b2: Feed back the traffic repair strategy to the second agent and obtain the current iteration number.
[0133] Step b3: Using the second agent, re-match the execution model corresponding to each candidate strategy.
[0134] Step b4: If the current iteration count has not reached the maximum iteration count carried in the candidate strategy, and the target traffic generation strategy has been determined, then the iteration stops.
[0135] Step b5: If the current iteration count reaches the maximum iteration count carried in the candidate strategy, the iteration is forcibly stopped and a traffic generation anomaly alarm message is generated.
[0136] Traffic repair strategies refer to measures designed to address the shortcomings of candidate strategies. For example, traffic repair strategies may include adjusting the generation method, correcting the field sampling method, changing the execution model, and increasing the number of retries. For instance, if the protocol parsing efficiency is 75%, the traffic repair strategy could be to modify the HTTP header length field and adjust the request line format.
[0137] The current iteration count refers to the number of iteration rounds that have been completed so far. For example, the current iteration count can be obtained through a counter or through the corresponding field in the candidate strategy.
[0138] The maximum number of iterations refers to the maximum number of rounds allowed for a candidate strategy. For example, the maximum number of iterations can be obtained through the corresponding field in the resource control parameters.
[0139] Traffic generation anomaly alarm messages are used to indicate abnormal traffic generation. For example, traffic generation anomaly alarm messages may include the number of iterations, the reason for failure, and the status of candidate strategies.
[0140] Specifically, the fourth agent compares the execution success rate and protocol parsing efficiency with preset execution and parsing thresholds. If either the execution success rate or the preset parsing threshold is less than the corresponding preset threshold, or both are less than the corresponding preset thresholds, the execution results and logs of the candidate strategy are analyzed to generate a traffic repair strategy. The traffic repair strategy is sent to the second agent, and the iteration counter is read to obtain the current iteration count. Based on the construction method, protocol type, field sampling method, and other feature parameters of the candidate strategy after adjustment by the traffic repair strategy, it is re-matched with the labels corresponding to each execution model in the model pool to generate a corresponding generation plan. The resource control parameters corresponding to the generation plan are read to obtain the maximum number of iterations. The current iteration count is compared with the maximum number of iterations. If the current iteration count has not reached the maximum number of iterations carried in the candidate strategy, and the target traffic generation strategy has been obtained, the iteration process ends. If the current iteration count has reached the maximum number of iterations carried in the candidate strategy, the iteration process is forcibly terminated, and a traffic generation anomaly alarm is generated by generating an event, sending a notification message, or writing to the execution log.
[0141] The network traffic generation method provided in this invention generates a traffic repair strategy if the execution success rate is less than a preset execution threshold and / or the protocol parsing success rate is less than a preset parsing threshold. This strategy can provide traffic repair strategies for candidate strategies that are of substandard quality, improving the utilization rate of candidate strategies. The traffic repair strategy is fed back to the second agent to obtain the current iteration count, and the execution model corresponding to each candidate strategy is re-matched using the second agent, realizing a closed-loop iterative optimization from evaluation results to candidate strategy execution. If the current iteration count has not reached the maximum iteration count carried in the candidate strategy, and the target traffic generation strategy is determined, the iteration stops, which can stop the iteration in time after obtaining the target traffic generation strategy, avoiding waste of computing resources. If the current iteration count reaches the maximum iteration count carried in the candidate strategy, the iteration is forcibly stopped, and a traffic generation anomaly alarm message is generated, realizing effective control of the iterative optimization process and avoiding getting stuck in an infinite iteration loop; at the same time, the generation of traffic generation anomaly alarm message facilitates the investigation of the cause of traffic generation failure, improving the controllability of anomalies in the traffic generation process.
[0142] This embodiment also provides a network traffic generation device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0143] This embodiment provides a network traffic generation device, such as... Figure 5 As shown, it includes: The task generation module 501 is used to respond to the network traffic generation command, use the first intelligent agent to perform structured parsing of the network traffic generation requirements, and generate a structured task book, in which the network traffic generation requirements correspond to the network traffic generation command.
[0144] The candidate policy generation module 502 is used to generate a set of candidate policies using the first intelligent agent based on the structured parameters in the structured task book.
[0145] The plan generation module 503 is used to use a second intelligent agent to logically match the structured parameters in the structured task book with each candidate strategy in the candidate strategy set, and generate a generation plan corresponding to each candidate strategy; the generation plan includes traffic generation path and resource control parameters.
[0146] The candidate traffic generation module 504 is used to generate candidate network traffic corresponding to each candidate strategy by employing a third intelligent agent based on resource control parameters and traffic generation path.
[0147] The target policy generation module 505 is used to evaluate each candidate network traffic using a fourth intelligent agent and determine the target traffic generation policy based on the evaluation results. The target traffic generation policy is used to generate network traffic based on network traffic generation requirements.
[0148] In some alternative implementations, the task generation module 501 includes: The semantic completion unit is used to semantically complete the network traffic generation requirements to obtain the traffic generation semantics.
[0149] The semantic decomposition unit is used to decompose the semantics of traffic generation to obtain multiple requirement parameters.
[0150] The structured processing unit is used to process the various requirement parameters in a structured manner and generate a structured task book.
[0151] In some alternative implementations, the planning generation module 503 includes: The logical matching unit is used to logically match the structured parameters in the structured task book with each candidate policy in the candidate policy set to obtain the logical matching result.
[0152] The first model matching unit is used to match the first execution model corresponding to each candidate strategy from the model pool if the logical matching result indicates logical alignment.
[0153] The first execution plan unit is used to generate a generation plan corresponding to the candidate strategy using the first execution model.
[0154] The parameter correction unit is used to correct the candidate strategy based on the structured parameters in the structured task book for each candidate strategy if the logical matching result does not represent the logical alignment, so as to obtain the target candidate strategy.
[0155] The second model matching unit is used to match the second execution model corresponding to the target candidate strategy from the model pool.
[0156] The second execution plan unit is used to generate a generation plan corresponding to the target candidate strategy using the second execution model.
[0157] In some alternative implementations, the candidate traffic generation module 504 includes: The parameter parsing unit is used to parse the structured parameters in the structured task book and generate constraints.
[0158] The code generation unit is used to generate traffic construction code based on resource control parameters, traffic generation paths, and constraints.
[0159] The code execution unit is used to construct traffic identifiers corresponding to the traffic based on the traffic, distribute the traffic-constructed code to the target execution environment for execution, and obtain packet capture data and execution results during the execution process.
[0160] In some optional implementations, the target policy generation module 505 includes: The results analysis unit is used to analyze the execution results corresponding to each candidate network traffic to determine the execution success rate.
[0161] The data analysis unit is used to analyze the packet capture data corresponding to each candidate network traffic to determine the protocol parsing efficiency.
[0162] The data comparison unit is used to compare the traffic data files corresponding to the packet capture data of each candidate network traffic with the traffic data corresponding to the network traffic generation requirements to determine the feature similarity.
[0163] The result fusion unit is used to determine the target traffic generation strategy based on the fusion results of execution success rate, protocol parsing efficiency, and feature similarity.
[0164] In some alternative implementations, the result fusion unit includes: The strategy selection subunit is used to select candidate strategies for each candidate network traffic if the execution success rate is greater than a preset execution threshold and the protocol parsing efficiency is greater than a preset parsing threshold.
[0165] The strategy determination subunit is used to rank the retained candidate strategies based on feature similarity and determine the candidate strategy with the highest feature similarity as the target traffic generation strategy.
[0166] In some alternative embodiments, the above-described apparatus further includes: The strategy repair module is used to generate a traffic repair strategy if the execution success rate is less than a preset execution threshold, and / or the protocol parsing efficiency is less than a preset parsing threshold.
[0167] The iteration count acquisition module is used to feed back the traffic repair strategy to the second agent and obtain the current iteration count.
[0168] The model rematching module is used to rematch the execution model corresponding to each candidate strategy using a second agent.
[0169] The first iteration stop module is used to stop the iteration if the current iteration number has not reached the maximum iteration number carried in the candidate strategy and the target traffic generation strategy has been determined.
[0170] The second iteration stop module is used to forcibly stop the iteration if the current iteration count reaches the maximum iteration count carried in the candidate strategy, and generate a traffic generation anomaly alarm message.
[0171] The network traffic generation apparatus provided in this embodiment of the invention can execute the network traffic generation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.
[0172] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0173] The following is a detailed reference. Figure 6 This diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from memory 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0174] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0175] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by the processor 601, it performs the functions defined in the network traffic generation method of the embodiments of the present invention.
[0176] Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0177] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the network traffic generation method shown in the above embodiments is implemented.
[0178] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0179] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for generating network traffic, characterized in that, The method includes: In response to the network traffic generation command, the first intelligent agent performs structured parsing of the network traffic generation requirements and generates a structured task book, wherein the network traffic generation requirements correspond to the network traffic generation command. Using the first intelligent agent, a candidate strategy set is generated based on the structured parameters in the structured task book; Using a second intelligent agent, the structured parameters in the structured task book are logically matched with each candidate strategy in the candidate strategy set to generate a generation plan corresponding to each candidate strategy; the generation plan includes traffic generation path and resource control parameters. For each of the aforementioned candidate strategies, a third intelligent agent generates candidate network traffic corresponding to the candidate strategy based on the resource control parameters and the traffic generation path. Using a fourth intelligent agent, each candidate network traffic is evaluated, and a target traffic generation strategy is determined based on the evaluation results. The target traffic generation strategy is used to generate network traffic based on the network traffic generation requirements.
2. The method according to claim 1, characterized in that, The process of performing structured parsing of the network traffic generation requirements to generate a structured task list includes: The semantic completion of the network traffic generation requirement yields the traffic generation semantics; The traffic generation semantics are decomposed to obtain multiple demand parameters; The required parameters are processed in a structured manner to generate the structured task book.
3. The method according to claim 1, characterized in that, The step of logically matching the structured parameters in the structured task book with each candidate strategy in the candidate strategy set to generate a generation plan corresponding to each candidate strategy includes: Logical matching is performed between the structured parameters in the structured task book and each candidate strategy in the candidate strategy set to obtain the logical matching result; For each candidate strategy, if the logical matching result indicates logical alignment, then the first execution model corresponding to each candidate strategy is matched from the model pool. The model pool corresponds to the second agent and includes multiple execution models. Using the first execution model, a generation plan corresponding to the candidate strategy is generated.
4. The method according to claim 3, characterized in that, Also includes: For each candidate strategy, if the logical matching result represents the logic as misaligned, the candidate strategy is corrected based on the structured parameters in the structured task book to obtain the target candidate strategy. Match the second execution model corresponding to the target candidate strategy from the model pool; Using the second execution model, a generation plan corresponding to the target candidate strategy is generated.
5. The method according to claim 1, characterized in that, The step of generating candidate network traffic corresponding to the candidate strategy based on the resource control parameters and the traffic generation path includes: Parse the structured parameters in the structured task book to generate constraints; Based on the resource control parameters, the traffic generation path, and the constraints, generate traffic construction code; Based on the traffic identifier corresponding to the traffic construction code, the traffic construction code is distributed to the target execution environment for execution, and packet capture data and execution results are obtained during the execution process; the packet capture data includes traffic data files and parsing digests; the target execution environment corresponds to the traffic identifier corresponding to the traffic construction code; The candidate network traffic includes the traffic construction code, the packet capture data, and the execution results.
6. The method according to any one of claims 1 to 5, characterized in that, The step involves evaluating each of the candidate network traffic flows and determining a target traffic generation strategy based on the evaluation results. The target traffic generation strategy is used to generate network traffic based on the network traffic generation requirements, including: The execution success rate is determined by analyzing the execution results corresponding to each candidate network traffic. The packet capture data corresponding to each of the candidate network traffic was analyzed to determine the protocol parsing efficiency. The traffic data files corresponding to the packet capture data of each candidate network traffic are compared with the traffic data corresponding to the network traffic generation requirement to determine the feature similarity. Based on the fusion results of the execution success rate, the protocol parsing efficiency, and the feature similarity, a target traffic generation strategy is determined.
7. The method according to claim 6, characterized in that, The determination of the target traffic generation strategy based on the fusion result of the execution success rate, the protocol parsing efficiency, and the feature similarity includes: For each candidate network traffic, if the execution success rate is greater than a preset execution threshold and the protocol parsing efficiency is greater than a preset parsing threshold, then the candidate strategy corresponding to the candidate network traffic is retained. The candidate strategies are sorted based on the feature similarity, and the candidate strategy with the highest feature similarity is determined as the target traffic generation strategy.
8. The method according to claim 7, characterized in that, Also includes: If the execution success rate is less than the preset execution threshold, and / or the protocol parsing efficiency is less than the preset parsing threshold, then a traffic repair strategy is generated. The traffic repair strategy is fed back to the second intelligent agent to obtain the current iteration number; Using the second intelligent agent, the execution model corresponding to each candidate strategy is rematched; If the current iteration count has not reached the maximum iteration count carried in the candidate strategy, and the target traffic generation strategy is determined, then the iteration stops; If the current iteration count reaches the maximum iteration count carried in the candidate strategy, the iteration is forcibly stopped, and a traffic generation anomaly alarm message is generated.
9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the method for generating network traffic according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the method for generating network traffic according to any one of claims 1 to 8.
