The invention focuses on the field of
fuzz testing, and particularly relates to intelligent auxiliary
fuzz testing drive
code generation by using a large
language model. The invention provides a convenient, fast and automatic fuzz test driving
code generation method for Python
library code fuzz test by using a large
language model and combining a test function and a sample code. The method comprises the steps that Python
library source code analysis and drive code sample
information extraction are conducted through a
static analysis tool, and a
data set of a test function and a sample code is obtained; constructing a prompt word
engineering structure comprising a drive sample code, a generation task description, a variation strategy introduction, a test function information set, a drive sample code and a code
standardization description, and generating zero-sample, less-sample and thinking chain prompts according to the number of samples; building a large
language model agent end, transmitting cue words to open-source and closed-source large language models in an HTTP / HTTPS (Hyper Text Transfer Protocol / Hyper Text Transfer Protocol Secure Socket) message mode, and performing reasoning generation of fuzzy test driving codes; after the drive codes are obtained, the fuzz test drive codes which do not pass the
pilot run test are generated and screened for multiple rounds, and finally a fuzz test drive code set to be subjected to
vulnerability mining is obtained; and performing
vulnerability mining on the test function by utilizing the obtained fuzzy test driving code set, and storing a result to a
database for analysis.