mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Merge branch 'topic/robin/dynamic-plugins-2.3' into topic/robin/pktsrc
This commit is contained in:
commit
191b63e334
279 changed files with 10030 additions and 1258 deletions
69
src/main.cc
69
src/main.cc
|
@ -200,6 +200,7 @@ void usage()
|
|||
fprintf(stderr, " -N|--print-plugins | print available plugins and exit (-NN for verbose)\n");
|
||||
fprintf(stderr, " -O|--optimize | optimize policy script\n");
|
||||
fprintf(stderr, " -P|--prime-dns | prime DNS\n");
|
||||
fprintf(stderr, " -Q|--time | print execution time summary to stderr\n");
|
||||
fprintf(stderr, " -R|--replay <events.bst> | replay events\n");
|
||||
fprintf(stderr, " -S|--debug-rules | enable rule debugging\n");
|
||||
fprintf(stderr, " -T|--re-level <level> | set 'RE_level' for rules\n");
|
||||
|
@ -222,8 +223,9 @@ void usage()
|
|||
fprintf(stderr, " -n|--idmef-dtd <idmef-msg.dtd> | specify path to IDMEF DTD file\n");
|
||||
#endif
|
||||
|
||||
fprintf(stderr, " $BROPATH | file search path (%s)\n", bro_path());
|
||||
fprintf(stderr, " $BROPATH | file search path (%s)\n", bro_path().c_str());
|
||||
fprintf(stderr, " $BROMAGIC | libmagic mime magic database search path (%s)\n", bro_magic_path());
|
||||
fprintf(stderr, " $BRO_PLUGIN_PATH | plugin search path (%s)\n", bro_plugin_path());
|
||||
fprintf(stderr, " $BRO_PREFIXES | prefix list (%s)\n", bro_prefixes().c_str());
|
||||
fprintf(stderr, " $BRO_DNS_FAKE | disable DNS lookups (%s)\n", bro_dns_fake());
|
||||
fprintf(stderr, " $BRO_SEED_FILE | file to load seeds from (not set)\n");
|
||||
|
@ -441,6 +443,8 @@ int main(int argc, char** argv)
|
|||
{
|
||||
std::set_new_handler(bro_new_handler);
|
||||
|
||||
double time_start = current_time(true);
|
||||
|
||||
brofiler.ReadStats();
|
||||
|
||||
bro_argc = argc;
|
||||
|
@ -470,6 +474,7 @@ int main(int argc, char** argv)
|
|||
int rule_debug = 0;
|
||||
int RE_level = 4;
|
||||
int print_plugins = 0;
|
||||
int time_bro = 0;
|
||||
|
||||
static struct option long_opts[] = {
|
||||
{"bare-mode", no_argument, 0, 'b'},
|
||||
|
@ -551,7 +556,7 @@ int main(int argc, char** argv)
|
|||
opterr = 0;
|
||||
|
||||
char opts[256];
|
||||
safe_strncpy(opts, "B:D:e:f:I:i:K:l:n:p:R:r:s:T:t:U:w:x:X:y:Y:z:CFGLNOPSWbdghv",
|
||||
safe_strncpy(opts, "B:D:e:f:I:i:K:l:n:p:R:r:s:T:t:U:w:x:X:y:Y:z:CFGLNOPSWbdghvZQ",
|
||||
sizeof(opts));
|
||||
|
||||
#ifdef USE_PERFTOOLS_DEBUG
|
||||
|
@ -680,6 +685,10 @@ int main(int argc, char** argv)
|
|||
dns_type = DNS_PRIME;
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
time_bro = 1;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
events_file = optarg;
|
||||
break;
|
||||
|
@ -766,6 +775,7 @@ int main(int argc, char** argv)
|
|||
|
||||
reporter = new Reporter();
|
||||
thread_mgr = new threading::Manager();
|
||||
plugin_mgr = new plugin::Manager();
|
||||
|
||||
#ifdef DEBUG
|
||||
if ( debug_streams )
|
||||
|
@ -818,6 +828,8 @@ int main(int argc, char** argv)
|
|||
if ( ! bare_mode )
|
||||
add_input_file("base/init-default.bro");
|
||||
|
||||
plugin_mgr->SearchDynamicPlugins(bro_plugin_path());
|
||||
|
||||
if ( optind == argc &&
|
||||
read_files.length() == 0 && flow_files.length() == 0 &&
|
||||
interfaces.length() == 0 &&
|
||||
|
@ -850,7 +862,6 @@ int main(int argc, char** argv)
|
|||
analyzer_mgr = new analyzer::Manager();
|
||||
log_mgr = new logging::Manager();
|
||||
input_mgr = new input::Manager();
|
||||
plugin_mgr = new plugin::Manager();
|
||||
file_mgr = new file_analysis::Manager();
|
||||
iosource_mgr = new iosource::Manager();
|
||||
|
||||
|
@ -859,6 +870,9 @@ int main(int argc, char** argv)
|
|||
file_mgr->InitPreScript();
|
||||
broxygen_mgr->InitPreScript();
|
||||
|
||||
if ( ! bare_mode )
|
||||
plugin_mgr->ActivateAllDynamicPlugins();
|
||||
|
||||
if ( events_file )
|
||||
event_player = new EventPlayer(events_file);
|
||||
|
||||
|
@ -887,6 +901,14 @@ int main(int argc, char** argv)
|
|||
|
||||
yyparse();
|
||||
|
||||
init_general_global_var();
|
||||
init_net_var();
|
||||
|
||||
plugin_mgr->InitBifs();
|
||||
|
||||
if ( reporter->Errors() > 0 )
|
||||
exit(1);
|
||||
|
||||
plugin_mgr->InitPostScript();
|
||||
analyzer_mgr->InitPostScript();
|
||||
file_mgr->InitPostScript();
|
||||
|
@ -898,6 +920,9 @@ int main(int argc, char** argv)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
analyzer_mgr->InitPostScript();
|
||||
file_mgr->InitPostScript();
|
||||
|
||||
#ifdef USE_PERFTOOLS_DEBUG
|
||||
}
|
||||
#endif
|
||||
|
@ -1077,7 +1102,7 @@ int main(int argc, char** argv)
|
|||
if ( ! reading_live && ! reading_traces )
|
||||
// Set up network_time to track real-time, since
|
||||
// we don't have any other source for it.
|
||||
network_time = current_time();
|
||||
net_update_time(current_time());
|
||||
|
||||
EventHandlerPtr bro_init = internal_handler("bro_init");
|
||||
if ( bro_init ) //### this should be a function
|
||||
|
@ -1163,7 +1188,43 @@ int main(int argc, char** argv)
|
|||
|
||||
#endif
|
||||
|
||||
double time_net_start = current_time(true);;
|
||||
|
||||
unsigned int mem_net_start_total;
|
||||
unsigned int mem_net_start_malloced;
|
||||
|
||||
if ( time_bro )
|
||||
{
|
||||
get_memory_usage(&mem_net_start_total, &mem_net_start_malloced);
|
||||
|
||||
fprintf(stderr, "# initialization %.6f\n", time_net_start - time_start);
|
||||
|
||||
fprintf(stderr, "# initialization %uM/%uM\n",
|
||||
mem_net_start_total / 1024 / 1024,
|
||||
mem_net_start_malloced / 1024 / 1024);
|
||||
}
|
||||
|
||||
net_run();
|
||||
|
||||
double time_net_done = current_time(true);;
|
||||
|
||||
unsigned int mem_net_done_total;
|
||||
unsigned int mem_net_done_malloced;
|
||||
|
||||
if ( time_bro )
|
||||
{
|
||||
get_memory_usage(&mem_net_done_total, &mem_net_done_malloced);
|
||||
|
||||
fprintf(stderr, "# total time %.6f, processing %.6f\n",
|
||||
time_net_done - time_start, time_net_done - time_net_start);
|
||||
|
||||
fprintf(stderr, "# total mem %uM/%uM, processing %uM/%uM\n",
|
||||
mem_net_done_total / 1024 / 1024,
|
||||
mem_net_done_malloced / 1024 / 1024,
|
||||
(mem_net_done_total - mem_net_start_total) / 1024 / 1024,
|
||||
(mem_net_done_malloced - mem_net_start_malloced) / 1024 / 1024);
|
||||
}
|
||||
|
||||
done_with_network();
|
||||
net_delete();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue