Data testing methods and apparatus, computer program products, electronic equipment

By acquiring real-time user requests to generate a test request dataset and optimizing interception conditions using a large language model, the high cost and low efficiency of existing WAF testing are solved, achieving automated and high-precision testing.

CN123116262APending Publication Date: 2026-11-17BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510629708.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-15
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing WAF testing methods are costly and inefficient. Manually constructing attack requests is costly, deploying two environments is costly, manual judgment involves many dependencies, test results are inaccurate, and they cannot fully cover interception conditions.

Method used

By acquiring users' real-time requests, network security interception is performed, interception logs are generated, a test request dataset is built, and large language models are used to optimize the interception conditions, thus automating the testing and optimization of the interception conditions.

Benefits of technology

It simplifies the testing process, reduces costs, improves testing accuracy, and enables automatic optimization and precise testing of interception conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123116262A_ABST
    Figure CN123116262A_ABST
Patent Text Reader

Abstract

This disclosure relates to a data testing method and apparatus, computer program product, and electronic device, belonging to the field of computer technology. The method includes: acquiring a user's real-time request; performing network security interception on the real-time request to obtain an interception log; generating a test request dataset based on the interception log; inputting test request data from the test request dataset into a test environment; testing the test request data based on interception conditions in the test environment to obtain test results; optimizing the interception conditions based on the test results to obtain target interception conditions; and testing based on the target interception conditions to obtain test results. This disclosure reduces the cost of WAF testing and improves testing accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a data testing method and data testing apparatus, a computer program product, and an electronic device. Background Technology

[0002] In current web application security testing, WAF (Web Application Firewall) testing is a crucial task. Related technologies for WAF testing include the following two methods: First, manually constructing attack requests and asserting the test results. Second, deploying two environments—a baseline environment and a test environment—and directly introducing online traffic to compare the results between the two environments.

[0003] In the first method, manual construction and assertion are costly, and the results may differ significantly from real traffic. Furthermore, the limited test scale leads to low testing efficiency. In the second method, deploying two environments is costly, involves numerous dependencies, and requires manual judgment of the returned test results, increasing labor costs.

[0004] Therefore, a new data testing method is needed.

[0005] It should be noted that the information in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] This disclosure provides a data testing method, a data testing apparatus, a computer program product, and an electronic device, thereby overcoming, to at least a certain extent, the problems of high cost and low efficiency of WAF testing in related technologies due to limitations and defects in related technologies.

[0007] According to one aspect of this disclosure, a data testing method is provided, comprising:

[0008] The system acquires real-time user requests, performs network security interception on the real-time requests, obtains interception logs, and generates a test request dataset based on the interception logs.

[0009] The test request data in the test request dataset is input into the test environment, and the test request data is tested based on the interception conditions in the test environment to obtain the test results;

[0010] Based on the test results, the interception conditions are optimized to obtain the target interception conditions. Based on the target interception conditions, a test is conducted to obtain the test results.

[0011] In one exemplary embodiment of this disclosure, the step of performing network security interception on the real-time request to obtain an interception log, and generating a test request dataset based on the interception log, includes:

[0012] When the real-time request includes an attack request, the real-time request is intercepted, and interception information is generated;

[0013] The interception log is generated based on the request information of the intercepted real-time request and the interception information;

[0014] The test request dataset is generated based on the request information in the interception log.

[0015] In one exemplary embodiment of this disclosure, before inputting the test request data from the test request dataset into the test environment, the method further includes:

[0016] Obtain the first interception condition corresponding to the test request data, compare the first interception condition with the full interception condition, and determine the supplementary condition set;

[0017] The test request data is input into the target large language model, and the test request data is classified by the large language model to obtain a classification result; the classification result is a real request or an attack request.

[0018] The interception conditions in the supplementary condition set are input into the target large language model, and the target large language model generates a real-time request corresponding to the interception conditions in the supplementary condition set. The test request dataset is then updated based on the real-time request.

[0019] In one exemplary embodiment of this disclosure, test request data from the test request dataset is input into a test environment, and the test request data is tested based on the interception conditions in the test environment to obtain test results, including:

[0020] The test request data is input into the test environment to obtain the output results;

[0021] Determine the target test result corresponding to the classification result. When the output result of the test request data is the same as the target test result, the test request data passes the test.

[0022] The test request data fails the test if the output result of the test request data is different from the target test result.

[0023] In one exemplary embodiment of this disclosure, optimizing the interception conditions based on the test results to obtain target interception conditions includes:

[0024] When the test request data fails the test and the classification result corresponding to the test request data is an attack request, obtain the real-time request corresponding to the test request data that failed the test;

[0025] The real-time request is input into the target large language model, and a second interception condition corresponding to the real-time request is generated based on the target large language model.

[0026] The target interception condition is obtained by optimizing the interception condition based on the second interception condition.

[0027] In one exemplary embodiment of this disclosure, the method further includes:

[0028] A knowledge base is constructed based on the test request dataset and the target interception conditions. The large language model is trained based on the knowledge base to obtain the target large language model.

[0029] In one exemplary embodiment of this disclosure, the method further includes:

[0030] In response to the input data fed into the target large language model, the input data is identified to obtain keywords corresponding to the input data;

[0031] Based on the keywords, a search is performed in the knowledge base to obtain information related to the keywords, and an output answer corresponding to the input data is generated based on the information.

[0032] The output answers are evaluated and sorted to obtain the target output answer, which is then output as the output result.

[0033] In one exemplary embodiment of this disclosure, the input data includes interception conditions, and the output result corresponding to the interception conditions is an attack request that hits the interception conditions.

[0034] In one exemplary embodiment of this disclosure, when the input data is a real-time request and the real-time request is a genuine request, the output result corresponding to the real-time request is the classification result of the real-time request.

[0035] In one exemplary embodiment of this disclosure, when the input data is a real-time request and the real-time request is an attack request, the output result corresponding to the real-time request is the interception condition for intercepting the real-time request.

[0036] According to one aspect of this disclosure, a data testing apparatus is provided, comprising:

[0037] The test dataset generation module is used to acquire users' real-time requests, perform network security interception on the real-time requests, obtain interception logs, and generate a test request dataset based on the interception logs.

[0038] The test result acquisition module is used to input the test request data in the test request dataset into the test environment, test the test request data based on the interception conditions in the test environment, and obtain the test results;

[0039] The interception condition optimization module is used to optimize the interception conditions based on the test results to obtain target interception conditions, and to perform tests based on the target interception conditions to obtain test results.

[0040] According to one aspect of this disclosure, a computer program product is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in any of the exemplary embodiments described above.

[0041] According to one aspect of this disclosure, an electronic device is provided, comprising:

[0042] A processor; a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method described in any of the exemplary embodiments above by executing the executable instructions.

[0043] This disclosure provides a data testing method that involves acquiring real-time user requests, performing network security interception on the real-time requests to obtain interception logs, and generating a test request dataset based on the interception logs. The test request data in the test request dataset is then input into a test environment, and the test request data is tested based on interception conditions in the test environment to obtain test results. Based on the test results, the interception conditions are optimized to obtain target interception conditions, and testing is performed based on the target interception conditions to obtain test results. On one hand, acquiring real-time user requests, generating a test request dataset based on these requests, and inputting this dataset into a test environment for testing solves the problems of manually constructing attack requests and deploying two environments in related technologies, simplifying the testing process and reducing testing costs. On the other hand, after obtaining test results in the test environment, optimizing the interception conditions based on these results to obtain target interception conditions, and then testing again in the test environment based on these target interception conditions, avoids manual judgment, achieves automatic optimization of interception conditions, and improves testing accuracy.

[0044] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0046] Figure 1 The flowchart illustrates a data testing method according to an example embodiment of the present disclosure.

[0047] Figure 2 The diagram illustrates a data testing system according to an exemplary embodiment of the present disclosure.

[0048] Figure 3 The flowchart illustrates a method for performing network security interception on real-time requests, obtaining interception logs, and generating a test request dataset based on the interception logs, according to an example embodiment of the present disclosure.

[0049] Figure 4 The flowchart illustrates a data testing method according to an example embodiment of the present disclosure, prior to inputting test request data from a test request dataset into a test environment.

[0050] Figure 5 The illustrative output is a flowchart of a method according to an example embodiment of the present disclosure, in which test request data from the test request dataset is input into a test environment, and the test request data is tested based on the interception conditions in the test environment to obtain test results.

[0051] Figure 6 The schematic output is a flowchart of a method for optimizing the interception conditions based on the test results to obtain target interception conditions according to an example embodiment of the present disclosure.

[0052] Figure 7 The flowchart of a data testing method according to an exemplary embodiment of the present disclosure is shown as an illustrative output.

[0053] Figure 8 A block diagram of a data testing apparatus according to an exemplary embodiment of the present disclosure is shown schematically.

[0054] Figure 9 An electronic device for implementing a data testing method according to an exemplary embodiment of the present invention is illustrated schematically. Detailed Implementation

[0055] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make the invention more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention may be practiced with one or more of these specific details omitted, or other methods, components, apparatus, steps, etc., may be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the invention.

[0056] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0057] In current web application security testing, WAF testing is a crucial task. Traditional WAF testing methods mainly include the following two: Method 1: Manually constructing attack requests, then asserting the returned results to observe whether they conform to the rules for blocking attack requests. Method 2: Deploying two environments, namely a baseline environment and a test environment, directly introducing online traffic, and verifying the test effect by comparing the differences in the results of the two environments.

[0058] The method of manually constructing attack requests has the following problems: First, the cost of manually constructing and asserting is high, and there may be a large difference between the actual traffic and real traffic; second, the testing scale is limited, and it is difficult to cope with the frequent changes in online interception conditions; in addition, as the interception conditions are iteratively updated, the maintenance cost will increase significantly, and there is a lack of testing for false interception scenarios.

[0059] While traffic ingress methods are closer to reality, they also have the following problems: First, they require the deployment of two environments and related backend data, resulting in high maintenance costs and numerous dependencies; second, the analysis of differences in returned results requires manual judgment, increasing labor costs; furthermore, for requests with no differences, it is impossible to determine whether there are false or missed interceptions, and one can only rely on the baseline, but in a real production environment, the baseline may not be completely accurate, leading to inaccurate test results; finally, online traffic often cannot completely cover all interception conditions, resulting in some interception conditions not being tested, affecting the completeness of the test.

[0060] Based on one or more of the above-mentioned problems, this example embodiment first provides a data testing method, referring to... Figure 1 As shown, the data testing method may include the following steps:

[0061] Step S110. Obtain the user's real-time request, perform network security interception on the real-time request, obtain the interception log, and generate a test request dataset based on the interception log;

[0062] Step S120. Input the test request data in the test request dataset into the test environment, test the test request data based on the interception conditions in the test environment, and obtain the test results;

[0063] Step S130. Optimize the interception conditions based on the test results to obtain target interception conditions, and perform tests based on the target interception conditions to obtain test results.

[0064] The aforementioned data testing method involves acquiring real-time user requests, performing network security interception on these requests to obtain interception logs, and generating a test request dataset based on these logs. The test request data from this dataset is then input into a test environment, and the data is tested based on interception conditions within that environment to obtain test results. Based on these test results, the interception conditions are optimized to obtain target interception conditions, which are then tested again to obtain further test results. On one hand, acquiring real-time user requests, generating a test request dataset, and inputting this dataset into a test environment for testing solves the problems of manually constructing attack requests and deploying two separate environments in related technologies, simplifying the testing process and reducing testing costs. On the other hand, after obtaining test results in the test environment, optimizing the interception conditions to obtain target interception conditions, and then testing again in the test environment based on these target conditions, avoids manual judgment, achieves automatic optimization of interception conditions, and improves testing accuracy.

[0065] Figure 2 A data testing system according to an example embodiment of this disclosure is illustrated, comprising: a service layer 210, an application layer 220, a data persistence layer 230, a data layer 240, and a large language model layer 250. The service layer 210 provides a user-friendly web platform and RESTful API interfaces for easy access to and retrieval of test results, and also allows sending questions to the large language model. The web platform is implemented using Grado (a Python library for building fast web interfaces), and the RESTful API interfaces are implemented using FastAPI. The application layer 220 encapsulates the base class for LangChain (a framework for developing language model-driven applications) to retrieve question-and-answer chains, supports rapid switching between the large language model by configuring different model parameters, and can query and process content in the database, ensuring efficient operation of the large language model and accurate data transmission. The data persistence layer 230 uses Chroma to store embedded knowledge base data, process metadata, and implement the persistence of vector data, which helps maintain stability and efficiency when the data scale is large. Chroma is a local vector database that provides `persist_directory` to set the persistent directory for data storage. Reading only requires calling the `from_document` method. Data layer 240 contains knowledge base data, such as source data in PDF, TXT, and MD formats. It uses the M3E-Large text embedding model to process the data and generate vector representations usable by the vector database. This data primarily originates from labeled attack request datasets, ordinary request datasets, and WAF interception conditions. The large language model layer 250 encapsulates the calling of large language models based on the large language model API, allowing users to access different models through a unified entry point and method. It supports switching between models at any time, and can call the service layer API to obtain test request data and return codes. The returned results can then be further integrated and processed into standard test cases.

[0066] The following will combine Figure 2 The steps involved in the data testing method of the example embodiments of this disclosure will be explained and described in detail.

[0067] In step S110, the user's real-time request is obtained, the real-time request is intercepted by network security, an interception log is obtained, and a test request dataset is generated based on the interception log.

[0068] In this example embodiment, the user's real-time request is a request initiated by the user based on a webpage. This user's real-time request is a real-time request in a production environment. The user's request can be a normal data request or an attack request containing malicious intent. A normal data request is a request for the user to access the system normally or use system functions, while an attack request typically aims to damage, abuse, or steal system data. In the production environment, the user's real-time request passes through an online WAF. When the user's real-time request includes an attack request, the WAF will intercept the user's real-time request and return an error code.

[0069] In this example embodiment, reference Figure 3 As shown, the real-time request is intercepted via network security to obtain an interception log, and a test request dataset is generated based on the interception log, including:

[0070] Step S310. When the real-time request includes an attack request, the real-time request is intercepted, and interception information is generated;

[0071] Step S320. Generate the interception log based on the request information of the intercepted real-time request and the interception information;

[0072] Step S330. Generate the test request dataset based on the request information in the interception log.

[0073] The following will further explain and illustrate steps S310-S330. Specifically, the user's real-time request is acquired, and the real-time request is judged based on the WAF interception conditions in the production environment. When the user's real-time request contains an attack request, the real-time request is intercepted and an error code is returned, generating interception information. This interception information may include the identifier of the interception condition hit by the real-time request and the hit location, etc. In this example embodiment, the interception information is not specifically limited. After generating the interception information, an interception log is generated based on the interception information and the request information in the real-time request. The request information may include the request type, URL (Uniform Resource Locator), request headers, and request body. In this example embodiment, the request information is not specifically limited. The information included in the interception log can be extracted based on a preset time, and a test request dataset is generated based on the extracted data. The preset time can be a fixed time period, which can be 30 minutes or 1 hour. In this example embodiment, the fixed time period is not specifically limited. When extracting from the interception logs, attack request information can be extracted from the interception logs, and a test request dataset can be generated based on the extracted attack request information.

[0074] In step S120, the test request data in the test request dataset is input into the test environment, and the test request data is tested based on the interception conditions in the test environment to obtain the test results.

[0075] In this example embodiment, after obtaining the test request dataset, the test request data included in the test request dataset can be input into the test environment for testing. The test request data is intercepted based on the interception conditions to obtain the test results.

[0076] In this example embodiment, reference Figure 4 As shown, before inputting the test request data from the test request dataset into the test environment, the method further includes:

[0077] Step S410. Obtain the first interception condition corresponding to the test request data, compare the first interception condition with the full interception condition, and determine the supplementary condition set;

[0078] Step S420. Input the test request data into the target large language model, and classify the test request data through the large language model to obtain a classification result; the classification result is a real request or an attack request;

[0079] Step S430. Input the interception conditions in the supplementary condition set into the target large language model, generate a real-time request corresponding to the interception conditions in the supplementary condition set through the target large language model, and update the test request dataset based on the real-time request.

[0080] The following will further explain and illustrate steps S410-S430. Specifically, after extracting the test request dataset from the interception log, a first interception condition corresponding to the test request data included in the test request dataset is obtained. This first interception condition is compared with all interception conditions to obtain the uncovered interception conditions. A supplementary condition set is obtained based on these uncovered interception conditions. The interception conditions included in the supplementary condition set are input into the target large language model. The target large language model generates a real-time request corresponding to the interception conditions in the supplementary condition set, and the test request dataset is updated using this real-time request. The interception conditions include condition name, hit position, matching method, and regular expression, etc., which are not specifically limited in this example embodiment.

[0081] Furthermore, the test request data included in the test request dataset can be input into the target large language model. The target large language model can then judge the test request data to determine whether it is an attack request. That is, the target large language model can classify the test request data to obtain a classification result. This classification result can indicate whether the real-time request corresponding to the test request data is a real request or an attack request.

[0082] In this example embodiment, reference Figure 5 As shown, the test request data from the test request dataset is input into the test environment, and the test request data is tested based on the interception conditions in the test environment to obtain test results, including:

[0083] Step S510. Input the test request data into the test environment and obtain the output result;

[0084] Step S520. Determine the target test result corresponding to the classification result. When the output result of the test request data is the same as the target test result, the test request data passes the test.

[0085] Step S530. When the output result of the test request data is different from the target test result, the test request data fails the test.

[0086] The following will further explain and illustrate steps S510-S530. Specifically, because the classification results of the test request data are different, the values ​​returned by the test environment will also be different when the test request data is input into the test environment. When the test request data is input into the test environment, a WAF interception condition exists in the test environment. Based on the interception condition, the input test request data is intercepted, and the output result of each test request data is obtained. After obtaining the output result, an automatic assertion of the return code is performed on the output result to determine the target test result corresponding to the classification result of the test request data. When the return code of the output result of the test request data is the same as the target test result, the test request data passes the test; when the return code of the output result of the test request data is different from the target test result, the test request data fails the test.

[0087] For example, when a real-time request is a normal request, the target test result for the corresponding test request data in this test environment should be 200; when a real-time request is an attack request, the target test result for the corresponding test request data in this test environment should be 444. Therefore, if test request data classified as a normal request is input into the test environment and the output result is not 200, the test request data fails the test; similarly, if test request data classified as an attack request is input into the test environment and the output result is not 444, the test request data fails the test.

[0088] In step S130, the interception conditions are optimized based on the test results to obtain target interception conditions, and tests are performed based on the target interception conditions to obtain test results.

[0089] In this example embodiment, after obtaining the test results of the test request data, the interception conditions can be optimized based on the test results to obtain the target interception conditions. After obtaining the target interception conditions, the test can be performed based on the target interception conditions.

[0090] refer to Figure 6 As shown, the optimization of the interception conditions based on the test results to obtain the target interception conditions includes:

[0091] Step S610. When the test request data fails the test and the classification result corresponding to the test request data is an attack request, obtain the real-time request corresponding to the test request data that failed the test;

[0092] Step S620. Input the real-time request into the target large language model, and generate a second interception condition corresponding to the real-time request based on the target large language model;

[0093] Step S630. Optimize the interception conditions based on the second interception conditions to obtain the target interception conditions.

[0094] The following will further explain and illustrate steps S610-S630. Specifically, when the test request data fails the test in the test environment and the real-time request corresponding to the test request data is an attack request, the real-time request corresponding to the test request data is obtained. The obtained real-time request is input into the target large language model. Based on the target large language model, a second interception condition corresponding to the real-time request is generated. After the second interception condition is generated, the interception condition is optimized based on the second interception condition to obtain the target interception condition. Optimizing the interception condition using the second interception condition can be done by directly adding the second interception condition to the interception condition. In this example embodiment, the optimization method is not specifically limited.

[0095] Furthermore, in this example embodiment, the data testing method further includes: constructing a knowledge base based on the test request dataset and the target interception conditions, and training a large language model based on the knowledge base to obtain the target large language model.

[0096] Specifically, the test request data can be source data in formats such as PDF, TXT, and MD. After obtaining the test request dataset and target interception data, the M3E-Large text embedding model (Embedding API) can be used to process the test request data, generating vector representations that can be used by a vector database. A knowledge base is then constructed based on the processed vector representations. In building this knowledge base, attack request data in the test request data are black samples, and ordinary request data are white samples. These black and white samples are derived from labeled real online requests.

[0097] After obtaining the knowledge base, the large language model can be trained using the sample data included in the knowledge base to obtain the target large language model. The large language model can be ChatGPT, Bing Chat, etc., but this example embodiment does not specifically limit the large language model.

[0098] In this example embodiment, reference Figure 7 As shown, the data testing methods also include:

[0099] Step S710. In response to the input data input to the target large language model, identify the input data to obtain the keywords corresponding to the input data;

[0100] Step S720. Based on the keywords, search the knowledge base to obtain information related to the keywords, and generate an output answer corresponding to the input data based on the information;

[0101] Step S730. Evaluate and sort the output answers to obtain the target output answer, and output the target output answer as the output result.

[0102] The following will further explain and illustrate steps S710-S730. Specifically, in response to the input data fed into the target large language model, the target large language model can identify, understand, and analyze the input data based on the application layer's retrieval question-answering chain to obtain keywords corresponding to the input data. These keywords can be the type or semantics of the input data; in this example embodiment, no specific limitation is made on the keywords. After obtaining the keywords, relevant information is retrieved from a pre-built knowledge base to obtain information related to the keywords. Based on the retrieved information related to the keywords, an output answer corresponding to the input data is generated. There can be multiple output answers. After obtaining the output answers, these multiple output answers can be evaluated and ranked. The output answer with the highest similarity or logical consistency to the input data is determined as the target output answer, and this target output answer is output as the result.

[0103] In this example embodiment, the input data can be either an interception condition or a real-time request. When the input data is an interception condition, the output result corresponding to the interception condition is an attack request that hits the interception condition.

[0104] Specifically, when the input data is an interception condition, the target large language model searches the knowledge base based on the input interception condition to obtain information related to the interception condition. This related information can be attack requests that hit the interception condition. After obtaining the information related to the interception condition, the attack requests that hit the interception condition can be output as the output result. The output attack request includes the request type, URL, request headers, and request body, etc., which are not specifically limited in this example embodiment. The output attack request is a simulated real-time request.

[0105] When the input data is a real-time request, and that real-time request is a genuine request, the output result corresponding to the real-time request is the classification result of that real-time request. Specifically, when the input data is genuine request data, the output result of the target large language model is the classification result of that real-time request.

[0106] When the input data is a real-time request, and this real-time request is an attack request, the output result corresponding to the real-time request is the interception condition for intercepting the real-time request. Specifically, when the input data is an attack request, the target large language model searches the knowledge base based on the input attack request to obtain information related to the attack request. This information can serve as the interception condition for intercepting the attack request. After obtaining the interception condition, the interception condition can be output as an result. The output interception condition includes the interception location, interception type, regular expression, etc., but in this example embodiment, the output interception condition is not specifically limited.

[0107] The data testing method provided in this exemplary embodiment has at least the following advantages: Firstly, it acquires real-time user requests, generates a test request dataset based on these requests, and inputs this dataset into a test environment for testing. This solves the problems of manually constructing attack requests and deploying two environments in related technologies, simplifying the testing process and reducing testing costs. Secondly, after obtaining test results in the test environment, it optimizes the interception conditions based on these results to obtain target interception conditions. When testing again in the test environment, it performs testing based on these target interception conditions, avoiding manual judgment and achieving automatic optimization of the interception conditions, thus improving testing accuracy.

[0108] This disclosure also provides a data testing apparatus, with reference to exemplary embodiments thereof. Figure 8 As shown, it may include: a test dataset generation module 810, a test result acquisition module 820, and an interception condition optimization module 830. Wherein:

[0109] The test dataset generation module 810 is used to acquire users' real-time requests, perform network security interception on the real-time requests, obtain interception logs, and generate a test request dataset based on the interception logs.

[0110] The test result acquisition module 820 is used to input the test request data in the test request dataset into the test environment, test the test request data based on the interception conditions in the test environment, and obtain the test result;

[0111] The interception condition optimization module 830 is used to optimize the interception conditions based on the test results to obtain target interception conditions, and to perform tests based on the target interception conditions to obtain test results.

[0112] The specific details of each module in the aforementioned data testing device have been described in detail in the corresponding data testing methods, so they will not be repeated here.

[0113] In one exemplary embodiment of this disclosure, the test dataset generation module includes:

[0114] The interception information generation module is used to intercept the real-time request and generate interception information when the real-time request includes an attack request.

[0115] An interception log generation module is used to generate the interception log based on the request information of the intercepted real-time request and the interception information;

[0116] The dataset generation module is used to generate the test request dataset based on the request information in the interception log.

[0117] In one exemplary embodiment of this disclosure, the test result acquisition module further includes:

[0118] The supplementary condition set determination module is used to obtain the first interception condition corresponding to the test request data, compare the first interception condition with the full interception condition, and determine the supplementary condition set.

[0119] The data classification module is used to input the test request data into the target large language model, classify the test request data through the large language model, and obtain a classification result; the classification result is a real request or an attack request.

[0120] The dataset update module is used to input the interception conditions in the supplementary condition set into the target large language model, generate real-time requests corresponding to the interception conditions in the supplementary condition set through the target large language model, and update the test request dataset based on the real-time requests.

[0121] In one exemplary embodiment of this disclosure, the test result acquisition module includes:

[0122] The result output module is used to input the test request data into the test environment and obtain the output result.

[0123] The test pass module is used to determine the target test result corresponding to the classification result. When the output result of the test request data is the same as the target test result, the test request data passes the test.

[0124] The test failure module is used to indicate that the test request data fails the test when the output result of the test request data is different from the target test result.

[0125] In one exemplary embodiment of this disclosure, the interception condition optimization module includes:

[0126] The real-time request acquisition module is used to acquire the real-time request corresponding to the test request data that failed the test when the test request data fails the test and the classification structure corresponding to the test request data is an attack request.

[0127] An interception condition generation module is used to input the real-time request into the target large language model and generate a second interception condition corresponding to the real-time request based on the target large language model.

[0128] The target interception condition determination module is used to optimize the interception condition based on the second interception condition to obtain the target interception condition.

[0129] In one exemplary embodiment of this disclosure, the data testing apparatus further includes:

[0130] The model training module is used to construct a knowledge base based on the test request dataset and the target interception conditions, and to train the large language model based on the knowledge base to obtain the target large language model.

[0131] In one exemplary embodiment of this disclosure, the data testing apparatus further includes:

[0132] The keyword determination module is used to respond to the input data input to the target large language model, identify the input data, and obtain the keywords corresponding to the input data;

[0133] The output answer generation module is used to search the knowledge base based on the keywords, obtain information related to the keywords, and generate an output answer corresponding to the input data based on the information.

[0134] The result output module is used to evaluate and sort the output answers to obtain the target output answer, and output the target output answer as the output result.

[0135] In one exemplary embodiment of this disclosure, the input data includes interception conditions, and the output result corresponding to the interception conditions is an attack request that hits the interception conditions.

[0136] In one exemplary embodiment of this disclosure, when the input data is a real-time request and the real-time request is a genuine request, the output result corresponding to the real-time request is the classification result of the real-time request.

[0137] In one exemplary embodiment of this disclosure, when the input data is a real-time request and the real-time request is an attack request, the output result corresponding to the real-time request is the interception condition for intercepting the real-time request.

[0138] It should be noted that although several modules or units of the device for performing actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0139] Furthermore, although the steps of the method in this invention are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0140] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above-described method is also provided.

[0141] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as “circuits,” “modules,” or “systems.”

[0142] The following reference Figure 9 To describe an electronic device 900 according to this embodiment of the present invention. Figure 9 The electronic device 900 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0143] like Figure 9 As shown, the electronic device 900 is manifested in the form of a general-purpose computing device. The components of the electronic device 900 may include, but are not limited to: at least one processing unit 910, at least one storage unit 920, a bus 930 connecting different system components (including storage unit 920 and processing unit 910), and a display unit 940.

[0144] The storage unit stores program code that can be executed by the processing unit 910, causing the processing unit 910 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 910 can perform actions such as... Figure 1The steps shown are as follows: S110: Obtain the user's real-time request, perform network security interception on the real-time request, obtain the interception log, and generate a test request dataset based on the interception log; S120: Input the test request data in the test request dataset into the test environment, test the test request data based on the interception conditions in the test environment, and obtain the test results; S130: Optimize the interception conditions based on the test results to obtain the target interception conditions, and test based on the target interception conditions to obtain the test results.

[0145] Storage unit 920 may include readable media in the form of volatile storage units, such as random access memory (RAM) 9201 and / or cache memory 9202, and may further include read-only memory (ROM) 9203.

[0146] Storage unit 920 may also include a program / utility 9204 having a set (at least one) program module 9205, such program module 9205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0147] Bus 930 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0148] Electronic device 900 can also communicate with one or more external devices 1000 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 900, and / or with any device that enables electronic device 900 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 950. Furthermore, electronic device 900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 960. As shown, network adapter 960 communicates with other modules of electronic device 900 via bus 930. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems.

[0149] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the method according to the embodiments of the present invention.

[0150] In exemplary embodiments of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the present invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.

[0151] According to embodiments of the present invention, a program product for implementing the above-described method may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0152] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0153] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0154] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF (Radio Frequency), etc., or any suitable combination thereof.

[0155] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0156] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0157] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention described herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not invented herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.

Claims

1. A data testing method, characterized in that, include: The system acquires real-time user requests, performs network security interception on the real-time requests, obtains interception logs, and generates a test request dataset based on the interception logs. The test request data in the test request dataset is input into the test environment, and the test request data is tested based on the interception conditions in the test environment to obtain the test results; Based on the test results, the interception conditions are optimized to obtain the target interception conditions. Based on the target interception conditions, a test is conducted to obtain the test results.

2. The method according to claim 1, characterized in that, The process of intercepting the real-time request via network security, obtaining interception logs, and generating a test request dataset based on the interception logs includes: When the real-time request includes an attack request, the real-time request is intercepted, and interception information is generated; The interception log is generated based on the request information of the intercepted real-time request and the interception information; The test request dataset is generated based on the request information in the interception log.

3. The method according to claim 1, characterized in that, Before inputting the test request data from the test request dataset into the test environment, the method further includes: Obtain the first interception condition corresponding to the test request data, compare the first interception condition with the full interception condition, and determine the supplementary condition set; The test request data is input into the target large language model, and the test request data is classified by the large language model to obtain a classification result; the classification result is a real request or an attack request. The interception conditions in the supplementary condition set are input into the target large language model, and the target large language model generates a real-time request corresponding to the interception conditions in the supplementary condition set. The test request dataset is then updated based on the real-time request.

4. The method according to claim 3, characterized in that, The test request data from the test request dataset is input into the test environment, and the test request data is tested based on the interception conditions in the test environment to obtain test results, including: The test request data is input into the test environment to obtain the output results; Determine the target test result corresponding to the classification result. When the output result of the test request data is the same as the target test result, the test request data passes the test. The test request data fails the test if the output result of the test request data is different from the target test result.

5. The method according to claim 4, characterized in that, The optimization of the interception conditions based on the test results to obtain the target interception conditions includes: When the test request data fails the test and the classification result corresponding to the test request data is an attack request, obtain the real-time request corresponding to the test request data that failed the test; The real-time request is input into the target large language model, and a second interception condition corresponding to the real-time request is generated based on the target large language model. The target interception condition is obtained by optimizing the interception condition based on the second interception condition.

6. The method according to claim 3 or 5, characterized in that, The method further includes: A knowledge base is constructed based on the test request dataset and the target interception conditions. The large language model is trained based on the knowledge base to obtain the target large language model.

7. The method according to claim 6, characterized in that, The method further includes: In response to the input data fed into the target large language model, the input data is identified to obtain keywords corresponding to the input data; Based on the keywords, a search is performed in the knowledge base to obtain information related to the keywords, and an output answer corresponding to the input data is generated based on the information. The output answers are evaluated and sorted to obtain the target output answer, which is then output as the output result.

8. The method according to claim 7, characterized in that, The input data includes interception conditions, and the output result corresponding to the interception conditions is an attack request that hits the interception conditions.

9. The method according to claim 7, characterized in that, When the input data is a real-time request and the real-time request is a genuine request, the output result corresponding to the real-time request is the classification result of the real-time request.

10. The method according to claim 7, characterized in that, When the input data is a real-time request and the real-time request is an attack request, the output result corresponding to the real-time request is the interception condition for intercepting the real-time request.

11. A data testing device, characterized in that, include: The test dataset generation module is used to acquire users' real-time requests, perform network security interception on the real-time requests, obtain interception logs, and generate a test request dataset based on the interception logs. The test result acquisition module is used to input the test request data in the test request dataset into the test environment, test the test request data based on the interception conditions in the test environment, and obtain the test results; The interception condition optimization module is used to optimize the interception conditions based on the test results to obtain target interception conditions, and to perform tests based on the target interception conditions to obtain test results.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processing unit, it implements the method described in any one of claims 1-10.

13. An electronic device, characterized in that, include: Processing unit; A storage unit for storing the executable instructions of the processing unit; The processing unit is configured to execute the method of any one of claims 1-10 by executing the executable instructions.