CN112685301A - Fuzzy test method and device - Google Patents

Fuzzy test method and device Download PDF

Info

Publication number
CN112685301A
CN112685301A CN202011583668.5A CN202011583668A CN112685301A CN 112685301 A CN112685301 A CN 112685301A CN 202011583668 A CN202011583668 A CN 202011583668A CN 112685301 A CN112685301 A CN 112685301A
Authority
CN
China
Prior art keywords
message
client
test
agent
tested
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011583668.5A
Other languages
Chinese (zh)
Inventor
杨峥
张志群
李树艳
屠昌乐
戴思雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Guoli Network Security Technology Co ltd
Original Assignee
Zhejiang Guoli Network Security Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Guoli Network Security Technology Co ltd filed Critical Zhejiang Guoli Network Security Technology Co ltd
Priority to CN202011583668.5A priority Critical patent/CN112685301A/en
Publication of CN112685301A publication Critical patent/CN112685301A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a fuzzy test method and a device, wherein the method comprises the following steps: the test agent is connected with the driver, and triggers the client to be tested to send a request message to the test agent through the driver; analyzing the request message to determine a first message type; determining a first message configuration strategy corresponding to the first message type, constructing an agent request message based on the first message configuration strategy, and sending the agent request message to an accompanied test server, wherein the accompanied test server returns a response message; analyzing the response message to determine a second message type; determining a second message configuration strategy corresponding to the second message type, constructing an agent response message based on the second message configuration strategy and sending the agent response message to the client to be tested, wherein the agent response message is used for testing the client; and determining the test result of the client to be tested according to the client running state returned by the driver. By applying the method, the client is fuzzed when the client interacts with the server, and the feasibility, the configurability and the flexibility of realizing the automatic fuzzing are provided.

Description

Fuzzy test method and device
Technical Field
The invention relates to the technical field of fuzz testing, in particular to a fuzz testing method.
Background
With the rapid development and wide application of information technology, computer networks have penetrated into various parts of people's lives, and the progress of people's lives is more and more dependent on the high efficiency, safety and stability of networks. An important premise for guaranteeing network security is to mine and repair software bugs in a system, and the software bugs are mined more by software testing.
The fuzzy test is the most common vulnerability mining method at present, and is a method for discovering software vulnerabilities by providing unexpected input to a target system and monitoring an abnormal result, and the purpose of the network protocol fuzzy test is to discover the vulnerabilities of interaction and analysis of a network protocol. The prior art methods of passing fuzz testing are mainly based on variant fuzz testing. The fuzzy test method based on variation mainly comprises the steps of grabbing legal protocol data through a sniffer, carrying out variation on the protocol data, and sending the protocol data to an opposite terminal needing to carry out fuzzy test. However, the existing fuzz test usually only tests the server, and the fuzz test for the client does not exist, especially the fuzz test for the interaction process at the client.
Disclosure of Invention
In view of this, the present invention provides a fuzz testing method, by which a fuzz test on a client can be implemented when the client interacts with a server, and feasibility, configurability, and flexibility of implementing an automated fuzz test are provided.
The invention also provides a fuzzy testing device which is used for ensuring the realization and the application of the method in practice.
A fuzz testing method comprising:
when the client to be tested needs to be subjected to the fuzzy test, a driver arranged in the client to be tested is connected;
sending a test command to the driver, so that the driver triggers the client to be tested to send a request message for interacting with the test assistant server to the test agent based on the test command;
analyzing the request message and determining a first message type of the request message;
determining a preset first message configuration strategy corresponding to the first message type, and constructing an agent request message corresponding to the request message based on the first message configuration strategy;
sending the agent request message to the test assistant server, so that the test assistant server returns a response message corresponding to the agent request message;
analyzing the response message and determining a second message type of the response message;
determining a preset second message configuration strategy corresponding to the second message type, constructing an agent response message corresponding to the response message based on the second message configuration strategy, and sending the agent response message to the client to be tested so as to test the client to be tested through the agent response message;
and receiving the client running state corresponding to the client to be tested returned by the driver, so as to determine the test result of the client to be tested according to the client running state.
Optionally, in the method, constructing the proxy request packet corresponding to the first packet type based on the first packet configuration policy includes:
acquiring a first random function corresponding to the first message configuration strategy, and determining a field type associated with the first random function;
determining each first protocol layer in the request message, and acquiring each first field in each first protocol layer;
determining the field type of each first field, and selecting a first target field from each first field, wherein the field type of the first target field is consistent with the field type associated with the first random function;
and applying the first random function to replace the first target field so as to construct an agent request message corresponding to the request message.
Optionally, in the method, constructing the proxy response packet corresponding to the response packet based on the second packet configuration policy includes:
acquiring a second random function corresponding to the second message configuration strategy, and determining a field type associated with the second random function;
determining each second protocol layer in the response message, and acquiring each second field in each second protocol layer;
determining the field type of each second field, and selecting a second target field from each second field, wherein the field type of the second target field is consistent with the field type associated with the second random function;
and applying the second random function to replace the second target field so as to construct a proxy response message corresponding to the response message.
Optionally, the sending the agent request packet to the test assistant server in the method includes:
acquiring a preset communication protocol between the client to be tested and the test accompanying server;
generating a proxy client corresponding to the client to be tested and a proxy server corresponding to the test server in the test proxy based on the communication protocol;
and sending the agent request message to the agent client, and sending the agent request message to the accompany measurement server through the agent client.
Optionally, the sending the proxy response packet to the client to be tested includes:
and sending the proxy request message to the client to be tested by the proxy server in the process of sending the proxy response message.
A fuzz testing apparatus, the apparatus being applied to a test agent, the apparatus comprising:
the device comprises a connecting unit, a driver and a control unit, wherein the connecting unit is used for connecting the driver arranged in the client to be tested when the client to be tested needs to be subjected to the fuzzy test;
the triggering unit is used for sending a test command to the driver so that the driver triggers the client to be tested to send a request message for interacting with the test assistant server to the test agent based on the test command;
the first analysis unit is used for analyzing the request message and determining a first message type of the request message;
the constructing unit is used for determining a preset first message configuration strategy corresponding to the first message type and constructing an agent request message corresponding to the request message based on the first message configuration strategy;
the first sending unit is used for sending the agent request message to the test assistant server so that the test assistant server returns a response message corresponding to the agent request message;
the second analysis unit is used for analyzing the response message and determining a second message type of the response message;
the second sending unit is used for determining a preset second message configuration strategy corresponding to the second message type, constructing an agent response message corresponding to the response message based on the second message configuration strategy, and sending the agent response message to the client to be tested so as to test the client to be tested through the agent response message;
and the receiving unit is used for receiving the client running state corresponding to the client to be tested, which is returned by the driver, so as to determine the test result of the client to be tested according to the client running state.
The above apparatus, optionally, the construction unit, comprises:
a first obtaining subunit, configured to obtain a first random function corresponding to the first packet configuration policy, and determine a field type associated with the first random function;
a first determining subunit, configured to determine each first protocol layer in the request message, and obtain each first field in each first protocol layer;
the first selecting subunit is configured to determine a field type of each first field, and select a first target field from each first field, where the field type of the first target field is consistent with the field type associated with the first random function;
and the first constructing subunit is used for applying the first random function to replace the first target field so as to construct an agent request message corresponding to the request message.
The above apparatus, optionally, the second sending unit includes:
a second obtaining subunit, configured to obtain a second random function corresponding to the second packet configuration policy, and determine a field type associated with the second random function;
a second determining subunit, configured to determine each second protocol layer in the response message, and obtain each second field in each second protocol layer;
a second selecting subunit, configured to determine a field type of each second field, and select a second target field from each second field, where the field type of the second target field is consistent with the field type associated with the second random function;
and the second constructing subunit is used for applying the second random function to replace the second target field so as to construct a proxy response message corresponding to the response message.
The above apparatus, optionally, the first sending unit includes:
the third acquisition subunit is used for acquiring a preset communication protocol between the client to be tested and the test accompanying server;
a generating subunit, configured to generate, in the test agent, an agent client corresponding to the client to be tested and an agent server corresponding to the test assistant server based on the communication protocol;
and the first sending subunit is configured to send the agent request packet to the agent client, and send the agent request packet to the measurement assistant server via the agent client.
The above apparatus, optionally, the second sending unit includes:
and the second sending subunit is configured to send the proxy request packet to the client to be tested via the proxy server while sending the proxy response packet to the proxy server.
A storage medium comprising stored instructions, wherein the instructions, when executed, control a device in which the storage medium is located to perform the fuzz testing method described above.
An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the fuzz testing method described above.
Compared with the prior art, the invention has the following advantages:
the invention provides a fuzzy test method, which comprises the following steps: when the client to be tested needs to be subjected to the fuzzy test, a driver arranged in the client to be tested is connected; sending a test command to the driver, so that the driver triggers the client to be tested to send a request message for interacting with the test assistant server to the test agent based on the test command; analyzing the request message and determining a first message type of the request message; determining a preset first message configuration strategy corresponding to the first message type, and constructing an agent request message corresponding to the request message based on the first message configuration strategy; sending the agent request message to the test assistant server, so that the test assistant server returns a response message corresponding to the agent request message; analyzing the response message and determining a second message type of the response message; determining a preset second message configuration strategy corresponding to the second message type, constructing an agent response message corresponding to the response message based on the second message configuration strategy, and sending the agent response message to the client to be tested so as to test the client to be tested through the agent response message; and receiving the client running state corresponding to the client to be tested returned by the driver, so as to determine the test result of the client to be tested according to the client running state. By applying the method provided by the invention, the client-side fuzz test can be realized when the client-side and the server are interacted, and the feasibility, configurability and flexibility of realizing the automatic fuzz test are provided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flowchart of a method of a fuzzy testing method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a fuzzy test system according to an embodiment of the present invention;
FIG. 3 is a flowchart of another method of a fuzzy testing method according to an embodiment of the present invention;
FIG. 4 is a flowchart of another method of a fuzzy testing method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of another structure of a fuzzy test system according to an embodiment of the present invention;
FIG. 6 is a block diagram of a fuzzy testing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions, and the terms "comprises", "comprising", or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The invention is operational with numerous general purpose or special purpose computing device environments or configurations. For example: personal computers, companion server computers, hand-held or portable devices, tablet-type devices, multi-processor devices, distributed computing environments that include any of the above devices or equipment, and the like.
The embodiment of the invention provides a fuzzy test method, which is applied to a test agent, wherein the test agent is connected with a client to be tested and an accompanying test server, and is used for carrying out fuzzy test on the client to be tested in the interaction process of the client to be tested and the accompanying test server, and the method comprises the following steps:
s101: and when the client to be tested needs to be subjected to the fuzzy test, connecting a driver arranged in the client to be tested.
In the embodiment of the present invention, as shown in fig. 2, the client 200 to be tested is client software that needs to perform the fuzz test. The test server 300 is a mature server software, and provides the data and environment of the server. The driver 201 is a driver provided in the client, and is used for realizing the automation operation of the client and the acquisition of information. The test agent 400 is middleware between the client to be tested and the server under test, and supports network IO access, message parsing, message processing, test configuration, session management, message sniffing, message sending, and a message processing library depending on the bottom layer.
Specifically, when the client needs to be fuzz tested, the driver of the client is connected through remote procedure call.
S102: and sending a test command to the driver, so that the driver triggers the client to be tested to send a request message for interacting with the test assistant server to the test agent based on the test command.
In the embodiment of the invention, before the client is subjected to the fuzzy test, the service to be tested cannot acquire the structure of the message in the client to be tested, the client driver is called through a remote process, the driver is started, the client to be tested is accessed, the server address of the server accompanied with the test is configured to point to the test agent, and the client to be tested is triggered to send the request message to the test agent.
The test agent is connected with the client to be tested through an IO interface, and sniffing of the message of the client to be tested by the test agent is achieved.
S103: and analyzing the request message and determining a first message type of the request message.
In the embodiment of the invention, the test agent analyzes the request message, acquires the message request content, determines the message type of the request message according to the session management strategy set in the test agent, and determines the message type of the request message as the first message type.
Optionally, after analyzing the request message, the test agent obtains a corresponding request message protocol layer architecture through the analyzed request message.
S104: and determining a preset first message configuration strategy corresponding to the first message type, and constructing an agent request message corresponding to the request message based on the first message configuration strategy.
In the embodiment of the invention, at least one message configuration strategy for configuring the message is defined in the test agent, and the corresponding message configuration strategies are respectively defined according to the message type of each message. And after the request message is analyzed to determine the first message type corresponding to the request message, determining a defined message configuration strategy corresponding to the first message type. And reconstructing an agent request message corresponding to the request message through the first message configuration strategy.
The protocol layer structure in the agent request message is consistent with the request message, but each field in the agent request message is different from the request message.
S105: and sending the agent request message to the test assistant server, so that the test assistant server returns a response message corresponding to the agent request message.
In the embodiment of the invention, the agent request message is sent to the test assistant server so as to obtain the response message of the test assistant server responding to the agent request message.
S106: and analyzing the response message and determining a second message type of the response message.
In the embodiment of the invention, the response message is analyzed, the message request content of the response message is obtained, the message type of the response message is determined according to the session management strategy set in the test agent, and the message type of the response message is determined as the second message type.
Optionally, after analyzing the response message, the test agent obtains a corresponding response message protocol layer architecture for responding to the request message through the analyzed response message.
S107: and determining a preset second message configuration strategy corresponding to the second message type, constructing an agent response message corresponding to the response message based on the second message configuration strategy, and sending the agent response message to the client to be tested so as to test the client to be tested through the agent response message.
In the embodiment of the present invention, a defined packet configuration policy corresponding to the second packet type is determined. And reconstructing an agent response message corresponding to the response message through the second message configuration strategy, and sending the agent response message to the client to be tested so as to test whether the client to be tested has abnormity, faults or fails to respond.
The protocol layer structure in the proxy response message is consistent with the response message, but each field in the proxy response message is different from the response message.
Optionally, the message type of the request message may be the same as or different from the message type of the response message. When the message type of the request message is consistent with the message type of the response message, the first message configuration strategy is the same as the second message configuration strategy; when the message type of the request message is not consistent with the message type of the response message, the first message configuration strategy is different from the second message configuration strategy.
S108: and receiving the client running state corresponding to the client to be tested returned by the driver, so as to determine the test result of the client to be tested according to the client running state.
In the embodiment of the invention, the driver can monitor the running state of the client to be tested in real time and send the running state of the client to the test agent. And after the test agent sends the agent response message to the client to be tested, receiving the client running state sent by the driver, and determining a test result of performing the fuzzy test on the client to be tested according to the client running state.
For example, after the agent response message is sent to the client to be tested, the client to be tested cannot respond to the agent response message, and if an exception occurs, the driver sends the client running state corresponding to the client to be tested to the test agent as the client exception. And when the client running state received by the test agent is client abnormity, determining that the test result is that the client to be tested has a security vulnerability.
Optionally, in the embodiment of the present invention, the client to be tested is subjected to a fuzzy test according to an interaction process between the client to be tested and the test assistant server, and if there are multiple interaction processes between the client to be tested and the test assistant server, the above-mentioned processes from S102 to S108 are executed when the client to be tested needs to send an interaction message to the test assistant server each time, so as to implement the fuzzy test on the client to be tested, which will not be repeated herein.
Further, if the client to be tested needs to perform blurring again subsequently, the processes from S101 to S108 are performed again, which will not be described herein again.
In the fuzzy test method provided by the embodiment of the invention, when a test agent needs to carry out fuzzy test on a client to be tested, the test agent is connected with a driver of the client by remote calling and sends a test command to the driver, and after receiving the test command, the driver triggers the client to be tested to interact with an accompanying test server and generates a request message corresponding to the accompanying test server. The client to be tested sends the request message to a test agent, the test agent analyzes the request message, a first message type of the request message is determined, and a message configuration strategy corresponding to the request message is determined according to the first message type. And reconstructing an agent request message corresponding to the request message through the message configuration strategy, wherein the agent request message replaces the request message to be sent to the test assistant server. And the accompany measurement server responds to the agent request message to generate a response message. And the test agent receives a response message sent by the test server, analyzes the response message, determines a second message type of the response message, and determines a second message configuration strategy corresponding to the second message type. And reconstructing the proxy response message corresponding to the response message through the second message configuration strategy. And the proxy response message replaces the response message to feed back to the client to be tested, the client to be tested is subjected to the fuzzy test through the proxy response message, and the running state of the client is obtained through the driver so as to determine the test result of the fuzzy test on the client to be tested.
By applying the method of the embodiment of the invention, the client-side fuzz test can be realized when the client-side and the server are interacted, and the feasibility, the configurability and the flexibility of realizing the automatic fuzz test are provided.
In the method provided by the embodiment of the present invention, based on the content of the above-mentioned S104, a new message needs to be reconstructed according to a preset first message configuration policy to replace the original message for transmission. As shown in fig. 3, the process of constructing the proxy request packet corresponding to the first packet type based on the first packet configuration policy may specifically include:
s501: and acquiring a first random function corresponding to the first message configuration strategy, and determining a field type associated with the first random function.
In the embodiment of the invention, a test configuration module is arranged in the test agent, and a session management strategy and a message configuration strategy are defined in the test configuration module. The session management strategy depends on a message processing library in the test agent, and the message processing library is used for analyzing messages, setting different message configuration strategies according to message types, and setting a random function randVal corresponding to each message configuration strategy. Each random function sets the corresponding associated field type. Therefore, after the first message configuration policy corresponding to the first message type is determined, the first random function corresponding to the set message configuration policy is obtained, and the field type associated with the random function is determined.
The random function is a fuzzy test fuzzy z function for carrying out fuzzy test on the client to be tested.
S502: determining each first protocol layer in the request message, and acquiring each first field in each first protocol layer.
In the embodiment of the present invention, after the request packet is analyzed, the structure of each protocol layer in the request packet may be determined, and each protocol layer in the request packet is the first protocol layer. Each first protocol layer comprises at least one field, and each field in the first request message is set as a first field.
S503: determining the field type of each first field, and selecting a first target field from each first field, wherein the field type of the first target field is consistent with the field type associated with the first random function.
In the embodiment of the present invention, each field has a different field type, wherein each field type includes: ShortField, BitField, IntField, StrField, PacketField, IPField, and MACField, among others. And according to the field type associated with the first random function, determining a first target field in each first field, wherein the field type of the first target field is the field type associated with the first random function.
S504: and applying the first random function to replace the first target field so as to construct an agent request message corresponding to the request message.
In the embodiment of the invention, when an agent request message consistent with the message structure of the request message needs to be constructed, a first random function is applied to replace a first target field in the original request message according to the message structure of the request message and each field contained in the message structure, and the agent request message is constructed.
In the fuzzy testing method provided by the embodiment of the present invention, based on the message type of the request message, a first message configuration policy corresponding to the request message is determined, a first random function corresponding to the first message configuration policy in the testing agent is obtained, and a field type associated with the first random function is determined. After the request message is analyzed, each protocol layer in the message structure of the request message is determined, and at least one first field in each protocol layer is obtained. And determining a first target field needing to be processed in each first field according to the field type of each first field. Wherein the field type of the first target field is consistent with the field type associated with the first random function. After determining the field to be replaced in the request message, replacing the field with the corresponding first random function to construct a new request message, wherein the new request message is an agent request message.
Specifically, in the process of replacing the field of the message, if the field value to be replaced is null, the random function associated with the field type of the field is called as the field value of the field; and if the field value needing field replacement is a non-null value, covering the original numerical value of the field with a random function associated with the field type of the field to obtain a new field value.
It should be noted that, in the process of processing fields in a message, one random function may map multiple field types, and the message configuration policy may also correspond to multiple random functions. Therefore, when processing the fields in the message, multiple fields may be processed at the same time, and the specific processing procedure is consistent with the above-mentioned processes of S501 to S504, which will not be described herein again.
In the fuzzy test method provided by the embodiment of the invention, corresponding to the processes from S501 to S504, after a message sent by a client to be tested is processed to construct a new message, when an accompanied test server responds according to a newly constructed agent request message, a response message sent by the accompanied test server is received, and a new response message is reconstructed as an agent response message according to the response message. The process of constructing the proxy response packet corresponding to the response packet based on the second packet configuration policy is shown in fig. 4, and specifically includes:
s601: and acquiring a second random function corresponding to the second message configuration strategy, and determining a field type associated with the second random function.
In the embodiment of the present invention, S601 is consistent with the execution process of S501, and the second packet configuration policy may be consistent with the first packet configuration policy, or may be a configuration policy that is pre-deployed in the test agent and is different from the first packet configuration policy.
S602: and determining each second protocol layer in the response message, and acquiring each second field in each second protocol layer.
In the embodiment of the present invention, the implementation process of S602 is the same as the implementation process of S502 described above. And determining a message framework of a message fed back by the accompany measurement server when responding according to the agent request message through each second protocol layer, and acquiring each second field corresponding to the response message in each second protocol layer.
S603: and determining the field type of each second field, and selecting a second target field from each second field, wherein the field type of the second target field is consistent with the field type associated with the second random function.
In the embodiment of the present invention, the implementation process of S603 is the same as the implementation process of S503. And determining a second target field needing to be processed based on a second random function corresponding to the second message configuration strategy. The second random function is a fuzzy test function for carrying out fuzzy test on the client to be tested; the field type of the second target field is consistent with the field type associated with the second random function.
S604: and applying the second random function to replace the second target field so as to construct a proxy response message corresponding to the response message.
In the embodiment of the present invention, the implementation process of S604 is the same as the implementation process of S504 described above. And applying a second random function to replace the second target field and constructing a new response message, wherein the new response message is an agent response message.
In the fuzzy testing method provided in the embodiment of the present invention, based on the second packet type of the response packet, the second packet configuration policy corresponding to the response packet is determined, the second random function corresponding to the second packet configuration policy in the testing agent is obtained, and the field type associated with the second random function is determined. After the response message is analyzed, each protocol layer in the message structure of the response message is determined, and at least one second field in each protocol layer is obtained. And determining a second target field needing to be processed in each second field according to the field type of each second field. Wherein the field type of the second target field is consistent with the field type associated with the second random function. And after determining the fields needing to be replaced in the request message, replacing the second target fields with the corresponding second random functions to construct a new response message.
Specifically, in the process of replacing the field of the message, if the field value to be replaced is null, the random function associated with the field type of the field is called as the field value of the field; and if the field value needing field replacement is a non-null value, covering the original numerical value of the field with a random function associated with the field type of the field to obtain a new field value.
When the method provided by the embodiment of the invention is applied, when the client to be tested needs to be subjected to the fuzzy test, the agent request message is firstly constructed according to the request message of the client to be tested, so that the test assistant server interacts with the client to be tested according to the agent request message and responds to the agent request message, then the response message sent by the test assistant server is processed, a new response message is constructed, and the fuzzy test is carried out on the client to be tested through the agent response message.
In the method provided in the embodiment of the present invention, based on the process of S105, the sending the agent request packet to the test assistant server specifically includes:
acquiring a preset communication protocol between the client to be tested and the test accompanying server;
generating a proxy client corresponding to the client to be tested and a proxy server corresponding to the test server in the test proxy based on the communication protocol;
and sending the agent request message to the agent client, and sending the agent request message to the accompany measurement server through the agent client.
It can be understood that, in the embodiment of the present invention, a new proxy server is constructed through a communication protocol between a client to be tested and an accompanying test server to interact with the client to be tested, and in an interaction process, the proxy server implements reconstruction of a request message, and reconstructs the newly constructed request message, that is,: and sending the agent request message to the agent client, connecting the agent client with the accompanying measurement server, and sending the agent request message to the accompanying measurement server.
Further, the sending the proxy response packet to the client to be tested specifically includes:
and sending the proxy request message to the client to be tested by the proxy server in the process of sending the proxy response message.
It can be understood that, after the accompany test server responds to the agent request message and returns a response message, the agent client side implements a reconstruction process of the response message to generate a new response message, that is: and the proxy responds to the message. And then the proxy client communicates with the proxy server, sends the proxy response message to the proxy server, communicates with the client to be tested by the proxy server, and sends the proxy response message to the client to be tested so as to realize the test process of the client to be tested.
By applying the method provided by the embodiment of the invention, the agent client and the agent server are constructed in the test agent, so that the interaction process among the test agent, the client to be tested and the test server is realized, and the fuzzy test of the client to be tested is facilitated.
Referring to fig. 5, an embodiment of the present invention provides a method according to the above-mentioned embodiment, on the basis of fig. 2, the test agent 400 includes a test configuration 401, a session management 402, a message parsing/generator 403, and a protocol library 404. Wherein the test configuration is used for defining a session management policy and at least one message configuration policy. The session management policy is used for configuring a corresponding configuration policy for the request message sent by the client 200 to be tested and the response message sent by the client 300 to be tested. Each message configuration policy depends on the protocol library 404, each message configuration policy corresponds to at least one random function, and each field type is associated with the random function, thereby implementing a process of constructing a message field. The session management 402 is used for implementing protocol interaction with the client 200 to be tested and the test assistant server 300, and specifically, the session management 402 is connected to an I/O interface in the test agent, and is connected to the client 200 to be tested and the test assistant server 300 through the I/O interface, so as to implement processes such as sniffing and sending of messages. The message parser/generator 403 is used to parse the message and construct a new message. The protocol library 404 is used for storing message configuration policies and logs in the simulation test process and other information generated in the interaction process.
The specific implementation procedures and derivatives thereof of the above embodiments are within the scope of the present invention.
Corresponding to the method described in fig. 1, an embodiment of the present invention further provides a fuzz testing apparatus, which is used for specifically implementing the method in fig. 1, and the fuzz testing apparatus provided in the embodiment of the present invention may be applied to a computer terminal or various mobile devices, and a schematic structural diagram of the fuzz testing apparatus is shown in fig. 6, and specifically includes:
the connection unit 701 is used for connecting a driver arranged in the client to be tested when the client to be tested needs to be subjected to the fuzzy test;
a triggering unit 702, configured to send a test command to the driver, so that the driver triggers the client to be tested to send a request packet interacting with the test assistant server to the test agent based on the test command;
a first parsing unit 703, configured to parse the request packet and determine a first packet type of the request packet;
a constructing unit 704, configured to determine a first packet configuration policy corresponding to the preset first packet type, and construct, based on the first packet configuration policy, an agent request packet corresponding to the request packet;
a first sending unit 705, configured to send the agent request packet to the test assistant server, so that the test assistant server returns a response packet corresponding to the agent request packet;
a second parsing unit 706, configured to parse the response packet and determine a second packet type of the response packet;
a second sending unit 707, configured to determine a second message configuration policy corresponding to the preset second message type, construct an agent response message corresponding to the response message based on the second message configuration policy, and send the agent response message to the client to be tested, so as to test the client to be tested through the agent response message;
the receiving unit 708 is configured to receive the client running state corresponding to the client to be tested, which is returned by the driver, so as to determine a test result of the client to be tested according to the client running state.
In the fuzzy testing device provided by the embodiment of the invention, when a testing agent needs to perform fuzzy testing on a client to be tested, the testing agent is connected with a driver of the client by remote calling and sends a testing command to the driver, and after receiving the testing command, the driver triggers the client to be tested to interact with an accompanying testing server and generates a request message corresponding to the accompanying testing server. The client to be tested sends the request message to a test agent, the test agent analyzes the request message, a first message type of the request message is determined, and a message configuration strategy corresponding to the request message is determined according to the first message type. And reconstructing an agent request message corresponding to the request message through the message configuration strategy, wherein the agent request message replaces the request message to be sent to the test assistant server. And the accompany measurement server responds to the agent request message to generate a response message. And the test agent receives a response message sent by the test server, analyzes the response message, determines a second message type of the response message, and determines a second message configuration strategy corresponding to the second message type. And reconstructing the proxy response message corresponding to the response message through the second message configuration strategy. And the proxy response message replaces the response message to feed back to the client to be tested, the client to be tested is subjected to the fuzzy test through the proxy response message, and the running state of the client is obtained through the driver so as to determine the test result of the fuzzy test on the client to be tested.
By applying the device provided by the embodiment of the invention, the client-side fuzz test can be realized when the client-side and the server are interacted, and the feasibility, configurability and flexibility of realizing the automatic fuzz test are provided.
In the apparatus provided in the embodiment of the present invention, the configuration unit 704 includes:
a first obtaining subunit, configured to obtain a first random function corresponding to the first packet configuration policy, and determine a field type associated with the first random function;
a first determining subunit, configured to determine each first protocol layer in the request message, and obtain each first field in each first protocol layer;
the first selecting subunit is configured to determine a field type of each first field, and select a first target field from each first field, where the field type of the first target field is consistent with the field type associated with the first random function;
and the first constructing subunit is used for applying the first random function to replace the first target field so as to construct an agent request message corresponding to the request message.
In the apparatus provided in the embodiment of the present invention, the second sending unit 707 includes:
a second obtaining subunit, configured to obtain a second random function corresponding to the second packet configuration policy, and determine a field type associated with the second random function;
a second determining subunit, configured to determine each second protocol layer in the response message, and obtain each second field in each second protocol layer;
a second selecting subunit, configured to determine a field type of each second field, and select a second target field from each second field, where the field type of the second target field is consistent with the field type associated with the second random function;
and the second constructing subunit is used for applying the second random function to replace the second target field so as to construct a proxy response message corresponding to the response message.
In the apparatus provided in the embodiment of the present invention, the first sending unit 705 includes:
the third acquisition subunit is used for acquiring a preset communication protocol between the client to be tested and the test accompanying server;
a generating subunit, configured to generate, in the test agent, an agent client corresponding to the client to be tested and an agent server corresponding to the test assistant server based on the communication protocol;
and the first sending subunit is configured to send the agent request packet to the agent client, and send the agent request packet to the measurement assistant server via the agent client.
In the apparatus provided in the embodiment of the present invention, the second sending unit 707 includes:
and the second sending subunit is configured to send the proxy request packet to the client to be tested via the proxy server while sending the proxy response packet to the proxy server.
The specific working processes of each unit and sub-unit in the fuzzy testing apparatus disclosed in the above embodiment of the present invention can refer to the corresponding contents in the fuzzy testing method disclosed in the above embodiment of the present invention, and are not described herein again.
The embodiment of the invention also provides a storage medium, which comprises a stored instruction, wherein when the instruction runs, the device where the storage medium is located is controlled to execute the fuzzy test method.
An electronic device is provided in an embodiment of the present invention, and the structural diagram of the electronic device is shown in fig. 7, which specifically includes a memory 801 and one or more instructions 802, where the one or more instructions 802 are stored in the memory 801 and configured to be executed by the one or more processors 803 to perform the following operations:
when the client to be tested needs to be subjected to the fuzzy test, a driver arranged in the client to be tested is connected;
sending a test command to the driver, so that the driver triggers the client to be tested to send a request message for interacting with the test assistant server to the test agent based on the test command;
analyzing the request message and determining a first message type of the request message;
determining a preset first message configuration strategy corresponding to the first message type, and constructing an agent request message corresponding to the request message based on the first message configuration strategy;
sending the agent request message to the test assistant server, so that the test assistant server returns a response message corresponding to the agent request message;
analyzing the response message and determining a second message type of the response message;
determining a preset second message configuration strategy corresponding to the second message type, constructing an agent response message corresponding to the response message based on the second message configuration strategy, and sending the agent response message to the client to be tested so as to test the client to be tested through the agent response message;
and receiving the client running state corresponding to the client to be tested returned by the driver, so as to determine the test result of the client to be tested according to the client running state.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both.
To clearly illustrate this interchangeability of hardware and software, various illustrative components and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A fuzzy test method is characterized in that the method is applied to a test agent, the test agent is connected with a client to be tested and an accompanying test server, the test agent is used for carrying out fuzzy test on the client to be tested in the interaction process of the client to be tested and the accompanying test server, and the method comprises the following steps:
when the client to be tested needs to be subjected to the fuzzy test, a driver arranged in the client to be tested is connected;
sending a test command to the driver, so that the driver triggers the client to be tested to send a request message for interacting with the test assistant server to the test agent based on the test command;
analyzing the request message and determining a first message type of the request message;
determining a preset first message configuration strategy corresponding to the first message type, and constructing an agent request message corresponding to the request message based on the first message configuration strategy;
sending the agent request message to the test assistant server, so that the test assistant server returns a response message corresponding to the agent request message;
analyzing the response message and determining a second message type of the response message;
determining a preset second message configuration strategy corresponding to the second message type, constructing an agent response message corresponding to the response message based on the second message configuration strategy, and sending the agent response message to the client to be tested so as to test the client to be tested through the agent response message;
and receiving the client running state corresponding to the client to be tested returned by the driver, so as to determine the test result of the client to be tested according to the client running state.
2. The method according to claim 1, wherein constructing the proxy request packet corresponding to the first packet type based on the first packet configuration policy comprises:
acquiring a first random function corresponding to the first message configuration strategy, and determining a field type associated with the first random function;
determining each first protocol layer in the request message, and acquiring each first field in each first protocol layer;
determining the field type of each first field, and selecting a first target field from each first field, wherein the field type of the first target field is consistent with the field type associated with the first random function;
and applying the first random function to replace the first target field so as to construct an agent request message corresponding to the request message.
3. The method according to claim 2, wherein constructing the proxy response packet corresponding to the response packet based on the second packet configuration policy includes:
acquiring a second random function corresponding to the second message configuration strategy, and determining a field type associated with the second random function;
determining each second protocol layer in the response message, and acquiring each second field in each second protocol layer;
determining the field type of each second field, and selecting a second target field from each second field, wherein the field type of the second target field is consistent with the field type associated with the second random function;
and applying the second random function to replace the second target field so as to construct a proxy response message corresponding to the response message.
4. The method according to claim 1, wherein the sending the agent request message to the test server comprises:
acquiring a preset communication protocol between the client to be tested and the test accompanying server;
generating a proxy client corresponding to the client to be tested and a proxy server corresponding to the test server in the test proxy based on the communication protocol;
and sending the agent request message to the agent client, and sending the agent request message to the accompany measurement server through the agent client.
5. The method according to claim 4, wherein the sending the proxy response packet to the client to be tested comprises:
and sending the proxy request message to the client to be tested by the proxy server in the process of sending the proxy response message.
6. A fuzz testing apparatus, wherein the apparatus is applied to a test agent, the apparatus comprising:
the device comprises a connecting unit, a driver and a control unit, wherein the connecting unit is used for connecting the driver arranged in the client to be tested when the client to be tested needs to be subjected to the fuzzy test;
the triggering unit is used for sending a test command to the driver so that the driver triggers the client to be tested to send a request message for interacting with the test assistant server to the test agent based on the test command;
the first analysis unit is used for analyzing the request message and determining a first message type of the request message;
the constructing unit is used for determining a preset first message configuration strategy corresponding to the first message type and constructing an agent request message corresponding to the request message based on the first message configuration strategy;
the first sending unit is used for sending the agent request message to the test assistant server so that the test assistant server returns a response message corresponding to the agent request message;
the second analysis unit is used for analyzing the response message and determining a second message type of the response message;
the second sending unit is used for determining a preset second message configuration strategy corresponding to the second message type, constructing an agent response message corresponding to the response message based on the second message configuration strategy, and sending the agent response message to the client to be tested so as to test the client to be tested through the agent response message;
and the receiving unit is used for receiving the client running state corresponding to the client to be tested, which is returned by the driver, so as to determine the test result of the client to be tested according to the client running state.
7. The apparatus of claim 6, wherein the construction unit comprises:
a first obtaining subunit, configured to obtain a first random function corresponding to the first packet configuration policy, and determine a field type associated with the first random function;
a first determining subunit, configured to determine each first protocol layer in the request message, and obtain each first field in each first protocol layer;
the first selecting subunit is configured to determine a field type of each first field, and select a first target field from each first field, where the field type of the first target field is consistent with the field type associated with the first random function;
and the first constructing subunit is used for applying the first random function to replace the first target field so as to construct an agent request message corresponding to the request message.
8. The apparatus of claim 6, wherein the second sending unit comprises:
a second obtaining subunit, configured to obtain a second random function corresponding to the second packet configuration policy, and determine a field type associated with the second random function;
a second determining subunit, configured to determine each second protocol layer in the response message, and obtain each second field in each second protocol layer;
a second selecting subunit, configured to determine a field type of each second field, and select a second target field from each second field, where the field type of the second target field is consistent with the field type associated with the second random function;
and the second constructing subunit is used for applying the second random function to replace the second target field so as to construct a proxy response message corresponding to the response message.
9. The apparatus of claim 6, wherein the first sending unit comprises:
the third acquisition subunit is used for acquiring a preset communication protocol between the client to be tested and the test accompanying server;
a generating subunit, configured to generate, in the test agent, an agent client corresponding to the client to be tested and an agent server corresponding to the test assistant server based on the communication protocol;
and the first sending subunit is configured to send the agent request packet to the agent client, and send the agent request packet to the measurement assistant server via the agent client.
10. The apparatus of claim 9, wherein the second sending unit comprises:
and the second sending subunit is configured to send the proxy request packet to the client to be tested via the proxy server while sending the proxy response packet to the proxy server.
CN202011583668.5A 2020-12-28 2020-12-28 Fuzzy test method and device Pending CN112685301A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011583668.5A CN112685301A (en) 2020-12-28 2020-12-28 Fuzzy test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011583668.5A CN112685301A (en) 2020-12-28 2020-12-28 Fuzzy test method and device

Publications (1)

Publication Number Publication Date
CN112685301A true CN112685301A (en) 2021-04-20

Family

ID=75454161

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011583668.5A Pending CN112685301A (en) 2020-12-28 2020-12-28 Fuzzy test method and device

Country Status (1)

Country Link
CN (1) CN112685301A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778879A (en) * 2021-09-13 2021-12-10 上海幻电信息科技有限公司 Fuzzy test method and device for interface
CN113986712A (en) * 2021-09-10 2022-01-28 深圳开源互联网安全技术有限公司 Fuzzy test method and device based on HTTP/2

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101902367A (en) * 2009-05-31 2010-12-01 西门子(中国)有限公司 Method and device for producing test case
CN102075508A (en) * 2010-09-02 2011-05-25 北京神州绿盟信息安全科技股份有限公司 Vulnerability disclosure system and method aiming at network protocol
CN202679412U (en) * 2012-07-12 2013-01-16 郑州信大信安科技有限公司 Data transmission encrypting and decrypting system
CN105450476A (en) * 2015-12-07 2016-03-30 北京先进数通信息技术股份公司 Regression test system and test method
CN105516131A (en) * 2015-12-04 2016-04-20 珠海市君天电子科技有限公司 Vulnerability scanning method and device and electronic equipment
CN106936875A (en) * 2015-12-30 2017-07-07 南京理工大学 Improvement TCP agent method based on wide area network data compression
CN108833487A (en) * 2018-05-23 2018-11-16 南京大学 A kind of TCP transmission protocol agent method
CN111628900A (en) * 2019-02-28 2020-09-04 西门子股份公司 Fuzzy test method and device based on network protocol and computer readable medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101902367A (en) * 2009-05-31 2010-12-01 西门子(中国)有限公司 Method and device for producing test case
CN102075508A (en) * 2010-09-02 2011-05-25 北京神州绿盟信息安全科技股份有限公司 Vulnerability disclosure system and method aiming at network protocol
CN202679412U (en) * 2012-07-12 2013-01-16 郑州信大信安科技有限公司 Data transmission encrypting and decrypting system
CN105516131A (en) * 2015-12-04 2016-04-20 珠海市君天电子科技有限公司 Vulnerability scanning method and device and electronic equipment
CN105450476A (en) * 2015-12-07 2016-03-30 北京先进数通信息技术股份公司 Regression test system and test method
CN106936875A (en) * 2015-12-30 2017-07-07 南京理工大学 Improvement TCP agent method based on wide area network data compression
CN108833487A (en) * 2018-05-23 2018-11-16 南京大学 A kind of TCP transmission protocol agent method
CN111628900A (en) * 2019-02-28 2020-09-04 西门子股份公司 Fuzzy test method and device based on network protocol and computer readable medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986712A (en) * 2021-09-10 2022-01-28 深圳开源互联网安全技术有限公司 Fuzzy test method and device based on HTTP/2
CN113778879A (en) * 2021-09-13 2021-12-10 上海幻电信息科技有限公司 Fuzzy test method and device for interface
CN113778879B (en) * 2021-09-13 2024-03-08 上海幻电信息科技有限公司 Interface fuzzy test method and device

Similar Documents

Publication Publication Date Title
CN106844137B (en) Server monitoring method and device
US7958230B2 (en) Test driven deployment and monitoring of heterogeneous network systems
CN108363662A (en) A kind of applied program testing method, storage medium and terminal device
CN108256118B (en) Data processing method, device, system, computing equipment and storage medium
CN106484611B (en) Fuzzy test method and device based on automatic protocol adaptation
CN104639653A (en) Self-adaptive method and system based on cloud architecture
US20150319221A1 (en) Tracing business transactions based on application frameworks
CN111176941B (en) Data processing method, device and storage medium
CN112685301A (en) Fuzzy test method and device
CN111193716A (en) Service data calling method and device, computer equipment and storage medium
CN106339273A (en) Application program restoration method, terminal and server
CN107315952A (en) Method and apparatus for determining application program suspicious actions
CN107168844B (en) Performance monitoring method and device
CN113110864A (en) Application program updating method and device and storage medium
US20170220218A1 (en) Automatic Generation of Regular Expression Based on Log Line Data
CN113238965B (en) Interface test script generation method, system and storage medium
CN110198230B (en) Application monitoring method and device, storage medium and electronic device
CN108322524A (en) A kind of load-balancing device session keeps test method and device
CN114465741A (en) Anomaly detection method and device, computer equipment and storage medium
CN112231209A (en) Parameter acquisition method and device, computer equipment and storage medium
CN111813627A (en) Application auditing method, device, terminal, system and readable storage medium
CN114039760B (en) Security testing method and device, computer equipment and storage medium
CN114938396A (en) Routing method of service call request, method and device for creating service
CN111176782B (en) Online experiment method and device
CN110233760B (en) System fault monitoring method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210420

RJ01 Rejection of invention patent application after publication