A system, method, device and medium for accurately controlling the playback byte size of a traffic packet
By designing a system including multiple modules, precise control of the playback byte size of traffic packets is achieved, and the problem of inability to accurately control the traffic packet size in the prior art is solved, and the accuracy and stability of the test results are improved.
Patent Information
- Application Number
- CN202510128399.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-02-05
AI Technical Summary
When performing performance testing, the existing technology cannot accurately control the size of the traffic packet, resulting in inaccurate performance test results and inconsistent cache data.
A system is designed, including a protocol management module, a test data rule management module, a data set management module, an execution set management module, a sandbox management module and a test engine. Through the mutual cooperation of these modules, precise control of the playback byte size of traffic packets is achieved.
It realizes precise control of the byte size of the traffic packet playback, improves the stability and security of the test data, saves test time, and improves the accuracy of the test results.
Smart Images

Figure CN119557233B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software testing technology, and specifically relates to a system, method, device and medium for accurately controlling the playback byte size of a flow packet. Background Art
[0002] Log audit software is a system used to collect logs generated by common security devices, network devices, databases, servers, application systems, hosts and other devices in the system and store, monitor, audit, analyze, alarm, respond and report. Before leaving the factory, this type of software often needs to go through a standard testing process to check whether it meets the customer's log audit needs. To test the log audit software, you first need to build a test environment, construct test data through a verification test, and then forward it to the receiving server of the log audit system through relevant communication protocols. This test method requires triggering a network attack to generate test data every time, and when the test environment changes, it is even necessary to rebuild the test target machine and attack environment; in addition, in the performance test scenario, when replaying offline packet traffic, the size of the traffic packet cannot be accurately controlled, which may lead to inaccurate performance test results and inconsistent cached data. Summary of the invention
[0003] In view of the deficiencies in the prior art, the present invention aims to provide a method and device for accurately controlling the playback byte size of a traffic packet.
[0004] To achieve the above object, the present invention provides the following technical solution: a system for accurately controlling the byte size of traffic packet playback, comprising a protocol management module, a test data rule management module, a data set management module, an execution set management module, a sandbox management module and a test engine,
[0005] The protocol management module is used to uniformly manage built-in protocols and provide data support for different protocol templates and single rule protocol types for the test engine;
[0006] The test data rule management module is used to centrally manage traffic rules, with built-in vulnerability risk rules and API risk rules, and provides a single traffic construction method for the data set management module;
[0007] The data set management module calls the test engine according to the construction method provided by the test data rule management module to verify the accuracy and reliability of a single data flow. After the verification is passed, it is stored in the database and a unique data ID is generated;
[0008] The execution set management module generates an execution set based on the traffic demand and the data set management module provides single data. The execution set selects the single data that meets the demand and calls the test engine for test verification. After the test verification passes, the data is stored in the warehouse.
[0009] The sandbox management module is used by the test engine to call the sandbox and provide an online traffic pattern target range for the test engine;
[0010] Based on the data provided by the execution set and the specific protocol type in each task, the test engine calls the packet template through the protocol type to assemble and distribute the data;
[0011] In some embodiments, the built-in protocols include but are not limited to HTTP, HTTPS, SMTP, IMAP, FTP, POP3, SMB, SSH and NFS.
[0012] In some of the embodiments, the execution set management module can call a single data ID in the data set management module, obtain the original data, trace the historical traffic data in the execution set management module, and perform visual secondary modification of the data.
[0013] In some embodiments, the test engine includes a data center, a built-in template project, a sandbox template project, and a traffic controller project.
[0014] The data center is used to construct batch scenario data to enter the test engine, which is decomposed into protocol type, traffic mode, data packet, and traffic size through the data center.
[0015] The protocol type and data packets are transferred to the built-in template project for secondary data processing.
[0016] The traffic pattern is transferred to the sandbox template project, and the traffic size is transferred to the traffic controller project;
[0017] The built-in template project starts the template corresponding to the protocol type based on the protocol type provided by the data center. If the scene data contains multiple protocol types, the corresponding templates are started at the same time;
[0018] The sandbox template project starts the sandbox according to the traffic pattern, provides a target range for the traffic, and intercepts the network traffic, saves it as a pcap file, and stores it in the specified path to provide data for file push;
[0019] The traffic controller project is used to calculate the size of the traffic sent each time in the construction scenario, and control the thread group each time according to the traffic size parameters provided by the data center.
[0020] In some of the embodiments, the template encapsulates a network protocol, a request data packet, a response data packet, and a thread group.
[0021] In some of the embodiments, the thread group calls the traffic controller project to obtain the number of thread groups each time for controlling the flow size per second.
[0022] To achieve the above object, the present invention also provides the following technical solution: a method for accurately controlling the byte size of traffic packet playback, according to the system for accurately controlling the byte size of traffic packet playback, the steps are:
[0023] (1) Obtain the network protocol and data rules in the data table of the preset task;
[0024] (2) Determine the corresponding data format based on the obtained network rules,
[0025] Automatically parse key parameters according to the acquired data rules, and automatically fill in the test flow data to complete the construction of a single flow;
[0026] (3) Start the test engine based on the constructed single flow data, and complete the assembly and distribution of data within the test engine;
[0027] (4) Transmit the assembled data to the sandbox range and complete the traffic execution task;
[0028] (5) Assemble the data stream with the execution results returned by the sandbox range, and feed the assembled data stream back to the single traffic entity;
[0029] (6) Store the successfully debugged single flow data into the database;
[0030] (7) Based on a single piece of traffic data, complete the batch construction of scenario test traffic bodies, set the traffic size parameters per second, and finally encapsulate the traffic parameters;
[0031] (8) According to the provided batch scenario data and setting the traffic mode, the data is transmitted to the test engine, the data is assembled and distributed inside the test engine, the assembled data is transmitted to the sandbox target range through steps (3) and (4), the sandbox is called as the target range, and real-time traffic is sent to the sandbox target range according to the set parameters, the traffic execution task is completed, and the execution results are returned to the test engine;
[0032] (9) The test engine returns the batch scenario traffic execution results to the batch scenario entity.
[0033] To achieve the above object, the present invention also provides the following technical solution: a device for accurately controlling the playback byte size of a flow packet, comprising:
[0034] Memory for storing computer programs;
[0035] The processor is used to implement the steps of the method for accurately controlling the playback byte size of the traffic packet when executing the computer program.
[0036] To achieve the above-mentioned purpose, the present invention also provides the following technical solution: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the operation method for accurately controlling the playback byte size of a traffic packet are implemented.
[0037] Compared with the prior art, the beneficial effects of the present invention are: through the mutual cooperation and processing of the protocol management module, the test data rule management module, the data set management module, the execution set management module, the sandbox management module and the test engine, the construction of test data is realized, and the flow size of data playback is controlled, thereby realizing the automation of constructing test data, saving test time, and improving data stability and security.
[0038] Details of one or more embodiments of the present application are presented in the following drawings and descriptions to make other features, purposes and advantages of the present application more concise and easy to understand. The present application is fully described and understood through the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a system module diagram of the present invention;
[0040] Figure 2 It is an operation flow chart of the present invention. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] The present invention provides a technical solution: a system for accurately controlling the playback byte size of a traffic packet, such as Figure 1 As shown, it includes a protocol management module, a test data rule management module, a data set management module, an execution set management module, a sandbox management module and a test engine.
[0043] The protocol management module is used to uniformly manage built-in protocols and provide data support for different protocol templates and single rule protocol types for the test engine; the built-in protocols include but are not limited to HTTP, HTTPS, SMTP, IMAP, FTP, POP3, SMB, SSH and NFS.
[0044] The test data rule management module is used to centrally manage traffic rules, with built-in vulnerability risk rules and API risk rules, and provides a single traffic construction method for the data set management module;
[0045] The data set management module calls the test engine according to the construction method provided by the test data rule management module to verify the accuracy and reliability of a single data flow. After the verification, it is stored in the database and a unique data ID is generated. The original data is obtained through the ID to provide the execution set module with the ability to modify the data of the flow for the second time.
[0046] The execution set management module generates an execution set based on the traffic demand and the data set management module provides single data. The execution set selects the single data that meets the demand and calls the test engine for test verification. After the test verification passes, the data is stored in the warehouse.
[0047] The execution data set supports the selection of traffic mode, and different sandboxes are selected according to the mode, with the ability to execute the traffic size sent per second;
[0048] The execution set management module can call a single data ID in the data set management module to obtain the original data, trace the historical traffic data in the execution set management module, and perform visual secondary modification of the data.
[0049] The sandbox management module is used by the test engine to call the sandbox and provide an online traffic pattern target range for the test engine;
[0050] Based on the data provided by the execution set and the specific protocol type in each task, the test engine calls the packet template through the protocol type to assemble and distribute the data;
[0051] The test engine includes a data center, a built-in template project, a sandbox template project and a traffic controller project.
[0052] The data center is used to construct batch scenario data to enter the test engine, which is decomposed into protocol type, traffic mode, data packet, and traffic size through the data center.
[0053] The protocol type and data packets are transferred to the built-in template project for secondary data processing.
[0054] The traffic pattern is transferred to the sandbox template project, and the traffic size is transferred to the traffic controller project;
[0055] The built-in template project starts the template corresponding to the protocol type based on the protocol type provided by the data center. If the scene data contains multiple protocol types, the corresponding templates are started at the same time;
[0056] The template encapsulates a network protocol, a request data packet, a response data packet and a thread group;
[0057] The thread group calls the flow controller project to obtain the number of thread groups each time, which is used to control the flow size per second;
[0058] The sandbox template project starts the sandbox according to the traffic pattern, provides a target range for the traffic, and intercepts the network traffic, saves it as a pcap file, and stores it in the specified path to provide data for file push;
[0059] The traffic controller project is used to calculate the size of the traffic sent each time in the construction scenario, and control the thread group each time according to the traffic size parameters provided by the data center.
[0060] like Figure 2 As shown, based on the above system, the operation method of accurately controlling the playback byte size of the traffic packet is as follows:
[0061] (1) Obtain the network protocol and data rules in the data table of the preset task;
[0062] (2) Determine the corresponding data format based on the obtained network rules,
[0063] Automatically parse key parameters according to the acquired data rules, and automatically fill in the test flow data to complete the construction of a single flow;
[0064] (3) Start the test engine based on the constructed single flow data, and complete the assembly and distribution of data within the test engine;
[0065] (4) Transmit the assembled data to the sandbox range and complete the traffic execution task;
[0066] (5) Assemble the data stream with the execution results returned by the sandbox range, and feed the assembled data stream back to the single traffic entity;
[0067] (6) Store the successfully debugged single flow data into the database;
[0068] (7) Based on a single piece of traffic data, complete the batch construction of scenario test traffic bodies, set the traffic size parameters per second, and finally encapsulate the traffic parameters;
[0069] (8) According to the provided batch scenario data and setting the traffic mode, the data is transmitted to the test engine, the data is assembled and distributed inside the test engine, the assembled data is transmitted to the sandbox target range through steps (3) and (4), the sandbox is called as the target range, and real-time traffic is sent to the sandbox target range according to the set parameters, the traffic execution task is completed, and the execution results are returned to the test engine;
[0070] (9) The test engine returns the batch scenario traffic execution results to the batch scenario entity.
[0071] According to the above solution, the construction of a single flow in step (2) is implemented as follows:
[0072] First, store the built-in rules in the database through the JSON data object; then, create a single rule in the data set management module. When creating, you need to select the network protocol and traffic rules, and dynamically load the basic data format form according to the selected protocol (such as the header, body, and response data formats corresponding to the HTTP protocol). The system parses the rules through the built-in data model and fills the data into the corresponding form after parsing. According to the key parameters in the form, call the mocker module to generate key data and complete it.
[0073] As a preferred embodiment, in the specific implementation, for the accuracy and reliability verification of a single data flow, the sandbox management module returns the detailed information of the execution results to the test engine, including the complete data flow of the request initiation, request data, response data, etc. of a single flow. The test engine encapsulates the returned data flow into JSON format through the built-in template engine, and returns it to the application layer for direct display and judgment. Each piece of data will be stored in the database with a unique ID generated by the snowflake algorithm, corresponding one to one to the data flow.
[0074] As a preferred embodiment, in a specific implementation, for the control of flow size, it presets flow size parameters before task execution, and starts the test engine with the flow size parameters and the overall execution set size parameters when executing the data set. After the test engine receives the data, it calls the flow controller project. The flow controller starts the corresponding thread group according to the input parameters, thereby realizing precise control of the flow.
[0075] When the traffic execution task is performed according to step (4), in the specific implementation, the processing method is: directly return the pre-constructed response data according to the data transmitted by the test engine, because the preparation of the response data has been completed in the single data construction stage; then the result is verified through the sandbox management module.
[0076] Based on the above method, the API flow capacity test is implemented in actual application:
[0077] Set the traffic volume to 1G per second, including https and http.
[0078] ① Obtain network protocols and traffic rules from the basic table, extract traffic rule keywords, and obtain templates based on network protocols, such as filling in Content-Type, Cookies and other information in the request body;
[0079] Request body: json format data
[0080] Return data in json format {
[0081] "code": 200,
[0082] "msg": "Success",
[0083] "iphone": "130XXXXXXXX"
[0084] }
[0085] The above is to automatically fill in the test data and complete the single flow construction;
[0086] ② After the single traffic is constructed, the test engine is called for debugging. The test engine calls the sandbox range. The sandbox range receives the data and directly returns the json format data to the test engine. The test engine encapsulates the data into json data and returns it to the single traffic scenario. Then, the machine or manual judgment is made as to whether the construction is successful. If the construction is successful, the data is directly saved and stored in the single traffic table.
[0087] ③Construct batch scenarios: A single traffic table provides data, and the scenario traffic is constructed to include http and https traffic scenarios. When saving batch scenarios, set the transmission traffic per second to 1G. After the scenario construction is completed, save it;
[0088] ④ Start the batch scenario, call the test engine, transmit the traffic content data and 1G traffic per second to the test engine. The test engine obtains the data, calls the engine template project, controls the traffic project, and finally calls the sandbox target range to complete the traffic construction and control the traffic size per second.
[0089] As a preferred embodiment, a device for accurately controlling the playback byte size of a traffic packet is also included, which includes
[0090] Memory for storing computer programs;
[0091] The processor is used to implement the steps of the operating method of accurately controlling the playback byte size of the traffic packet as mentioned in the above embodiment when executing the computer program.
[0092] The test data construction device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0093] The processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), or a programmable logic array (PLA).
[0094] The processor may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state.
[0095] In some embodiments, the processor may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen.
[0096] In some embodiments, the processor may also include an artificial intelligence (AI) processor for processing computing operations related to machine learning.
[0097] The memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In this embodiment, the memory is used to store at least the following computer programs:
[0098] After the computer program is loaded and executed by the processor, the relevant steps of the method for accurately controlling the playback byte size of the traffic packet disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include but is not limited to the data involved in the test data construction method.
[0099] In some embodiments, the test data construction device may further include a display screen, an input and output interface, a communication interface, a power supply, and a communication bus.
[0100] In this embodiment, the test data construction device includes a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to implement the steps of the method for accurately controlling the playback byte size of a traffic packet as mentioned in the above embodiment when executing the computer program.
[0101] As a preferred embodiment, it also includes a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the operating method for accurately controlling the playback byte size of the traffic packet as mentioned in the above embodiment are implemented.
[0102] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0103] In this embodiment, a computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0104] The above is a detailed introduction to a method, device, equipment and medium for accurately controlling the playback byte size of traffic packets provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0105] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A system for accurately controlling the byte size of traffic packet playback, characterized by: It includes protocol management module, test data rule management module, data set management module, execution set management module, sandbox management module and test engine. The protocol management module is used to uniformly manage built-in protocols and provide data support for different protocol templates and single rule protocol types for the test engine; The test data rule management module is used to centrally manage traffic rules, with built-in vulnerability risk rules and API risk rules, and provides a single traffic construction method for the data set management module; The data set management module calls the test engine according to the construction method provided by the test data rule management module to verify the accuracy and reliability of a single data flow. After the verification is passed, it is stored in the database and a unique data ID is generated; The execution set management module generates an execution set based on the traffic demand and the data set management module provides single data. The execution set selects the single data that meets the demand and calls the test engine for test verification. After the test verification passes, the data is stored in the warehouse. The sandbox management module is used by the test engine to call the sandbox and provide an online traffic pattern target range for the test engine; Based on the data provided by the execution set and the specific protocol type in each task, the test engine calls the packet template through the protocol type to assemble and distribute the data; The test engine includes a data center, a built-in template project, a sandbox template project and a traffic controller project. The data center is used to construct batch scenario data to enter the test engine, which is decomposed into protocol type, traffic mode, data packet, and traffic size through the data center. The protocol type and data packets are transferred to the built-in template project for secondary data processing. The traffic pattern is transferred to the sandbox template project, and the traffic size is transferred to the traffic controller project; The built-in template project starts the template corresponding to the protocol type based on the protocol type provided by the data center. If the scene data contains multiple protocol types, the corresponding templates are started at the same time; The sandbox template project starts the sandbox according to the traffic pattern, provides a target range for the traffic, and intercepts the network traffic, saves it as a pcap file, and stores it in the specified path to provide data for file push; The traffic controller project is used to calculate the size of the traffic sent each time in the construction scenario, and control the thread group each time according to the traffic size parameters provided by the data center.
2. A system for accurately controlling the playback byte size of a traffic packet according to claim 1, characterized in that: The built-in protocols include but are not limited to HTTP, HTTPS, SMTP, IMAP, FTP, POP3, SMB, SSH and NFS.
3. A system for accurately controlling the playback byte size of a traffic packet according to claim 1, characterized in that: The execution set management module can call a single data ID in the data set management module to obtain the original data, trace the historical traffic data in the execution set management module, and perform visual secondary modification of the data.
4. A system for accurately controlling the playback byte size of a traffic packet according to claim 1, characterized in that: The template encapsulates a network protocol, a request data packet, a response data packet and a thread group.
5. A system for accurately controlling the playback byte size of a traffic packet according to claim 4, characterized in that: The thread group calls the flow controller project to obtain the number of thread groups each time, which is used to control the flow size per second.
6. An operating method for accurately controlling the playback byte size of a traffic packet, characterized in that: A system for accurately controlling the playback byte size of a traffic packet according to any one of claims 1 to 5, wherein the steps are: (1) Obtain the network protocol and data rules in the data table of the preset task; (2) Determine the corresponding data format based on the obtained network rules, Automatically parse key parameters according to the acquired data rules, and automatically fill in the test flow data to complete the construction of a single flow; (3) Start the test engine based on the constructed single flow data, and complete the assembly and distribution of data within the test engine; (4) Transmit the assembled data to the sandbox range and complete the traffic execution task; (5) Assemble the data stream with the execution results returned by the sandbox range, and feed the assembled data stream back to the single traffic entity; (6) Store the successfully debugged single flow data into the database; (7) Based on a single piece of traffic data, complete the batch construction of scenario test traffic bodies, set the traffic size parameters per second, and finally encapsulate the traffic parameters; (8) According to the provided batch scenario data and setting the traffic mode, the data is transmitted to the test engine, the data is assembled and distributed inside the test engine, the assembled data is transmitted to the sandbox target range through steps (3) and (4), the sandbox is called as the target range, and real-time traffic is sent to the sandbox target range according to the set parameters, the traffic execution task is completed, and the execution results are returned to the test engine; (9) The test engine returns the batch scenario traffic execution results to the batch scenario entity.
7. A device for accurately controlling the byte size of traffic packet playback, characterized in that: include Memory for storing computer programs; A processor is used to implement the steps of the operating method for accurately controlling the playback byte size of a traffic packet as described in claim 6 when executing the computer program.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the operating method for accurately controlling the playback byte size of a traffic packet as described in claim 6 are implemented.
Citation Information
Patent Citations
Network attack scene reproduction method and system, equipment and storage medium
CN110943969A
Test data construction method and device, equipment and medium
CN115827426A