CN115729815A - Fuzzy test method, device, equipment and storage medium based on weighted random - Google Patents
Fuzzy test method, device, equipment and storage medium based on weighted random Download PDFInfo
- Publication number
- CN115729815A CN115729815A CN202211433803.7A CN202211433803A CN115729815A CN 115729815 A CN115729815 A CN 115729815A CN 202211433803 A CN202211433803 A CN 202211433803A CN 115729815 A CN115729815 A CN 115729815A
- Authority
- CN
- China
- Prior art keywords
- field
- algorithm
- weight
- weighted
- target
- 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
Links
- 238000010998 test method Methods 0.000 title claims abstract description 25
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 128
- 238000012360 testing method Methods 0.000 claims abstract description 116
- 230000035772 mutation Effects 0.000 claims abstract description 13
- 238000012216 screening Methods 0.000 claims abstract description 9
- 230000001174 ascending effect Effects 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 12
- 238000000034 method Methods 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 7
- 230000006978 adaptation Effects 0.000 claims description 5
- 238000012163 sequencing technique Methods 0.000 claims description 4
- 238000000605 extraction Methods 0.000 claims description 2
- 238000004806 packaging method and process Methods 0.000 claims description 2
- 239000003471 mutagenic agent Substances 0.000 claims 2
- 238000005516 engineering process Methods 0.000 abstract description 7
- 230000006870 function Effects 0.000 description 14
- 238000004891 communication Methods 0.000 description 9
- 238000007726 management method Methods 0.000 description 5
- 239000003607 modifier Substances 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000013473 artificial intelligence Methods 0.000 description 3
- 230000003044 adaptive effect Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 239000011800 void material Substances 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000012038 vulnerability analysis Methods 0.000 description 1
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention relates to a fuzzy test technology, and discloses a fuzzy test method based on weighted random, which comprises the following steps: generating a data packet template according to a preset test protocol; extracting a variable field set and a field weight value set corresponding to the variable field set from the data packet template; carrying out weighted random variation on the variable field set according to the field weight set by using a preset weighted random algorithm to obtain a test case; and carrying out automatic test on the test case to obtain a test result. The invention also provides a fuzzy test device based on weighted random, electronic equipment and a computer readable storage medium. By the variable field screening and mutation algorithm and the weighted combination mutation of the variable fields, the efficiency of the fuzzy test can be improved.
Description
Technical Field
The present invention relates to the field of fuzzy test technologies, and in particular, to a fuzzy test method, apparatus, device, and storage medium based on weighted random.
Background
The fuzzy testing (fuzzy testing) technology is one of the security testing technologies, and discovers security problems in software by constructing abnormal input data to cause the software to have exceptions such as crash. The fuzzy test technology has the characteristics of full traversal of all input data, comprehensive code coverage, test automation, effective discovery of safety problems in software and the like, and is widely popular among researchers in the field of vulnerability analysis in information security.
Most of the existing product recommendation technologies are test field random variation based on a simple random algorithm, and then fuzzy test is realized. In practical application, the importance of the fields of the test sample is different, the number of available variation algorithms of each field is large, and the test sample of a simple random algorithm cannot be subjected to key test in a known whole disaster area, so that the efficiency of the fuzzy test is low.
Disclosure of Invention
The invention provides a fuzzy test method, a device, equipment and a storage medium based on weighted randomness, and mainly aims to solve the problem of low efficiency in fuzzy test.
In order to achieve the above object, the present invention provides a fuzzy test method based on weighted random, which comprises:
generating a data packet template according to a preset test protocol;
extracting a variable field set and a field weight value set corresponding to the variable field set from the data packet template;
carrying out weighted random variation on the variable field set according to the field weight set by using a preset weighted random algorithm to obtain a test case;
and carrying out automatic test on the test case to obtain a test result.
In order to solve the above problem, the present invention further provides a fuzzy test apparatus based on weighted random, the apparatus comprising:
the template generating module is used for generating a data packet template according to a preset test protocol;
the field extraction module is used for extracting a variable field set and a field weight value set corresponding to the variable field set from the data packet template;
the weighted variation module is used for carrying out weighted random variation on the variable field set according to the field weight set by utilizing a preset weighted random algorithm to obtain a test case;
and the fuzzy test module is used for carrying out automatic test on the test case to obtain a test result.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and (c) a second step of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the weighted random-based fuzz testing method described above.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the fuzzy test method based on weighted random described above.
According to the embodiment of the invention, the data packet template is generated according to the preset test protocol, so that a normal template file for testing can be obtained, and the subsequent variation test operation is facilitated; the variable field set is extracted from the data packet template, targeted fuzzy testing can be achieved, the field weight set is extracted, it can be guaranteed that a follow-up fuzzy algorithm can achieve key testing in key disaster areas, weighted random variation is conducted on the variable field set according to the field weight set through a preset weighted random algorithm, a test case is obtained, the pertinence of selection can be increased in field selection and variation algorithm selection of the fuzzy testing, and therefore testing efficiency of the fuzzy testing is improved. Therefore, the fuzzy test method, the fuzzy test device, the electronic equipment and the computer readable storage medium based on weighted random provided by the invention can improve the efficiency of the fuzzy test.
Drawings
FIG. 1 is a schematic flowchart of a fuzzy test method based on weighted random according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of a fuzzy test apparatus based on weighted random testing according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device implementing the fuzzy test method based on weighted random according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
The embodiment of the application provides a fuzzy test method based on weighted randomness. The execution subject of the fuzzy test method based on weighted random includes, but is not limited to, at least one of the electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server, a terminal, and the like. In other words, the fuzzy test method based on weighted random may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), and a big data and artificial intelligence platform.
Fig. 1 is a schematic flow chart of a fuzzy test method based on weighted random according to an embodiment of the present invention. In this embodiment, the fuzzy test method based on weighted random includes:
s1, generating a data packet template according to a preset test protocol.
In the embodiment of the present invention, the test protocol refers to a control specification protocol or an industrial control network protocol, for example, an xml format protocol or a TCP communication protocol.
In detail, the packet template refers to normal data files conforming to the test protocol, such as update packets of an application program, data packets for transmission test, and the like.
In the embodiment of the present invention, generating a data packet template according to a preset test protocol includes: capturing a file information stream under a test protocol; acquiring a calibration file generated by calibrating the field type of a file information stream by a user; and packaging the calibration file into a data packet template.
In detail, the file information stream may be a historical data file conforming to the testing protocol, such as a historical version data of the application or a historical xml file.
In detail, obtaining a calibration file generated by calibrating a field type of a file information stream by a user refers to calibrating the field type in the file information stream according to a test protocol by the user, for example, calibrating "public void set Objs (Collection objects)" in the file information stream, where "public" is an access right modifier; "void" is a return value modifier; "setObjs" is a function name modifier; "()" is a function parenthesis modifier; "Collection" and "objs" are function element modifiers.
In the embodiment of the invention, the data packet template is generated according to the preset test protocol, so that a normal template file for testing can be obtained, and the subsequent mutation test operation is facilitated.
And S2, extracting a variable field set and a field weight value set corresponding to the variable field set from the data packet template.
In the embodiment of the invention, the variable field set refers to a set formed by fields which can be used for mutation and fuzz testing in the data packet template.
In detail, the field weight set refers to a data set composed of field weights corresponding to each variable field in the variable field set, wherein the field weights represent the importance of the corresponding variable field.
In the embodiment of the present invention, extracting a variable field set and a field weight value set corresponding to the variable field set from a data packet template includes: extracting a variable field set from the data packet template according to the field type of each field in the data packet template; acquiring a calibration weight set generated by calibrating a field weight of a variable field set by a user; and carrying out weight adaptation on the field weights in the calibration weight set to obtain a field weight set.
In detail, the field type refers to a field type of the calibration file, such as the above-mentioned types of function element, function bracket, and function name.
Specifically, extracting the variable field set from the data packet template according to the field type of each field in the data packet template refers to classifying the field types to obtain the variable field types, and gathering the fields corresponding to the variable field types into the variable field set.
In detail, a preset adaptation algorithm may be used to perform weight adaptation on the field weights in the calibration weight set to obtain a field weight set, for example, the code of the adaptation algorithm Packet is as follows:
wherein, field1 and Field2 are two fields in the variable Field set, the Field value corresponding to Field1 is a, the Field value corresponding to Field2 is b, the Field weight of Field1 is 1, the Field weight of Field2 is 10, and after multiple fuzzy tests, the variation probability of two fields of Field1 and Field2 approaches to 1.
In the embodiment of the invention, the variable field set is extracted from the data packet template, so that the targeted fuzzy test can be realized, and the field weight set is extracted, so that the subsequent fuzzy algorithm can be ensured to realize the key test in key disaster areas.
And S3, carrying out weighted random variation on the variable field set according to the field weight set by utilizing a preset weighted random algorithm to obtain a test case.
In the embodiment of the invention, the test case refers to a data file which is used for carrying out the fuzz test after being mutated.
In the embodiment of the present invention, a preset weighted random algorithm is used to perform weighted random variation on a variable field set according to a field weight set, so as to obtain a test case, where the method includes: generating a field algorithm set and an algorithm weight set corresponding to each field in the variable field set; performing weight ascending sequencing on the field variation algorithms in each field algorithm set according to the algorithm weight set to obtain a field algorithm ascending sequencing set; normalizing the weight of each field in the variable field set according to the field algorithm ascending set and the field weight set to obtain a weighted field set; and carrying out random variation on the weighted field set by using a preset weighted random algorithm to obtain the test case.
Specifically, the field algorithm set refers to a set of all variant algorithms corresponding to one field, where the variant algorithms include reverse variant, substitution variant, and out-of-order variant.
In detail, the algorithm weight set is a set consisting of algorithm weights of all variant algorithms of a field, wherein the algorithm weights are determined by a user-specified or adapted algorithm.
Specifically, generating a corresponding field algorithm set and algorithm weight set for each field in the variable field set means that the fields in the variable field set are selected one by one as target fields, adaptive variant algorithms are selected according to the field types of the target fields, the algorithm weight of each variant algorithm is obtained, all the adaptive variant algorithms form the field algorithm set of the target fields, and all the algorithm weights form the algorithm weight set.
In detail, the method for performing weight ascending sorting on the field variation algorithm in each field algorithm set according to the algorithm weight set to obtain a field algorithm ascending set comprises the following steps: selecting fields in the variable field set one by one as target fields, taking a field algorithm set of the target fields as a target field algorithm set, and taking an algorithm weight set corresponding to the target field algorithm set as a target algorithm weight set; carrying out logarithm processing on each algorithm weight in the target algorithm weight set to obtain a target logarithm weight set; and performing ascending arrangement on the variant algorithms in the target field algorithm set according to the magnitude of the logarithmic weight in the target logarithmic weight set to obtain a field algorithm ascending set.
In detail, performing logarithm processing on each algorithm weight in the target algorithm weight set to obtain a target logarithm weight set means that the algorithm weights are logarithmized to obtain a logarithm weight, for example, when the algorithm weight is 20, the logarithmized logarithm weight may be log a 20, where a can be any constant and all the logarithmic weights are aggregated into a target set of logarithmic weights.
Specifically, each algorithm weight in the target algorithm weight set is subjected to logarithm processing to obtain a target logarithm weight set, so that the measurement scale of the algorithm weight can be reduced, the calculation amount of the algorithm is reduced, and the algorithm efficiency is improved.
In the embodiment of the present invention, normalizing the weight of each field in a variable field set according to a field algorithm ascending set and a field weight set to obtain a weighted field set, including: selecting fields in the variable field set one by one as target fields, and selecting field weights corresponding to the target fields from the field weight set as target field weights; selecting a variation algorithm positioned at the head of the sequence from the ascending set of the field speed algorithm as a target variation algorithm, and taking the logarithmic weight corresponding to the target variation algorithm as a target logarithmic weight; calculating a standard field weight of the target field by using a field weight algorithm as follows: f = Weight mutor, wherein F refers to standard field Weight, weight refers to target field Weight, and mutor refers to target logarithmic Weight; and sorting the fields in the variable field set in an ascending order according to the weight of the standard field to obtain a weighted field set.
In detail, the variation algorithm located at the beginning and the end of the sequence is the variation algorithm with the largest logarithmic weight.
In detail, the random variation is performed on the weighted field set by using a preset weighted random algorithm to obtain a test case, which includes: randomly screening a plurality of fields from the weighted field set by using a preset weighted random algorithm to form a random field set; screening a variation algorithm for each field in the random field set by using a weighted random algorithm to serve as a random variation algorithm; randomly mutating the fields corresponding to the random mutation algorithm one by using the random mutation algorithm to obtain the mutation fields; and replacing the corresponding variable field in the data packet template by using the variable field to obtain the test case.
In detail, a plurality of fields are randomly screened out from the weighted field set by using a preset weighted random algorithm to form a random field set, and the method comprises the following steps: taking the sum of the weights of all the standard fields in the weighted field set as a weight sum, generating a plurality of positive integers smaller than the weight sum by using a random algorithm to form a random number set, and selecting random numbers in the random number set one by one as target random numbers; selecting fields in the weighted field set one by one according to the sequence as target weighted fields, adding preset historical weights to standard field weights of the target weighted fields to obtain target standard weights, and judging whether the target standard weights are larger than or equal to target random numbers or not; when the target standard weight is smaller than the target random number, updating the historical weight by using the target standard weight, and returning to the step of selecting fields in the weighted field set one by one as target weighted fields according to the sequence; when the target criterion weight is greater than or equal to the target random number, the target weighting field is added to the random field set.
In detail, the Golang code of the weighted random algorithm is as follows:
the Choice structure body is used for obtaining fields in the weighted field set and corresponding standard field weights, the NewChooser is used for carrying out ascending arrangement on the fields in the variable field set according to the standard field weights, the serial number is used as a subscript of an array cs, totals is used for calculating the weight sum, rand.
Specifically, a plurality of fields are randomly screened out from the weighted field set by using a weighted random algorithm to form a random field set, so that the efficiency of random screening can be improved, the screening time is saved, and the time complexity of the algorithm is reduced.
In detail, the preset weight value of the history weight is 0.
In detail, the method for screening a mutation algorithm for each field in the random field set as a random mutation algorithm by using a weighted random algorithm is consistent with the method for randomly screening a plurality of fields from the weighted field set to form a random field set by using a preset weighted random algorithm in the above steps, and details are not repeated here.
In the embodiment of the invention, the variable field set is subjected to weighted random variation by utilizing the preset weighted random algorithm according to the field weight set to obtain the test case, and the pertinence of selection can be increased in the field selection and the variation algorithm of the fuzzy test, so that the test efficiency of the fuzzy test is improved.
And S4, carrying out automatic test on the test case to obtain a test result.
In the embodiment of the invention, the test case is automatically tested, the test result is obtained by inputting the test case into a preset fuzzy test program for execution, the execution state of the test case is monitored by using monitoring software, the monitoring result is obtained, and the error analysis is carried out on the monitoring result, so that the test result is obtained.
In detail, the monitoring software may be OSS-fuzzy.
In the embodiment of the invention, the test result is obtained by automatically testing the test case, so that a user can be ensured to more visually detect the data bug, and the efficiency of the fuzzy test is improved.
FIG. 2 is a functional block diagram of a fuzzy test apparatus based on weighted random testing according to an embodiment of the present invention.
The fuzzy test apparatus 200 based on weighted random of the present invention can be installed in an electronic device. According to the implemented functions, the fuzzy test device 200 based on weighted random can include a template generating module 201, a field extracting module 202, a weighted mutation module 203 and a weighted mutation module 204. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions of the respective modules/units are as follows:
the template generating module 201 is configured to generate a data packet template according to a preset test protocol;
a field extracting module 202, configured to extract a variable field set and a field weight set corresponding to the variable field set from a data packet template;
the weighted variation module 203 is configured to perform weighted random variation on the variable field set according to the field weight set by using a preset weighted random algorithm to obtain a test case;
and the fuzzing test module 204 is used for carrying out automatic test on the test case to obtain a test result.
In detail, in the embodiment of the present invention, each module in the fuzzy test apparatus 100 based on weighted random adopts the same technical means as the fuzzy test method based on weighted random in fig. 1, and can generate the same technical effect, which is not described herein again.
Fig. 3 is a schematic structural diagram of an electronic device for implementing a fuzzy test method based on weighted random according to an embodiment of the present invention.
The electronic device 301 may include a processor 310, a memory 311, a communication bus 312, and a communication interface 313, and may further include a computer program, such as a weighted random-based fuzz testing program, stored in the memory 311 and executable on the processor 310.
In some embodiments, the processor 310 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 310 is a Control Unit (Control Unit) of the electronic device, connects various components of the whole electronic device by using various interfaces and lines, executes various functions of the electronic device and processes data by running or executing programs or modules (for example, executing a fuzz test program based on weighted random, etc.) stored in the memory 311, and calling data stored in the memory 311.
The memory 311 includes at least one type of readable storage medium, which includes flash memory, a removable hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 311 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 311 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the electronic device. Further, the memory 311 may also include both an internal storage unit and an external storage device of the electronic device. The memory 311 may be used not only to store application software installed in the electronic device and various types of data, such as code based on a weighted random fuzz test program, etc., but also to temporarily store data that has been output or is to be output.
The communication bus 312 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connected communication between the memory 311 and the at least one processor 310 or the like.
The communication interface 313 is used for communication between the above-described electronic device and other devices, including a network interface and a user interface. Alternatively, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Only electronic devices having components are shown, it will be understood by those skilled in the art that the structures shown in the figures do not constitute limitations on electronic devices, and may include fewer or more components than shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to the various components, and preferably, the power supply may be logically connected to the at least one processor 310 through a power management device, so that functions such as charge management, discharge management, and power consumption management are implemented through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, etc., which are not described herein again.
It is to be understood that the embodiments are for purposes of illustration only and that the scope of the claims is not limited to the disclosed structures.
Specifically, the processor 310 may refer to the description of the relevant steps in the embodiments corresponding to the figures, which is not described herein again.
Further, the modules/units integrated by the electronic device 301, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or nonvolatile. For example, the computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM).
The invention also provides a computer readable storage medium, which stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can realize the fuzzy test method based on weighted random.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a module may be divided into only one logical function, and may be divided into other ways in actual implementation.
Modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 this embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
1. A fuzzy test method based on weighted random is characterized in that the method comprises the following steps:
generating a data packet template according to a preset test protocol;
extracting a variable field set and a field weight value set corresponding to the variable field set from the data packet template;
carrying out weighted random variation on the variable field set according to the field weight set by using a preset weighted random algorithm to obtain a test case;
and carrying out automatic test on the test case to obtain a test result.
2. The fuzzy test method based on weighted random of claim 1, wherein the generating of the packet template according to the predetermined test protocol comprises:
capturing a file information flow under the test protocol;
acquiring a calibration file generated by calibrating the field type of the file information stream by a user;
and packaging the calibration file into a data packet template.
3. The fuzzy test method based on weighted random of claim 1, wherein said extracting a variable field set and a field weight set corresponding to said variable field set from said packet template comprises:
extracting a variable field set from the data packet template according to the field type of each field in the data packet template;
acquiring a calibration weight set generated by the user performing field weight calibration on the variable field set;
and carrying out weight adaptation on the field weights in the calibration weight set to obtain a field weight set.
4. The fuzzy test method based on weighted random of claim 1, wherein said performing weighted random variation on said variable field set according to said field weight set by using a preset weighted random algorithm to obtain a test case comprises:
generating a field algorithm set and an algorithm weight set corresponding to each field in the variable field set;
according to the algorithm weight set, carrying out weight ascending sequencing on the field variation algorithms in each field algorithm set to obtain a field algorithm ascending sequencing set;
normalizing the weight of each field in the variable field set according to the field algorithm ascending set and the field weight set to obtain a weighted field set;
and carrying out random variation on the weighted field set by utilizing a preset weighted random algorithm to obtain a test case.
5. The weighted random-based fuzzy test method of claim 4 wherein said sorting field variation algorithms in each of said field algorithm sets in ascending order of weight according to said algorithm weight set to obtain an ascending field algorithm set comprises:
selecting fields in the variable field set one by one as target fields, taking a field algorithm set of the target fields as a target field algorithm set, and taking an algorithm weight set corresponding to the target field algorithm set as a target algorithm weight set;
carrying out logarithm processing on each algorithm weight in the target algorithm weight set to obtain a target logarithm weight set;
and performing ascending arrangement on the variant algorithms in the target field algorithm set according to the magnitude of the logarithmic weights in the target logarithmic weight set to obtain a field algorithm ascending set.
6. The fuzzy test method based on weighted random of claim 4, wherein the normalizing the weight of each field in the variable field set according to the field algorithm ascending set and the field weight set to obtain a weighted field set comprises:
selecting fields in the variable field set one by one as target fields, and selecting field weights corresponding to the target fields from the field weight set as target field weights;
selecting a variation algorithm positioned at the head of the sequence from the field speed algorithm ascending set as a target variation algorithm, and taking the logarithmic weight corresponding to the target variation algorithm as a target logarithmic weight;
calculating a standard field weight of the target field using a field weight algorithm as follows:
F=Weight*mutator
f refers to the standard field Weight, weight refers to the target field Weight, and mutator refers to the target logarithmic Weight;
and sorting the fields in the variable field set in an ascending order according to the weight of the standard field to obtain a weighted field set.
7. The fuzzy test method based on weighted randomness as claimed in claim 4, wherein said randomly varying said weighted field set by using a preset weighted random algorithm to obtain a test case comprises:
randomly screening a plurality of fields from the weighted field set by using a preset weighted random algorithm to form a random field set;
screening out a variation algorithm for each field in the random field set by using the weighted random algorithm to serve as a random variation algorithm;
randomly mutating the fields corresponding to the random mutation algorithm one by using the random mutation algorithm to obtain mutated fields;
and replacing the corresponding variable field in the data packet template by using the variable field to obtain the test case.
8. A weighted random-based fuzz testing apparatus, the apparatus comprising:
the template generating module is used for generating a data packet template according to a preset test protocol;
the field extraction module is used for extracting a variable field set and a field weight value set corresponding to the variable field set from the data packet template;
the weighted variation module is used for carrying out weighted random variation on the variable field set according to the field weight set by utilizing a preset weighted random algorithm to obtain a test case;
and the fuzzy test module is used for carrying out automatic test on the test case to obtain a test result.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and (c) a second step of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the weighted random based fuzz testing method according to any of claims 1 to 7.
10. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements the weighted random-based fuzz testing method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211433803.7A CN115729815A (en) | 2022-11-16 | 2022-11-16 | Fuzzy test method, device, equipment and storage medium based on weighted random |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211433803.7A CN115729815A (en) | 2022-11-16 | 2022-11-16 | Fuzzy test method, device, equipment and storage medium based on weighted random |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115729815A true CN115729815A (en) | 2023-03-03 |
Family
ID=85295981
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211433803.7A Pending CN115729815A (en) | 2022-11-16 | 2022-11-16 | Fuzzy test method, device, equipment and storage medium based on weighted random |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115729815A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116170357A (en) * | 2023-04-23 | 2023-05-26 | 清华大学 | Fuzzy test method and device for block chain consensus protocol |
CN116881058A (en) * | 2023-07-19 | 2023-10-13 | 凯云联创(北京)科技有限公司 | Fuzzy test method for embedded equipment |
-
2022
- 2022-11-16 CN CN202211433803.7A patent/CN115729815A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116170357A (en) * | 2023-04-23 | 2023-05-26 | 清华大学 | Fuzzy test method and device for block chain consensus protocol |
CN116170357B (en) * | 2023-04-23 | 2023-07-04 | 清华大学 | Fuzzy test method and device for block chain consensus protocol |
CN116881058A (en) * | 2023-07-19 | 2023-10-13 | 凯云联创(北京)科技有限公司 | Fuzzy test method for embedded equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115729815A (en) | Fuzzy test method, device, equipment and storage medium based on weighted random | |
JP6643211B2 (en) | Anomaly detection system and anomaly detection method | |
CN109523752B (en) | Equipment fault early warning method and device, electronic equipment and medium | |
CN112883190A (en) | Text classification method and device, electronic equipment and storage medium | |
CN111343143B (en) | Data identification method, device and storage medium | |
CN112306835A (en) | User data monitoring and analyzing method, device, equipment and medium | |
CN111831708A (en) | Missing data-based sample analysis method and device, electronic equipment and medium | |
CN114781832A (en) | Course recommendation method and device, electronic equipment and storage medium | |
CN113806434A (en) | Big data processing method, device, equipment and medium | |
CN117155771B (en) | Equipment cluster fault tracing method and device based on industrial Internet of things | |
CN113628043A (en) | Complaint validity judgment method, device, equipment and medium based on data classification | |
CN117766067A (en) | AOP solid alkali material performance detection data analysis method and system | |
CN112541688A (en) | Service data checking method and device, electronic equipment and computer storage medium | |
CN112888008A (en) | Base station abnormity detection method, device, equipment and storage medium | |
CN116843395A (en) | Alarm classification method, device, equipment and storage medium of service system | |
CN114841165B (en) | User data analysis and display method and device, electronic equipment and storage medium | |
CN114510405B (en) | Index data evaluation method, apparatus, device, storage medium, and program product | |
CN115314267A (en) | Monitoring method for dealing with webpage faults and webpage bugs | |
CN115659351A (en) | Information security analysis method, system and equipment based on big data office | |
CN115587017A (en) | Data processing method and device, electronic equipment and storage medium | |
CN114978964A (en) | Communication announcement configuration method, device, equipment and medium based on network self-checking | |
CN114942855A (en) | Interface calling method and device, electronic equipment and storage medium | |
CN115344495A (en) | Data analysis method and device for batch task test, computer equipment and medium | |
CN115033489A (en) | Code resource detection method and device, electronic equipment and storage medium | |
CN114513355A (en) | Malicious domain name detection method, device, equipment 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 |