CN115396332A - Fuzzy test method of power communication protocol, terminal equipment and storage medium - Google Patents

Fuzzy test method of power communication protocol, terminal equipment and storage medium Download PDF

Info

Publication number
CN115396332A
CN115396332A CN202210701101.6A CN202210701101A CN115396332A CN 115396332 A CN115396332 A CN 115396332A CN 202210701101 A CN202210701101 A CN 202210701101A CN 115396332 A CN115396332 A CN 115396332A
Authority
CN
China
Prior art keywords
message
fitness
target
target segment
messages
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.)
Granted
Application number
CN202210701101.6A
Other languages
Chinese (zh)
Other versions
CN115396332B (en
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.)
Inner Mongolia Ultra High Voltage Power Supply Branch Of Inner Mongolia Electric Power Group Co ltd
Original Assignee
Inner Mongolia Ultra High Voltage Power Supply Branch Of Inner Mongolia Electric Power Group 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 Inner Mongolia Ultra High Voltage Power Supply Branch Of Inner Mongolia Electric Power Group Co ltd filed Critical Inner Mongolia Ultra High Voltage Power Supply Branch Of Inner Mongolia Electric Power Group Co ltd
Priority to CN202210701101.6A priority Critical patent/CN115396332B/en
Publication of CN115396332A publication Critical patent/CN115396332A/en
Application granted granted Critical
Publication of CN115396332B publication Critical patent/CN115396332B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/04Processing captured monitoring data, e.g. for logfile generation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Environmental & Geological Engineering (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Maintenance And Management Of Digital Transmission (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a fuzzy test method of a power communication protocol, terminal equipment and a storage medium. The method is applied to a testing end and a tested end, and comprises the following steps: generating a fuzzy test case by a test end; the testing end carries out validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to the tested end; the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; wherein, the service port of the test end is in a normally open state. By the method, the power communication protocol can be subjected to the fuzzing test.

Description

Fuzzy test method of power communication protocol, terminal equipment and storage medium
Technical Field
The present application relates to the field of communication protocol testing technologies, and in particular, to a fuzzy testing method, a terminal device, and a storage medium for a power communication protocol.
Background
At present, the disclosed fuzzy test system based on other industrial control protocols comprises functions of test case generation, sending, state machine monitoring, message backtracking and the like, the functions are called in sequence, and fuzzy tests are discovered with probability, namely vulnerability messages of semi-legal test case triggering vulnerabilities or system errors.
However, most of the protocol tests supported by such systems are that the tested end normally opens a service port corresponding to an industrial control protocol, the tested end actively determines whether to send a test case, and the test case mostly cannot maintain a protocol session, and accordingly, the state monitoring module is further unable to support data monitoring of the corresponding protocol.
Disclosure of Invention
The application provides a fuzzy test method of a power communication protocol, terminal equipment and a storage medium, which can carry out fuzzy test on the power communication protocol.
The technical scheme adopted by the application is to provide a fuzzy test method of a power communication protocol, the method is applied to a test terminal and a tested terminal, and the method comprises the following steps: generating a fuzzy test case by a test end; the testing end carries out validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to the tested end; the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; wherein, the service port of the test end is in a normally open state.
The method for generating the fuzzy test case by the test end comprises the following steps: the test end splits each sample message from the message head to the message tail in sequence to obtain a plurality of fragment messages; clustering the fragment messages to obtain a plurality of fragment messages corresponding to each type; and extracting a fragment message from each type to form a test case.
The clustering of the fragment messages to obtain a plurality of fragment messages corresponding to each type includes: determining at least one first clustering center based on the plurality of segment messages; determining a first target segment message corresponding to each first clustering center; performing cross correction on every two first target fragment messages to obtain second target fragment messages with corresponding quantity; determining at least one second cluster center based on a plurality of second target segment messages; and obtaining a plurality of fragment messages corresponding to each type based on the second clustering center.
Wherein, cross-correcting every two first target segment messages to obtain a corresponding number of second target segment messages, including: performing cross operation on every two first target fragment messages, and updating the content of each first target fragment message; and carrying out variation operation on the updated first target segment message, and updating the content of the first target segment message again to obtain a second target segment message.
Wherein, the method also comprises: determining a first fitness corresponding to each first target segment message based on the first clustering center; determining a second fitness corresponding to each second target segment message based on the second clustering center; and determining whether to replace the first target segment message with the second target segment message based on the first fitness and the second fitness.
Determining whether to utilize a second target segment report Wen Tihuan as a first target segment message based on the first fitness and the second fitness includes: if the second fitness is larger than the first fitness, replacing the first target fragment message with the second target fragment message; if the second fitness is smaller than or equal to the first fitness, determining the annealing probability of the second target segment message; and judging whether to replace the first target fragment message with the second target fragment message based on the annealing probability.
Before performing the cross operation on every two first target segment messages, the method comprises the following steps: determining the fitness of each first target segment message; determining the maximum fitness in all the fitness degrees and the average fitness of all the fitness degrees; determining the higher fitness of the fitness of every two first target fragment messages as the target fitness; determining a cross rate by using the target fitness, the maximum fitness and the average fitness; performing cross operation on every two first target segment messages, including: and carrying out cross operation on every two first target segment messages according to the cross rate.
Splitting each sample message from the message head to the message tail in sequence to obtain a plurality of fragment messages, wherein the method comprises the following steps: taking a fixed value part in the sample message as a first segment message; taking a message part corresponding to the tested end in the sample message as a second fragment message; and taking the message part needing the fuzzy test in the sample message as a third segment message.
Another technical solution adopted by the present application is to provide a terminal device, where the terminal device includes a processor and a memory connected to the processor; the memory is used for storing program data and the processor is used for executing the program data so as to realize the method provided by the technical scheme.
Another technical solution adopted by the present application is to provide a computer storage medium for storing program data, which when executed by a processor, is used for implementing the method provided in the above technical solution.
The beneficial effect of this application is: different from the prior art, the power communication protocol fuzzing test method is applied to a test end and a tested end, and comprises the following steps: generating a fuzzy test case by a test end; the testing end carries out validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to the tested end; the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; the service port of the test end is in the normally open state, and the fuzzy test can be performed on the power communication protocol by using the high session retentivity of the test end when the service port is in the normally open state.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts. Wherein:
FIG. 1 is a flow chart of a first embodiment of a power communication protocol fuzz testing method provided by the present application;
FIG. 2 is a flow chart of a second embodiment of a power communication protocol fuzz testing method provided by the present application;
FIG. 3 is a schematic flow chart diagram illustrating one embodiment of step 22 provided herein;
FIG. 4 is a schematic flow chart diagram illustrating an embodiment of step 223 provided herein;
FIG. 5 is a schematic flow chart diagram illustrating an embodiment of a process prior to step 41 provided herein;
FIG. 6 is a schematic flow chart diagram illustrating one embodiment of step 42 provided herein;
FIG. 7 is a flow chart of a third embodiment of a power communication protocol fuzz testing method provided by the present application;
FIG. 8 is a schematic flowchart of an embodiment of step 73 provided herein;
fig. 9 is a schematic structural diagram of an embodiment of a terminal device provided in the present application;
fig. 10 is a schematic structural diagram of an embodiment of a terminal device provided in the present application;
FIG. 11 is a schematic diagram illustrating operation of an embodiment of a use case generation module provided in the present application;
FIG. 12 is a schematic diagram illustrating operation of an embodiment of a send and session maintenance module provided herein;
FIG. 13 is a schematic diagram illustrating operation of one embodiment of a condition monitoring module provided herein;
FIG. 14 is a schematic structural diagram of an embodiment of a computer storage medium provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some of the structures related to the present application are shown in the drawings, not all of the structures. 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 application.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Referring to fig. 1, fig. 1 is a schematic flowchart of a first embodiment of a power communication protocol fuzz testing method provided in the present application. The method is applied to a testing end and a tested end, and comprises the following steps:
step 11: and the test end generates a fuzzy test case.
The electric power communication protocol can be an electric energy information acquisition and monitoring platform system data transmission protocol Q/NMDW-YX-001-2012.
The fuzzy test case can be a randomly generated message or can be obtained by changing a sample message.
Step 12: and the testing end carries out validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to the tested end.
The validity check may be made based on a protocol of the power communication protocol. And if the format of the fuzzy test case is correct, determining that the legality is satisfied.
And if the fuzzy test case needs to be fuzzy, and the fuzzy format is correct, the validity is determined to be met.
Step 13: the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; wherein, the service port of the test end is in a normally open state.
In some embodiments, the tested end may switch. For example, the terminal A is switched to the terminal B.
And testing the tested end based on the fuzzy test case to obtain a test result, and finding the loophole of the power communication protocol through the test result.
Because the communication mode of the electric energy information acquisition and monitoring platform system data transmission protocol Q/NMDW-YX-001-2012 is the normally open service port of the testing end, the tested end is actively connected with the testing end, the testing end can send the fuzzy test case through the fuzzy validity check, and the tested end can actively close communication immediately once the communication session is illegal. The difficulty that most of fuzzy test systems cannot carry out fuzzy test on the protocol is solved, and due to the high conversation retentivity of a test end, the monitoring indexes of the protocol can be added into the state monitoring for dynamic monitoring. The method solves the problem of feasibility of fuzzy test of the protocol, ensures conversation maintenance in the protocol test process, benefits from conversation maintenance of the test end, and enables state data monitoring based on the protocol to be feasible.
Referring to fig. 2, fig. 2 is a schematic flowchart of a second embodiment of a power communication protocol fuzz testing method provided in the present application. The method is applied to a testing end and a tested end, and comprises the following steps:
step 21: and the test end splits each sample message from the message head to the message tail in sequence to obtain a plurality of fragment messages.
In some embodiments, a fixed value part in a sample message is used as a first segment message; taking a message part corresponding to the tested end in the sample message as a second fragment message; and taking the message part needing the fuzzy test in the sample message as a third segment message.
For example, in an electric energy information acquisition and monitoring platform system data transmission protocol Q/NMDW-YX-001-2012, a segmentation principle is that a fixed value part is defined according to a protocol to be independently segmented, such as two '68' fields at the beginning of the protocol, a fixed field '16' at the end, and the like; the values which need to be calculated in the later period are independently segmented according to different tested ends, such as data length L, checksum field and the like in a protocol, and are designated as the attribute of delay calculation; the values that need to change randomly in the fuzz test are segmented independently, and the byte variation range of the change, a random strategy and the like are specified. After the segmentation part is completed, a use case message to be blurred is described as an assembly of several segment messages. Secondly, defining generation action, continuing to exemplify by the protocol, and mainly defining the independent segment of the later-period calculation, namely, the operation principle of the field which is appointed to delay calculation attribute in the generation process, for example, checksum field needs to be appointed to be the sum of several fields, and as the checksum is fixed to be 1 byte, byte keeping processing needs to be carried out on the sum result; the length part calculation needs to specify the length calculation of a plurality of fields, still needs to carry out byte retention processing on the result bytes, and needs to carry out exclusive-or operation on one byte due to special regulation of a protocol, so as to ensure that the generation of the result bytes meets the default requirement of a specification. Finally, the generated number and the saved static file name are specified in the generating action.
Step 22: and clustering the fragment messages to obtain a plurality of fragment messages corresponding to each type.
In some embodiments, after a sample message is split, different fragment messages are obtained, and if some of the messages belong to the same type, clustering is required. For example, a fuzzy C-means clustering algorithm is used to determine a clustering center of each type, and then a plurality of segment messages corresponding to each type are divided based on the clustering centers.
In some embodiments, referring to fig. 3, step 22 may be the following flow:
step 221: at least one first clustering center is determined based on the plurality of segment messages.
Wherein, because a plurality of fragment messages correspond to a plurality of types, at least one first clustering center needs to be determined.
Step 222: and determining a first target segment message corresponding to each first clustering center.
The euclidean distance between each segment message and each first cluster center may then be calculated. And taking the first clustering center corresponding to the minimum Euclidean distance as the clustering center corresponding to the segment message.
And then, a first target segment message corresponding to each first clustering center can be determined.
Step 223: and performing cross correction on every two first target segment messages to obtain a corresponding number of second target segment messages.
And combining the determined at least two first target segment messages, and performing cross correction on the first target segment messages in the group according to the two first target segment messages as a group. For example, the message content is replaced in a cross way, self-variation operation is carried out after replacement, and the message content is updated again. And then obtaining a second target segment message with a corresponding quantity.
In some embodiments, referring to fig. 4, step 223 may be the following flow:
step 41: and performing cross operation on every two first target fragment messages, and updating the content of each first target fragment message.
In some embodiments, referring to fig. 5, before performing the interleaving operation on every two first target segment packets, the following process is further included:
step 51: determining the fitness of each first target fragment message; and determining the maximum fitness of all the fitness degrees and the average fitness of all the fitness degrees.
Wherein, the corresponding fitness can be calculated based on the fitness function.
Step 52: and determining the higher fitness of the fitness of every two first target fragment messages as the target fitness.
Step 53: and determining the crossing rate by using the target fitness, the maximum fitness and the average fitness.
For example, when the target fitness is greater than or equal to the average fitness, the target fitness is subtracted from the maximum fitness to obtain a first fitness difference, the average fitness is subtracted from the maximum fitness to obtain a second fitness difference, the second fitness difference is divided by the first fitness difference to obtain a first ratio, and the first ratio is used as the intersection ratio.
And when the target fitness is smaller than the average fitness, directly acquiring a preset intersection rate. Wherein the preset crossing rate is greater than the first ratio.
In an application scenario, the crossing rate can be expressed by the following formula:
Figure RE-GDA0003909983370000071
wherein, P c Denotes the crossing rate, f max Representing maximum fitness, f' representing target fitness, f avg Denotes the mean fitness, k c Indicating a preset crossover rate.
And after the crossing rate is determined, carrying out crossing operation on every two first target segment messages according to the crossing rate.
The crossing rate refers to the probability of crossing two first target segment messages, and the higher the value of the crossing rate is, the higher the probability of the crossing operation is.
Step 42: and carrying out mutation operation on the updated first target segment message, and updating the content of the first target segment message again to obtain a second target segment message.
In some embodiments, referring to fig. 6, step 42 may be the following flow:
step 61: determining the fitness of each first target fragment message; and determining the maximum fitness of all the fitness degrees and the average fitness of all the fitness degrees.
Step 62: and determining the variation rate by utilizing the first fitness, the maximum fitness and the average fitness of the second target segment message.
For example, when the first fitness is greater than or equal to the average fitness, the first fitness is subtracted from the maximum fitness to obtain a third fitness difference, the average fitness is subtracted from the maximum fitness to obtain a fourth fitness difference, the third fitness difference is divided by the fourth fitness difference to obtain a second ratio, and the second ratio is used as the variation rate.
And when the first fitness is smaller than the average fitness, directly acquiring a preset variation rate. Wherein the predetermined variation rate is greater than the second ratio.
In an application scenario, the mutation rate can be expressed by the following formula:
Figure RE-GDA0003909983370000081
wherein, P u Indicates the rate of variation, f max Denotes the maximum fitness, f denotes the first fitness, f denotes the maximum fitness avg Denotes the mean fitness, k m Indicates a predetermined variation rate.
If the first target segment message is not subjected to the cross operation, the first fitness corresponds to the fitness before updating.
And carrying out mutation operation on the updated first target segment message by utilizing the determined mutation rate, and updating the content of the first target segment message again to obtain a second target segment message.
Step 224: at least one second cluster center is determined based on the plurality of second target segment messages.
At this time, when the second target segment message is determined, at least one second cluster center may be determined based on a plurality of second target segment messages.
Step 225: and obtaining a plurality of corresponding fragment messages of each type based on the second clustering center.
The above process is an iterative process, i.e. a plurality of iterations are performed, and the optimal clustering center is determined, so that a plurality of segment messages are clustered.
In the process, the fitness of the cross rate and the variation rate along with the fragment message is automatically adjusted, so that the situation that the clustering center is trapped in a local optimal solution in the process of searching the clustering center can be avoided, and the optimal clustering center is searched.
Step 23: and extracting a fragment message from each type to form a test case.
Step 24: and the testing end carries out validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to the tested end.
Step 25: the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; wherein, the service port of the test end is in a normally open state.
In some embodiments, referring to fig. 7, the method further comprises:
step 71: and determining a first fitness corresponding to each first target segment message based on the first clustering center.
Step 72: and determining a second fitness corresponding to each second target segment message based on the second clustering center.
Step 73: and determining whether to replace the first target segment message with the second target segment message based on the first fitness and the second fitness.
In some embodiments, referring to fig. 8, step 73 may be the following flow:
step 81: and if the second fitness is greater than the first fitness, replacing the first target fragment message with the second target fragment message.
If the second fitness is larger than the first fitness, the second target segment message is better, and the first target segment message is replaced by the second target segment message.
Step 82: and if the second fitness is smaller than or equal to the first fitness, determining the annealing probability of the second target fragment message.
If the second fitness is less than or equal to the first fitness, it indicates that the second target segment message is weakened, and it needs to further determine whether the first target segment message needs to be replaced by the second target segment message.
Determining the annealing probability of the second target segment message may be by determining a first difference between the second fitness and the first fitness; and a second difference between the maximum fitness and the average fitness; and obtaining the annealing probability by using the first difference and the second difference.
Wherein the following formula is used for representation:
Figure RE-GDA0003909983370000101
wherein P (dE) represents the annealing probability, dE represents the first difference, k represents a constant, and T represents the second difference.
Step 83: and judging whether to replace the first target fragment message with the second target fragment message based on the annealing probability.
Specifically, if the annealing probability is greater than the preset annealing probability, the first target segment message is replaced with the second target segment message.
And if the annealing probability is less than or equal to the preset annealing probability, not changing the first target fragment message.
By setting the annealing probability, the problem of trapping in a local optimal solution in the clustering process can be solved, and the aim of testing by fuzzy classification is fulfilled.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an embodiment of a terminal device provided in the present application. The terminal device 90 includes a processor 91 and a memory 92 connected to the processor 91; the memory 92 is used for storing program data and the processor 91 is used for executing the program data to realize the following method:
generating a fuzzy test case by a test end; the testing end conducts validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to the tested end; the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; wherein, the service port of the test end is in a normally open state.
It will be appreciated that the processor 91 is also operative to execute program data to implement the methods of any of the embodiments described above.
Referring to fig. 10, fig. 10 is a schematic structural diagram of an embodiment of a terminal device provided in the present application. The terminal device 100 includes a use case generation module 101, a transmission and session holding module 102, and a status monitoring module 103.
The case generation module 101 is configured to ensure semi-compliance of the fuzz test case data, and provide a guarantee for subsequently maintaining the validity of the protocol in the session.
The sending and session holding module 102 mainly defines a service port of a tested end, and heartbeat message reply, sending frequency, compliance dynamic correction of a to-be-sent fuzzy test case and the like required by session maintenance.
The state monitoring module 103 mainly defines related monitoring messages, monitoring frequencies, threshold value ranges, and other state monitoring not in the protocol, which are related to the tested protocol.
In some embodiments, the use case generation module 101, the sending and session holding module 102, and the state monitoring module 103 are linked to form a fuzzy test model for a passive communication protocol "electric energy information collection and monitoring platform system data transmission protocol Q/NMDW-YX-001-2012". The method comprises the steps of generating a test case semi-compliance, setting passive service during sending, setting a second correction mechanism of a case to be sent, setting a heartbeat mechanism and other conversation keeping mechanisms, and monitoring a state in a fuzzy test process.
The use case generation module 101, the sending and session holding module 102, and the state monitoring module 103 are mainly developed by using a python scripting language, and are embodied as three parts of XML scripting language descriptions when specifically designed and used, and the processes of the use case generation module 101, the sending and session holding module 102, and the state monitoring module 103 will be described in detail below.
As shown in fig. 11, in the use case generation module 101, first, a sample packet is sequentially split into several segments from a packet head to a packet tail, for example, in an electric energy information acquisition and monitoring platform system data transmission protocol Q/NMDW-YX-001-2012, the splitting principle is that a fixed value part is defined according to a protocol to be independently segmented, for example, two "68" fields at the beginning of the protocol, a fixed field "16" at the end of the protocol, and the like; the values which need to be calculated in the later period are independently segmented along with the difference of the tested equipment, such as the data length L, the checksum field and the like in the protocol, and are designated as the attribute of delay calculation; the values that need to be fuzzified and tested to change randomly are segmented independently, and the byte variation range of the change, the random strategy and the like are specified. After the segmentation part is completed, a use case message to be blurred is described as an assembly of several segment messages. Secondly, defining generation action, continuing to exemplify by the protocol, and mainly defining the independent segment of the later-stage calculation, namely, the operation principle of the field with the specified delay calculation attribute in the generation process, for example, the checksum field needs to specify the total sum of a plurality of fields, and as the checksum is fixed to be 1 byte, the byte retention processing needs to be carried out on the sum result; the length part calculation needs to specify the length calculation of a plurality of fields, still needs to carry out byte retention processing on the result bytes, and needs to carry out exclusive-or operation on one byte due to special protocol regulation, so as to ensure that the generation meets the default requirement of the specification. Finally, the number of the generation and the static file name after the saving are specified in the generation operation. The use case generation model is finally described in general in an XML script.
As shown in fig. 12, in the sending and session maintaining module 102, taking "electrical energy information collection and monitoring platform system data transmission protocol Q/NMDW-YX-001-2012" as an example, the normally open service port number of the model is defined in the first step, in the above-mentioned use case generation model, although the semi-compliant fuzzy use case message is generated as required, the address field of the object to be tested is a non-fixed value and changes with accessing different objects to be tested, so the second step defines the interval field to which the address field belongs in the order of number of bytes from left to right according to the use case structure in the above-mentioned use case generation module 101, in the present protocol use case, the byte count that appears first from left is 0, and then the address field is fixed 5 bytes from 7 to 11. The change of address field necessarily causes the change of checksum, and similarly, the position of checksum is reversely defined in the order of number of bytes from right to left. And secondly, defining a heartbeat frame required by session maintenance, and replying the data frame of the tested object to establish and maintain communication when the tested object initiates connection to the test end. And thirdly, defining the establishment communication in the sending action, firstly waiting for receiving a data packet, receiving a request initiated by the object to be tested to establish a communication message, then identifying the true value of the address field according to the rule set in the second step, replacing the true value of the address field corresponding to the heartbeat frame defined in the second step, and then calculating the checksum value of the heartbeat frame, and performing byte retention and replacement operation to ensure the legality of the heartbeat frame.
And finally, setting a timeout time value for waiting for receiving the data packet, restarting the service port of the test terminal if the time is out, and throwing an alarm for abnormal connection of the tested object. And step four, defining a sending case in the sending action, replacing an address field in the case to be sent, calculating the value of the checksum and the byte retention, and then correspondingly replacing the address field, which is similar to the step three. Similarly, the timeout time for sending the message also needs to be defined here, if the corresponding loopback packet is received, the next use case is sent immediately, and if the corresponding loopback packet is not received but is overtime, the next use case is sent immediately.
As shown in fig. 13, the state monitoring module 103 is divided into two parts, i.e., network packet monitoring and protocol monitoring, where the network packet monitoring specifies a protocol type, such as arp, icmp, and the like, and sets a packet sending interval time and a receiving timeout time, such as an alarm if the set timeout time is exceeded. The monitoring method of the protocol is mainly illustrated by a data transmission protocol Q/NMDW-YX-001-2012 of an electric energy information acquisition and monitoring platform system, a packet sending interval is defined in the first step, and because a monitoring data packet is sent in the same session with a test case in the sending process, two attributes of the packet sending interval are provided: one is to transmit a monitoring data packet every several seconds by using time as a dimension, and the other is to transmit a monitoring data packet with the use of use case quantity interval as a dimension, namely after transmitting several test case messages every time. In the second step, the whole data frame of the monitoring data packet is defined, and since the sending and session maintaining module 102 can perform pre-correction before sending all message cases to be sent, it is only necessary to ensure that the data frame is valid and effective, and excessive operation is not needed. And thirdly, defining monitoring logic for receiving the packets, and defining a monitoring threshold value aiming at the corresponding return packets of the monitoring data packets defined in the second step, namely, sequencing according to the quantity of the return packet data frames from left to right, defining a threshold value position, and setting a reference value and an alarm condition of the threshold value, wherein the alarm condition is, for example, greater than or less than or equal to the reference value. And fourthly, setting an alarm logic and alarm content corresponding to the alarm condition, wherein the alarm logic is that the alarm condition is single and true or has a AND or NOT relationship with other alarm conditions, and the alarm content is a text description corresponding to the alarm logic, so that a tester can quickly understand the alarm principle when the alarm occurs.
Referring to fig. 14, fig. 14 is a schematic structural diagram of an embodiment of a computer storage medium provided in the present application. The computer storage medium 140 is for storing program data 141, which program data 141, when executed by a processor, is for implementing the method of:
generating a fuzzy test case by a test end; the testing end conducts validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to the tested end; the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; wherein, the service port of the test end is in a normally open state.
It will be appreciated that program data 141, when executed by a processor, is also used to implement the method of any of the embodiments described above.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
The units described as separate parts may or may not be physically separate, and 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 units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit in the other embodiments described above may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A fuzzy test method of a power communication protocol is applied to a test end and a tested end, and comprises the following steps:
the test end generates a fuzzy test case;
the testing end carries out validity check on the fuzzy test case and sends the fuzzy test case passing the validity check to a tested end;
the tested end receives the fuzzy test case and tests based on the fuzzy test case to obtain a test result; and the service port of the test end is in a normally open state.
2. The method of claim 1, wherein the generating of the fuzz test case by the test end comprises:
the test end splits each sample message from the message head to the message tail in sequence to obtain a plurality of fragment messages;
clustering the fragment messages to obtain a plurality of fragment messages corresponding to each type;
and extracting a fragment message from each type to form the test case.
3. The method of claim 2, wherein the clustering the plurality of segment packets to obtain a corresponding plurality of segment packets of each type comprises:
determining at least one first clustering center based on the plurality of segment messages;
determining a first target segment message corresponding to each first clustering center;
performing cross correction on every two first target segment messages to obtain second target segment messages with corresponding quantity;
determining at least one second cluster center based on a plurality of second target segment messages;
and obtaining a plurality of corresponding fragment messages of each type based on the second clustering center.
4. The method according to claim 3, wherein the performing cross-correction on every two first target segment packets to obtain a corresponding number of second target segment packets comprises:
performing cross operation on every two first target fragment messages, and updating the content of each first target fragment message;
and carrying out mutation operation on the updated first target segment message, and updating the content of the first target segment message again to obtain the second target segment message.
5. The method of claim 3, further comprising:
determining a first fitness corresponding to each first target segment message based on the first clustering center;
determining a second fitness corresponding to each second target segment message based on the second clustering center;
and determining whether to replace the first target segment message with a second target segment message based on the first fitness and the second fitness.
6. The method of claim 5, wherein the determining whether to replace the first target segment packet with a second target segment packet based on the first fitness and the second fitness comprises:
if the second fitness is larger than the first fitness, replacing the first target fragment message with a second target fragment message;
if the second fitness is smaller than or equal to the first fitness, determining the annealing probability of a second target segment message;
and judging whether to replace the first target fragment message with a second target fragment message based on the annealing probability.
7. The method according to claim 4, wherein before performing the interleaving operation on every two first target segment packets, the method comprises:
determining the fitness of each first target fragment message; determining the maximum fitness of all the fitness degrees and the average fitness of all the fitness degrees;
determining the higher fitness of the fitness of every two first target fragment messages as the target fitness;
determining a cross rate by using the target fitness, the maximum fitness and the average fitness;
the performing a cross operation on every two first target segment messages includes:
and performing cross operation on every two first target segment messages according to the cross rate.
8. The method of claim 2, wherein the splitting each sample packet sequentially from a header to a trailer to obtain a plurality of fragment packets comprises:
taking a fixed value part in the sample message as a first segment message;
taking a message part corresponding to the tested terminal in the sample message as a second fragment message;
and taking the message part needing the fuzzy test in the sample message as a third segment message.
9. A terminal device, characterized in that the terminal device comprises a processor and a memory connected with the processor;
the memory is for storing program data and the processor is for executing the program data to implement the method of any one of claims 1-8.
10. A computer storage medium, characterized in that the computer storage medium is adapted to store program data which, when executed by a processor, is adapted to carry out the method according to any one of claims 1-8.
CN202210701101.6A 2022-06-20 2022-06-20 Fuzzy test method for power communication protocol, terminal equipment and storage medium Active CN115396332B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210701101.6A CN115396332B (en) 2022-06-20 2022-06-20 Fuzzy test method for power communication protocol, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210701101.6A CN115396332B (en) 2022-06-20 2022-06-20 Fuzzy test method for power communication protocol, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115396332A true CN115396332A (en) 2022-11-25
CN115396332B CN115396332B (en) 2024-03-15

Family

ID=84117617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210701101.6A Active CN115396332B (en) 2022-06-20 2022-06-20 Fuzzy test method for power communication protocol, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115396332B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853650A (en) * 2012-11-28 2014-06-11 西门子公司 Test case generating method and device for fuzz testing
US20190079853A1 (en) * 2017-09-08 2019-03-14 Devfactory Fz-Llc Automating Identification of Test Cases for Library Suggestion Models
US20200019492A1 (en) * 2018-07-12 2020-01-16 EMC IP Holding Company LLC Generating executable test automation code automatically according to a test case
CN110716872A (en) * 2019-09-23 2020-01-21 广州海颐信息安全技术有限公司 Vulnerability mining system and method for electric energy metering automation equipment
CN111079540A (en) * 2019-11-19 2020-04-28 北航航空航天产业研究院丹阳有限公司 Target characteristic-based layered reconfigurable vehicle-mounted video target detection method
CN111367782A (en) * 2018-12-25 2020-07-03 中国移动通信集团浙江有限公司 Method and device for automatically generating regression test data
CN112367220A (en) * 2020-10-27 2021-02-12 深圳市优必选科技股份有限公司 Interface testing method and device, storage medium and electronic equipment
CN113961473A (en) * 2021-11-15 2022-01-21 平安银行股份有限公司 Data testing method and device, electronic equipment and computer readable storage medium
CN114064451A (en) * 2021-09-29 2022-02-18 深圳市易聆科网络安全有限公司 Fuzzy test method and system for IEC104 protocol

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853650A (en) * 2012-11-28 2014-06-11 西门子公司 Test case generating method and device for fuzz testing
US20190079853A1 (en) * 2017-09-08 2019-03-14 Devfactory Fz-Llc Automating Identification of Test Cases for Library Suggestion Models
US20200019492A1 (en) * 2018-07-12 2020-01-16 EMC IP Holding Company LLC Generating executable test automation code automatically according to a test case
CN111367782A (en) * 2018-12-25 2020-07-03 中国移动通信集团浙江有限公司 Method and device for automatically generating regression test data
CN110716872A (en) * 2019-09-23 2020-01-21 广州海颐信息安全技术有限公司 Vulnerability mining system and method for electric energy metering automation equipment
CN111079540A (en) * 2019-11-19 2020-04-28 北航航空航天产业研究院丹阳有限公司 Target characteristic-based layered reconfigurable vehicle-mounted video target detection method
CN112367220A (en) * 2020-10-27 2021-02-12 深圳市优必选科技股份有限公司 Interface testing method and device, storage medium and electronic equipment
CN114064451A (en) * 2021-09-29 2022-02-18 深圳市易聆科网络安全有限公司 Fuzzy test method and system for IEC104 protocol
CN113961473A (en) * 2021-11-15 2022-01-21 平安银行股份有限公司 Data testing method and device, electronic equipment and computer readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
T. WERQUIN, M. HUBRECHTSEN, A. THANGARAJAN, F. PIESSENS AND J. T. MÜHLBERG: "Automated Fuzzing of Automotive Control Units", 2019 INTERNATIONAL WORKSHOP ON SECURE INTERNET OF THINGS (SIOT) *
刘智远: "基于模糊测试的未知协议漏洞挖掘方法研究", 中国知网硕士电子期刊, no. 2022, 15 January 2022 (2022-01-15) *
罗恩韬;胡志刚;林华;: "一种大数据时代海量数据抽取的开发模型研究", 计算机应用研究, no. 11 *

Also Published As

Publication number Publication date
CN115396332B (en) 2024-03-15

Similar Documents

Publication Publication Date Title
CN109302346B (en) Method and device for transmitting data flow
US11070569B2 (en) Detecting outlier pairs of scanned ports
CN107222491B (en) Intrusion detection rule creating method based on industrial control network variant attack
US20200244684A1 (en) Malicious port scan detection using source profiles
CN112261021B (en) DDoS attack detection method under software defined Internet of things
CN110619019A (en) Distributed storage method and system of data
CN112600908A (en) Method, device, equipment and storage medium for acquiring communication link
CN110944016A (en) DDoS attack detection method, device, network equipment and storage medium
US9122546B1 (en) Rapid processing of event notifications
CN111556080A (en) Network node monitoring method, device, medium and electronic equipment
CN115396332A (en) Fuzzy test method of power communication protocol, terminal equipment and storage medium
CN116781434A (en) Access control method, system and related equipment based on mimicry defense
CN113872949B (en) Address resolution protocol response method and related device
CN114553730B (en) Application identification method and device, electronic equipment and storage medium
CN116527389A (en) Port scan detection
CN116112209A (en) Vulnerability attack flow detection method and device
CN115633359A (en) PFCP session security detection method, device, electronic equipment and storage medium
CN113438225B (en) Vehicle-mounted terminal vulnerability detection method, system, equipment and storage medium
CN112637849B (en) Terminal equipment access control method and device and multimedia broadcasting equipment
CN113935438A (en) Internet of things equipment anomaly detection method, system and device based on equipment roles
CN115442834A (en) 5G session quality monitoring method and system
CN114500237A (en) Communication method and system
CN111147473A (en) Network message forwarding method, device and system
CN112367326B (en) Method and device for identifying traffic of Internet of vehicles
CN116846687B (en) Network security monitoring method, system, device and storage medium

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
GR01 Patent grant
GR01 Patent grant