mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
--event-trace / -E option to generate event trace
This commit is contained in:
parent
39cbd7a9dc
commit
ecd273c3ca
3 changed files with 16 additions and 5 deletions
|
@ -114,6 +114,8 @@ void usage(const char* prog, int code)
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, " -C|--no-checksums | ignore checksums\n");
|
fprintf(stderr, " -C|--no-checksums | ignore checksums\n");
|
||||||
fprintf(stderr, " -D|--deterministic | initialize random seeds to zero\n");
|
fprintf(stderr, " -D|--deterministic | initialize random seeds to zero\n");
|
||||||
|
fprintf(stderr, " -E|--event-trace <file> | generate a replayable event trace to "
|
||||||
|
"the given file\n");
|
||||||
fprintf(stderr, " -F|--force-dns | force DNS\n");
|
fprintf(stderr, " -F|--force-dns | force DNS\n");
|
||||||
fprintf(stderr, " -G|--load-seeds <file> | load seeds from given file\n");
|
fprintf(stderr, " -G|--load-seeds <file> | load seeds from given file\n");
|
||||||
fprintf(stderr, " -H|--save-seeds <file> | save seeds to given file\n");
|
fprintf(stderr, " -H|--save-seeds <file> | save seeds to given file\n");
|
||||||
|
@ -380,6 +382,7 @@ Options parse_cmdline(int argc, char** argv)
|
||||||
{"no-checksums", no_argument, nullptr, 'C'},
|
{"no-checksums", no_argument, nullptr, 'C'},
|
||||||
{"force-dns", no_argument, nullptr, 'F'},
|
{"force-dns", no_argument, nullptr, 'F'},
|
||||||
{"deterministic", no_argument, nullptr, 'D'},
|
{"deterministic", no_argument, nullptr, 'D'},
|
||||||
|
{"event-trace", required_argument, nullptr, 'E'},
|
||||||
{"load-seeds", required_argument, nullptr, 'G'},
|
{"load-seeds", required_argument, nullptr, 'G'},
|
||||||
{"save-seeds", required_argument, nullptr, 'H'},
|
{"save-seeds", required_argument, nullptr, 'H'},
|
||||||
{"print-plugins", no_argument, nullptr, 'N'},
|
{"print-plugins", no_argument, nullptr, 'N'},
|
||||||
|
@ -400,7 +403,7 @@ Options parse_cmdline(int argc, char** argv)
|
||||||
{"mem-profile", no_argument, nullptr, 'M'},
|
{"mem-profile", no_argument, nullptr, 'M'},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{"pseudo-realtime", optional_argument, nullptr, 'E'},
|
{"pseudo-realtime", optional_argument, nullptr, '~'},
|
||||||
{"jobs", optional_argument, nullptr, 'j'},
|
{"jobs", optional_argument, nullptr, 'j'},
|
||||||
{"test", no_argument, nullptr, '#'},
|
{"test", no_argument, nullptr, '#'},
|
||||||
|
|
||||||
|
@ -408,7 +411,7 @@ Options parse_cmdline(int argc, char** argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
char opts[256];
|
char opts[256];
|
||||||
util::safe_strncpy(opts, "B:c:e:f:G:H:I:i:j::n:O:0:o:p:r:s:T:t:U:w:X:CDFMNPQSWabdhmuv",
|
util::safe_strncpy(opts, "B:c:E:e:f:G:H:I:i:j::n:O:0:o:p:r:s:T:t:U:w:X:CDFMNPQSWabdhmuv",
|
||||||
sizeof(opts));
|
sizeof(opts));
|
||||||
|
|
||||||
int op;
|
int op;
|
||||||
|
@ -523,9 +526,7 @@ Options parse_cmdline(int argc, char** argv)
|
||||||
rval.deterministic_mode = true;
|
rval.deterministic_mode = true;
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
rval.pseudo_realtime = 1.0;
|
rval.event_trace_file = optarg;
|
||||||
if ( optarg )
|
|
||||||
rval.pseudo_realtime = atof(optarg);
|
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
if ( rval.dns_mode != detail::DNS_DEFAULT )
|
if ( rval.dns_mode != detail::DNS_DEFAULT )
|
||||||
|
@ -586,6 +587,12 @@ Options parse_cmdline(int argc, char** argv)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
case '~':
|
||||||
|
rval.pseudo_realtime = 1.0;
|
||||||
|
if ( optarg )
|
||||||
|
rval.pseudo_realtime = atof(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case '#':
|
case '#':
|
||||||
fprintf(stderr, "ERROR: --test only allowed as first argument.\n");
|
fprintf(stderr, "ERROR: --test only allowed as first argument.\n");
|
||||||
usage(zargs[0], 1);
|
usage(zargs[0], 1);
|
||||||
|
|
|
@ -73,6 +73,7 @@ struct Options
|
||||||
std::optional<std::string> process_status_file;
|
std::optional<std::string> process_status_file;
|
||||||
std::optional<std::string> zeekygen_config_file;
|
std::optional<std::string> zeekygen_config_file;
|
||||||
std::optional<std::string> unprocessed_output_file;
|
std::optional<std::string> unprocessed_output_file;
|
||||||
|
std::optional<std::string> event_trace_file;
|
||||||
|
|
||||||
std::set<std::string> plugins_to_load;
|
std::set<std::string> plugins_to_load;
|
||||||
std::vector<std::string> scripts_to_load;
|
std::vector<std::string> scripts_to_load;
|
||||||
|
|
|
@ -670,6 +670,9 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
||||||
};
|
};
|
||||||
auto ipbb = make_intrusive<BuiltinFunc>(init_bifs, ipbid->Name(), false);
|
auto ipbb = make_intrusive<BuiltinFunc>(init_bifs, ipbid->Name(), false);
|
||||||
|
|
||||||
|
if ( options.event_trace_file )
|
||||||
|
etm = make_unique<EventTraceMgr>(*options.event_trace_file);
|
||||||
|
|
||||||
run_state::is_parsing = true;
|
run_state::is_parsing = true;
|
||||||
yyparse();
|
yyparse();
|
||||||
run_state::is_parsing = false;
|
run_state::is_parsing = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue