mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Enabling to specific a set of plugins with the -N option.
Bro will then print information only about the plugins specified.
This commit is contained in:
parent
58fbee5701
commit
55de5c60f4
2 changed files with 27 additions and 14 deletions
2
cmake
2
cmake
|
@ -1 +1 @@
|
||||||
Subproject commit 7fcf13fff1f2a5c08fba2821f848ab490032d617
|
Subproject commit 39bb3cd8b4ce49b3fea2e0e12919d2385e870065
|
39
src/main.cc
39
src/main.cc
|
@ -116,6 +116,7 @@ SecondaryPath* secondary_path = 0;
|
||||||
extern char version[];
|
extern char version[];
|
||||||
char* command_line_policy = 0;
|
char* command_line_policy = 0;
|
||||||
vector<string> params;
|
vector<string> params;
|
||||||
|
set<string> requested_plugins;
|
||||||
char* proc_status_file = 0;
|
char* proc_status_file = 0;
|
||||||
int snaplen = 0; // this gets set from the scripting-layer's value
|
int snaplen = 0; // this gets set from the scripting-layer's value
|
||||||
|
|
||||||
|
@ -250,14 +251,14 @@ void usage()
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_plugins(int level)
|
bool show_plugins(int level)
|
||||||
{
|
{
|
||||||
plugin::Manager::plugin_list plugins = plugin_mgr->ActivePlugins();
|
plugin::Manager::plugin_list plugins = plugin_mgr->ActivePlugins();
|
||||||
|
|
||||||
if ( ! plugins.size() )
|
if ( ! plugins.size() )
|
||||||
{
|
{
|
||||||
printf("No plugins registered, not even any built-ins. This is probably a bug.\n");
|
printf("No plugins registered, not even any built-ins. This is probably a bug.\n");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ODesc d;
|
ODesc d;
|
||||||
|
@ -265,29 +266,39 @@ void show_plugins(int level)
|
||||||
if ( level == 1 )
|
if ( level == 1 )
|
||||||
d.SetShort();
|
d.SetShort();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
for ( plugin::Manager::plugin_list::const_iterator i = plugins.begin(); i != plugins.end(); i++ )
|
for ( plugin::Manager::plugin_list::const_iterator i = plugins.begin(); i != plugins.end(); i++ )
|
||||||
{
|
{
|
||||||
|
if ( requested_plugins.size()
|
||||||
|
&& requested_plugins.find((*i)->Name()) == requested_plugins.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
(*i)->Describe(&d);
|
(*i)->Describe(&d);
|
||||||
|
|
||||||
if ( ! d.IsShort() )
|
if ( ! d.IsShort() )
|
||||||
d.Add("\n");
|
d.Add("\n");
|
||||||
|
|
||||||
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s", d.Description());
|
printf("%s", d.Description());
|
||||||
|
|
||||||
plugin::Manager::inactive_plugin_list inactives = plugin_mgr->InactivePlugins();
|
plugin::Manager::inactive_plugin_list inactives = plugin_mgr->InactivePlugins();
|
||||||
|
|
||||||
if ( ! inactives.size() )
|
if ( inactives.size() && ! requested_plugins.size() )
|
||||||
return;
|
|
||||||
|
|
||||||
printf("\nInactive dynamic plugins:\n");
|
|
||||||
|
|
||||||
for ( plugin::Manager::inactive_plugin_list::const_iterator i = inactives.begin(); i != inactives.end(); i++ )
|
|
||||||
{
|
{
|
||||||
string name = (*i).first;
|
printf("\nInactive dynamic plugins:\n");
|
||||||
string path = (*i).second;
|
|
||||||
printf(" %s (%s)\n", name.c_str(), path.c_str());
|
for ( plugin::Manager::inactive_plugin_list::const_iterator i = inactives.begin(); i != inactives.end(); i++ )
|
||||||
|
{
|
||||||
|
string name = (*i).first;
|
||||||
|
string path = (*i).second;
|
||||||
|
printf(" %s (%s)\n", name.c_str(), path.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return count != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void done_with_network()
|
void done_with_network()
|
||||||
|
@ -851,6 +862,8 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if ( strchr(argv[optind], '=') )
|
if ( strchr(argv[optind], '=') )
|
||||||
params.push_back(argv[optind++]);
|
params.push_back(argv[optind++]);
|
||||||
|
else if ( print_plugins && strstr(argv[optind], "::") )
|
||||||
|
requested_plugins.insert(argv[optind++]);
|
||||||
else
|
else
|
||||||
add_input_file(argv[optind++]);
|
add_input_file(argv[optind++]);
|
||||||
}
|
}
|
||||||
|
@ -921,8 +934,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if ( print_plugins )
|
if ( print_plugins )
|
||||||
{
|
{
|
||||||
show_plugins(print_plugins);
|
bool success = show_plugins(print_plugins);
|
||||||
exit(1);
|
exit(success ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
analyzer_mgr->InitPostScript();
|
analyzer_mgr->InitPostScript();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue