mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 20:48:21 +00:00
Add basic structure for fuzzing targets
General changes: * Add -D/--deterministic command line option as convenience/alternative to -G/--load-seeds (i.e. no file needed, it just uses zero-initialized random seeds). It also changes Broker data stores over to using deterministic timing rather than real time. * Add option to make Reporter abort on runtime scripting errors
This commit is contained in:
parent
f849571910
commit
8f1b34b915
20 changed files with 1290 additions and 928 deletions
41
src/fuzzers/fuzz-setup.h
Normal file
41
src/fuzzers/fuzz-setup.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
#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.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