mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00
Adding options Analyzer::disable_all to disable all analyzers at
startup. One can then selectively enable the ones one wants inside a bro_init() handler.
This commit is contained in:
parent
b122b39874
commit
bccaea6883
4 changed files with 26 additions and 1 deletions
|
@ -5,6 +5,9 @@ module Analyzer;
|
|||
# as they are loaded.
|
||||
|
||||
export {
|
||||
## XXX
|
||||
global disable_all = F &redef;
|
||||
|
||||
## XXX.
|
||||
global enable_analyzer: function(tag: Analyzer::Tag) : bool;
|
||||
|
||||
|
@ -63,8 +66,11 @@ export {
|
|||
|
||||
global ports: table[Analyzer::Tag] of set[port];
|
||||
|
||||
event bro_init()
|
||||
event bro_init() &priority=-5
|
||||
{
|
||||
if ( disable_all )
|
||||
__disable_all_analyzers();
|
||||
|
||||
for ( a in disabled_analyzers )
|
||||
disable_analyzer(a);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,12 @@ function Analyzer::__disable_analyzer%(id: Analyzer::Tag%) : bool
|
|||
return new Val(result, TYPE_BOOL);
|
||||
%}
|
||||
|
||||
function Analyzer::__disable_all_analyzers%(%) : any
|
||||
%{
|
||||
analyzer_mgr->DisableAllAnalyzers();
|
||||
return 0;
|
||||
%}
|
||||
|
||||
function Analyzer::__register_for_port%(id: Analyzer::Tag, p: port%) : bool
|
||||
%{
|
||||
bool result = analyzer_mgr->RegisterAnalyzerForPort(id->AsEnumVal(), p);
|
||||
|
|
|
@ -224,6 +224,14 @@ bool Manager::DisableAnalyzer(EnumVal* val)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Manager::DisableAllAnalyzers()
|
||||
{
|
||||
DBG_LOG(DBG_ANALYZER, "Disabling all analyzers");
|
||||
|
||||
for ( analyzer_map_by_tag::const_iterator i = analyzers_by_tag.begin(); i != analyzers_by_tag.end(); i++ )
|
||||
i->second->SetEnabled(false);
|
||||
}
|
||||
|
||||
bool Manager::IsEnabled(Tag tag)
|
||||
{
|
||||
if ( ! tag )
|
||||
|
|
|
@ -113,6 +113,11 @@ public:
|
|||
*/
|
||||
bool DisableAnalyzer(EnumVal* tag);
|
||||
|
||||
/**
|
||||
* Disables all currently registered analyzers.
|
||||
*/
|
||||
void DisableAllAnalyzers();
|
||||
|
||||
/**
|
||||
* Returns true if an analyzer is enabled.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue