Fuzzing method and device based on weighted random, equipment and storage medium

CN115729815BActive Publication Date: 2026-05-29SECZONE TECH CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SECZONE TECH CO LTD
Filing Date
2022-11-16
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing fuzz testing methods are inefficient and cannot perform targeted testing in known critical areas, resulting in low testing efficiency.

Method used

By generating a data package template, extracting the variable field set and its field weight set, and using a weighted random algorithm to mutate it, test cases are generated for automated testing.

Benefits of technology

It improves the efficiency of fuzz testing, enabling targeted testing in key areas and enhancing the relevance and efficiency of the tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115729815B_ABST
    Figure CN115729815B_ABST
Patent Text Reader

Abstract

The application relates to a fuzzy testing technology, and discloses a weighted random-based fuzzy testing method, 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 set corresponding to the variable field set from the data packet template; using a preset weighted random algorithm to perform weighted random mutation on the variable field set according to the field weight set, so as to obtain a test case; and performing automatic test on the test case, so as to obtain a test result. The application further discloses a weighted random-based fuzzy testing device, an electronic device and a computer readable storage medium. Through the variable field screening, the mutation algorithm and the weighted combination mutation of the variable field, the efficiency of the fuzzy testing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fuzz testing technology, and in particular to a fuzz testing method, apparatus, device, and storage medium based on weighted randomness. Background Technology

[0002] Fuzz testing (or fuzzing) is a security testing technique that uses malformed input data to cause software to malfunction, such as crashing, thereby revealing security vulnerabilities. Because fuzz testing can thoroughly traverse all input data, provide comprehensive code coverage, automate the test, and effectively uncover security issues, it is widely welcomed by researchers in the field of vulnerability analysis within information security.

[0003] Existing product recommendation technologies mostly rely on simple random algorithms to randomly mutate test fields, thereby achieving fuzz testing. In practical applications, the importance of fields in the test samples varies, and there are many available mutation algorithms for each field. Simple random algorithms cannot effectively target specific areas with known high-risk conditions, resulting in low efficiency when performing fuzz testing. Summary of the Invention

[0004] This invention provides a weighted random fuzz testing method, apparatus, device, and storage medium, the main purpose of which is to solve the problem of low efficiency in fuzz testing.

[0005] To achieve the above objectives, the present invention provides a fuzzy testing method based on weighted randomness, comprising:

[0006] Generate a data packet template according to the preset test protocol;

[0007] Extract the variable field set and the corresponding field weight set from the data packet template;

[0008] Test cases are obtained by using a preset weighted random algorithm to perform weighted random mutation on the variable field set based on the field weight set;

[0009] The test cases are then subjected to automated testing to obtain the test results.

[0010] To address the above problems, the present invention also provides a fuzzy testing device based on weighted randomness, the device comprising:

[0011] The template generation module is used to generate data packet templates according to a preset test protocol.

[0012] The field extraction module is used to extract a variable field set and a set of field weights corresponding to the variable field set from the data packet template.

[0013] The weighted mutation module is used to perform weighted random mutation on the variable field set according to the field weight set using a preset weighted random algorithm to obtain test cases;

[0014] The fuzz testing module is used to automate the testing of the test cases and obtain test results.

[0015] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:

[0016] At least one processor; and,

[0017] A memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the weighted random fuzz testing method described above.

[0019] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the weighted random fuzz testing method described above.

[0020] This invention generates a data packet template according to a preset test protocol, providing a normal template file for testing and facilitating subsequent mutation testing. By extracting a variable field set from the data packet template, targeted fuzz testing can be achieved. Furthermore, by extracting a field weight set, subsequent fuzzing algorithms can ensure focused testing in key disaster areas. By using a preset weighted random algorithm to perform weighted random mutation on the variable field set based on the field weight set, test cases are obtained. This increases the targeting of field selection and mutation algorithm selection in fuzzing, thereby improving testing efficiency. Therefore, the weighted random fuzzing method, apparatus, electronic device, and computer-readable storage medium proposed in this invention can improve the efficiency of fuzzing testing. Attached Figure Description

[0021] Figure 1 This is a flowchart illustrating a weighted random fuzzy testing method according to an embodiment of the present invention.

[0022] Figure 2 A functional block diagram of a weighted random fuzzy testing device provided in an embodiment of the present invention;

[0023] Figure 3This is a schematic diagram of the structure of an electronic device that implements the weighted random fuzzy testing method according to an embodiment of the present invention.

[0024] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0025] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0026] This application provides a weighted random fuzz testing method. The executing entity of the weighted random fuzz testing method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the weighted random fuzz testing method can be executed by software or hardware installed on a terminal device or a server device; the software can be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cluster of cloud servers. The server can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0027] Reference Figure 1 The diagram shown is a flowchart illustrating a weighted random fuzz testing method according to an embodiment of the present invention. In this embodiment, the weighted random fuzz testing method includes:

[0028] S1. Generate a data packet template according to the preset test protocol.

[0029] In this embodiment of the invention, the test protocol refers to a control specification protocol or an industrial control network protocol, such as an XML format protocol or a TCP communication protocol.

[0030] In detail, a data packet template refers to a normal data file that conforms to the test protocol, such as an application update package or a data packet for transmission testing.

[0031] In this embodiment of the invention, generating a data packet template according to a preset test protocol includes: capturing a file information stream under the test protocol; obtaining a calibration file generated by the user to perform field type calibration on the file information stream; and encapsulating the calibration file into a data packet template.

[0032] In detail, the file information stream can be a historical data file that conforms to the testing protocol, such as historical version data of the application or historical XML files.

[0033] In detail, obtaining the calibration file generated by the user to calibrate the field types of the file information stream refers to the user calibrating the field types in the file information stream according to the test protocol. For example, calibrating "public void setObjs(Collection objs)" in the file information stream: "public" is the access modifier; "void" is the return value modifier; "setObjs" is the function name modifier; "()" is the function parentheses modifier; and "Collection" and "objs" are function element modifiers.

[0034] In this embodiment of the invention, by generating a data packet template according to a preset test protocol, a normal template file for testing can be obtained, which facilitates subsequent mutation testing operations.

[0035] S2. Extract the variable field set and the corresponding field weight set from the data packet template.

[0036] In this embodiment of the invention, the variable field set refers to a set of fields in the data packet template that can be used for fuzz testing through mutation.

[0037] In detail, a field weight set refers to a dataset composed of the field weights of each variable field in a variable field set. The field weights reflect the importance of the corresponding variable field and represent the importance of the field.

[0038] In this embodiment of the invention, extracting a variable field set and a corresponding field weight 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; obtaining a calibration weight set generated by the user to calibrate the field weights of the variable field set; and performing weight adaptation on the field weights in the calibration weight set to obtain the field weight set.

[0039] In detail, the field type refers to the field type of the specification file, such as the function element, function brackets, and function name types mentioned above.

[0040] Specifically, extracting a variable field set from a data packet template based on the field type of each field in the data packet template means classifying the field types to obtain variable field types, and then aggregating the fields corresponding to the variable field types into a variable field set.

[0041] In detail, a pre-defined adaptation algorithm can be used to adapt the field weights in the calibration weight set to obtain the field weight set. For example, the code for the Packet adaptation algorithm is as follows:

[0042]

[0043] In this context, Field1 and Field2 are two fields in a variable field set. Field1 has a value of 'a' and Field2 has a value of 'b'. Field1 has a weight of 1 and Field2 has a weight of 10. After multiple fuzz tests, the mutation probability of Field1 and Field2 will approach 1:10.

[0044] In this embodiment of the invention, by extracting a variable field set from the data packet template, targeted fuzz testing can be achieved, and by extracting the field weight set, it can be ensured that the subsequent fuzzy algorithm can perform key testing in key disaster areas.

[0045] S3. Using a preset weighted random algorithm, perform weighted random mutation on the variable field set according to the field weight set to obtain test cases.

[0046] In this embodiment of the invention, a test case refers to a data file that has been modified for fuzz testing.

[0047] In this embodiment of the invention, a preset weighted random algorithm is used to perform weighted random mutation on a variable field set according to the field weight set to obtain test cases. This includes: generating a field algorithm set and an algorithm weight set for each field in the variable field set; sorting the field mutation algorithms in each field algorithm set in ascending order according to the algorithm weight set to obtain an ascending order set of field algorithms; normalizing the weight of each field in the variable field set according to the ascending order set of field algorithms and the field weight set to obtain a weighted field set; and performing random mutation on the weighted field set using a preset weighted random algorithm to obtain test cases.

[0048] Specifically, a field algorithm set refers to the collection of all mutation algorithms corresponding to a field, including reverse mutation, replacement mutation, and out-of-order mutation.

[0049] In detail, the algorithm weight set is a collection of algorithm weights for all mutation algorithms of a field, where the algorithm weights are specified by the user or determined by the adapted algorithm.

[0050] In detail, generating a corresponding field algorithm set and algorithm weight set for each field in the variable field set means selecting each field in the variable field set as the target field, selecting an appropriate mutation algorithm according to the field type of the target field, obtaining the algorithm weight of each mutation algorithm, forming a field algorithm set for the target field from all the appropriate mutation algorithms, and forming an algorithm weight set from all the algorithm weights.

[0051] In detail, the field mutation algorithms in each field algorithm set are sorted in ascending order of weights according to the algorithm weight set to obtain the field algorithm ascending set. This includes: selecting each field in the variable field set as the target field, taking the field algorithm set of the target field as the target field algorithm set, and taking the algorithm weight set corresponding to the target field algorithm set as the target algorithm weight set; performing logarithmic processing on each algorithm weight in the target algorithm weight set to obtain the target logarithmic weight set; and sorting the mutation algorithms in the target field algorithm set in ascending order according to the magnitude of the logarithmic weights in the target logarithmic weight set to obtain the field algorithm ascending set.

[0052] In detail, performing logarithmic processing on each algorithm weight in the target algorithm weight set to obtain the target logarithmic weight set means logarithmizing the algorithm weights to obtain logarithmic weights. For example, when the algorithm weight is 20, the logarithmized logarithmic weights can be log... a 20, where a can be any constant, and all logarithmic weights are aggregated into a target logarithmic weight set.

[0053] Specifically, by performing logarithmic processing on each algorithm weight in the target algorithm weight set to obtain the target logarithmic weight set, the measurement scale of the algorithm weights can be reduced, the computational load of the algorithm can be reduced, and the algorithm efficiency can be improved.

[0054] In this embodiment of the invention, the weights of each field in the variable field set are normalized according to the ascending order set of field algorithms and the set of field weights to obtain a weighted field set. This includes: selecting each field in the variable field set as a target field, selecting the field weight corresponding to the target field from the set of field weights as the target field weight; selecting the mutation algorithm at the first position in the sequence from the ascending order set of field algorithm sequences as the target mutation algorithm, and using the logarithmic weight corresponding to the target mutation algorithm as the target logarithmic weight; calculating the standard field weight of the target field using the following field weight algorithm: F = Weight * mutator, where 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 ascending order according to the size of the standard field weights to obtain the weighted field set.

[0055] In detail, the mutation algorithm at the beginning and end of the sequence is the mutation algorithm with the largest logarithmic weight.

[0056] In detail, test cases are obtained by randomly mutating a weighted field set using a preset weighted random algorithm, including: randomly selecting multiple fields from the weighted field set to form a random field set using the preset weighted random algorithm; selecting a mutation algorithm for each field in the random field set as a random mutation algorithm using the weighted random algorithm; randomly mutating the fields corresponding to the random mutation algorithms one by one using the random mutation algorithms to obtain mutated fields; and replacing the corresponding variable fields in the data packet template with the mutated fields to obtain test cases.

[0057] In detail, a pre-defined weighted random algorithm is used to randomly select multiple fields from a weighted field set to form a random field set. This includes: taking the sum of the weights of all standard fields in the weighted field set as the total weight, generating a set of random numbers composed of multiple positive integers less than the total weight using a random algorithm, and selecting random numbers from the random number set one by one as the target random number; selecting fields from the weighted field set one by one as the target weighted field in order, adding the standard field weight of the target weighted field to the pre-defined historical weight to obtain the target standard weight, and determining whether the target standard weight is greater than or equal to the target random number; when the target standard weight is less than the target random number, updating the historical weight using the target standard weight, and returning to the step of selecting fields from the weighted field set one by one as the target weighted field in order; when the target standard weight is greater than or equal to the target random number, adding the target weighted field to the random field set.

[0058] The detailed Golang code for the weighted random algorithm is as follows:

[0059]

[0060]

[0061] The `Choice` structure is used to obtain the fields in the weighted field set and their corresponding standard field weights. `NewChooser` is used to sort the fields in the variable field set in ascending order according to the size of the standard field weights, and use the sequence number as the index of the array `cs`. `totals` is used to calculate the total weights. `rand.Intn` is used to generate a positive integer `r` that is less than the total weights. `sort.SearchInts` is used to use a binary search method to determine whether the target standard weight is greater than or equal to the target random number, and thus determine the random field set.

[0062] Specifically, by using a weighted random algorithm to randomly select multiple fields from a weighted field set to form a random field set, the efficiency of random selection can be improved, selection time can be saved, and the time complexity of the algorithm can be reduced.

[0063] Specifically, the preset historical weights have a weight value of 0.

[0064] In detail, the method of using a weighted random algorithm to select mutation algorithms for each field in the random field set as random mutation algorithms is the same as the method described above of using a preset weighted random algorithm to randomly select multiple fields from the weighted field set to form a random field set, and will not be repeated here.

[0065] In this embodiment of the invention, test cases are obtained by using a preset weighted random algorithm to perform weighted random mutation on a variable field set according to the field weight set. This can increase the targeting of field selection and mutation algorithm selection in fuzzing, thereby improving the testing efficiency of fuzzing.

[0066] S4. Perform automated testing on the test cases and obtain the test results.

[0067] In this embodiment of the invention, automating the testing of test cases and obtaining test results means inputting the test cases into a preset fuzzing program for execution, using monitoring software to monitor the execution status of the test cases, obtaining monitoring results, and performing error analysis on the monitoring results to obtain the test results.

[0068] Specifically, the monitoring software may be OSS-Fuzz.

[0069] In this embodiment of the invention, by automating the testing of test cases and obtaining test results, users can be more intuitively detected to detect data vulnerabilities, thereby improving the efficiency of fuzz testing.

[0070] like Figure 2 The diagram shown is a functional block diagram of a weighted random fuzzy testing device provided in an embodiment of the present invention.

[0071] The weighted random fuzzy testing device 200 of this invention can be installed in an electronic device. Depending on the functions implemented, the weighted random fuzzy testing device 200 may include a template generation module 201, a field extraction module 202, a weighted mutation module 203, and a weighted mutation module 204. A module of this invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which are stored in the memory of the electronic device.

[0072] In this embodiment, the functions of each module / unit are as follows:

[0073] Template generation module 201 is used to generate data packet templates according to a preset test protocol;

[0074] The field extraction module 202 is used to extract the variable field set and the corresponding field weight set from the data packet template.

[0075] The weighted mutation module 203 is used to perform weighted random mutation on the variable field set according to the field weight set using a preset weighted random algorithm to obtain test cases;

[0076] The fuzz testing module 204 is used to automate the testing of test cases and obtain test results.

[0077] In detail, each module in the weighted random fuzzy testing device 100 in this embodiment of the invention adopts the same approach as described above when in use. Figure 1 The method uses the same techniques as the weighted random fuzzy testing method in the text and can produce the same technical effects, so it will not be elaborated here.

[0078] like Figure 3 The diagram shown is a structural schematic of an electronic device that implements a weighted random fuzzy testing method according to an embodiment of the present invention.

[0079] Electronic device 301 may include processor 310, memory 311, communication bus 312 and communication interface 313, and may also include computer programs stored in memory 311 and executable on processor 310, such as a weighted random fuzz test program.

[0080] In some embodiments, the processor 310 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 310 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 311 (e.g., executing a weighted random fuzzy test program) and calls data stored in the memory 311 to perform various functions of the electronic device and process data.

[0081] The memory 311 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 311 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 311 can be an external storage device of the electronic device, such as a plug-in portable hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc. Furthermore, the memory 311 can include both internal and external storage units of the electronic device. The memory 311 can be used not only to store application software and various types of data installed on the electronic device, such as the code of a weighted random fuzzy testing program, but also to temporarily store data that has been output or will be output.

[0082] The communication bus 312 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to implement communication between the memory 311 and at least one processor 310, etc.

[0083] Communication interface 313 is used for communication between the aforementioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), and optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.

[0084] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0085] For example, although not shown, the electronic device may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to at least one processor 310 via a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power sources, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0086] It should be understood that the embodiments are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

[0087] Specifically, the processor 310's specific implementation method of the above instructions can be found in the description of the relevant steps in the corresponding embodiments of the accompanying drawings, and will not be repeated here.

[0088] Furthermore, if the modules / units integrated in electronic device 301 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, a computer-readable medium may include: any entity or device capable of carrying computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0089] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can implement the above-described weighted random fuzzy testing method.

[0090] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0091] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0092] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0093] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0094] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.

[0095] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0096] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A fuzzy testing method based on weighted randomness, characterized in that, The method includes: Generate a data packet template according to the preset test protocol; Extract the variable field set and the corresponding field weight set from the data packet template; Test cases are obtained by using a preset weighted random algorithm to perform weighted random mutation on the variable field set based on the field weight set; The test cases are then subjected to automated testing to obtain the test results. The step of extracting the variable field set and the corresponding field weight set from the data packet template includes: extracting the variable field set from the data packet template according to the field type of each field in the data packet template; obtaining the calibration weight set generated by the user calibrating the field weights of the variable field set; and performing weight adaptation on the field weights in the calibration weight set to obtain the field weight set. The step of using a preset weighted random algorithm to perform weighted random mutation on the variable field set according to the field weight set to obtain test cases includes: generating a field algorithm set and an algorithm weight set corresponding to each field in the variable field set; sorting the field mutation algorithms in each field algorithm set in ascending order according to the algorithm weight set to obtain an ascending order set of field algorithms; normalizing the weight of each field in the variable field set according to the ascending order set of field algorithms and the field weight set to obtain a weighted field set; and performing random mutation on the weighted field set using a preset weighted random algorithm to obtain test cases.

2. The fuzzy testing method based on weighted randomness as described in claim 1, characterized in that, The step of generating a data packet template according to a preset test protocol includes: Capture the file information stream under the aforementioned test protocol; Obtain the calibration file generated by the user performing field type calibration on the file information stream; The calibration file is encapsulated into a data packet template.

3. The fuzzy testing method based on weighted randomness as described in claim 1, characterized in that, The step of sorting the field mutation algorithms in each field algorithm set in ascending order according to the algorithm weight set to obtain an ascending set of field algorithms includes: Each field in the variable field set is selected as the target field, the algorithm set of the target field is taken as the target field algorithm set, and the algorithm weight set corresponding to the target field algorithm set is taken as the target algorithm weight set. Logarithmic processing is performed on each algorithm weight in the target algorithm weight set to obtain the target logarithmic weight set; The mutation algorithms in the target field algorithm set are sorted in ascending order according to the logarithmic weights in the target logarithmic weight set to obtain the field algorithm ascending set.

4. The fuzzy testing method based on weighted randomness as described in claim 1, characterized in that, The step of normalizing the weights of each field in the variable field set according to the ascending set of the field algorithm and the field weight set to obtain a weighted field set includes: Each field in the variable field set is selected as the target field, and the field weight corresponding to the target field is selected from the field weight set as the target field weight. Select the mutation algorithm located at the first position in the sequence from the ascending set of the field algorithms as the target mutation algorithm, and use the log weight corresponding to the target mutation algorithm as the target log weight; The standard field weight of the target field is calculated using the following field weighting algorithm: in, This refers to the weight of the standard field. This refers to the weight of the target field. This refers to the target logarithmic weight; The fields in the variable field set are sorted in ascending order according to the weight of the standard field to obtain the weighted field set.

5. The fuzzy testing method based on weighted randomness as described in claim 1, characterized in that, The step of randomly mutating the weighted field set using a preset weighted random algorithm to obtain test cases includes: A random field set is formed by randomly selecting multiple fields from the weighted field set using a preset weighted random algorithm; The weighted random algorithm is used to select mutation algorithms for each field in the random field set as random mutation algorithms; The fields corresponding to the random mutation algorithm are randomly mutated one by one using the random mutation algorithm to obtain the mutated fields; The test cases are obtained by replacing the corresponding variable fields in the data packet template with the mutated fields.

6. A fuzzy testing device based on weighted randomness, characterized in that, The device includes: The template generation module is used to generate data packet templates according to a preset test protocol. The field extraction module is used to extract a variable field set and a corresponding field weight set from the data packet template. The extraction of the variable field set and corresponding field weight set from the data packet template includes: extracting the variable field set from the data packet template according to the field type of each field; obtaining a calibration weight set generated by the user calibrating the field weights of the variable field set; and performing weight adaptation on the field weights in the calibration weight set to obtain the field weight set. The weighted mutation module is used to perform weighted random mutation on the variable field set according to the field weight set using a preset weighted random algorithm to obtain test cases. The step of performing weighted random mutation on the variable field set according to the field weight set using the preset weighted random algorithm to obtain test cases includes: generating a field algorithm set and an algorithm weight set corresponding to each field in the variable field set; sorting the field mutation algorithms in each field algorithm set in ascending order according to the algorithm weight set to obtain an ascending order set of field algorithms; normalizing the weight of each field in the variable field set according to the ascending order set of field algorithms and the field weight set to obtain a weighted field set; and performing random mutation on the weighted field set using the preset weighted random algorithm to obtain test cases. The fuzz testing module is used to automate the testing of the test cases and obtain test results.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the weighted random fuzz testing method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the weighted random fuzz testing method as described in any one of claims 1 to 5.