mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
Add standalone driver for fuzz targets
Useful for cases that don't need to use a fuzzing engine, but just run the fuzz targets over some set of inputs, like for regression/CI tests. Also added a POP3 fuzzer dictionary, seed corpus, and README with examples.
This commit is contained in:
parent
8f1b34b915
commit
78b0b2183d
8 changed files with 168 additions and 8 deletions
42
src/fuzzers/fuzzer-setup.h
Normal file
42
src/fuzzers/fuzzer-setup.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "zeek-setup.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Sessions.h"
|
||||
#include "broker/Manager.h"
|
||||
#include "file_analysis/Manager.h"
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
|
||||
{
|
||||
zeek::Options options;
|
||||
options.scripts_to_load.emplace_back("local.zeek");
|
||||
options.script_options_to_set.emplace_back("Site::local_nets={10.0.0.0/8}");
|
||||
options.script_options_to_set.emplace_back("Log::default_writer=Log::WRITER_NONE");
|
||||
options.deterministic_mode = true;
|
||||
options.ignore_checksums = true;
|
||||
options.abort_on_scripting_errors = true;
|
||||
|
||||
if ( zeek::setup(*argc, *argv, &options).code )
|
||||
abort();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace zeek {
|
||||
|
||||
void fuzz_cleanup_one_input()
|
||||
{
|
||||
broker_mgr->ClearStores();
|
||||
file_mgr->Terminate();
|
||||
timer_mgr->Expire();
|
||||
|
||||
mgr.Drain();
|
||||
sessions->Drain();
|
||||
mgr.Drain();
|
||||
sessions->Clear();
|
||||
}
|
||||
|
||||
} // namespace zeek
|
Loading…
Add table
Add a link
Reference in a new issue