mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
bro -B <x> now supports "all" and "help" for <x>.
"all" enables all debug streams. "help" prints a list of available debug streams. Based on patch by John Donnelly. BIT-1313 #merged
This commit is contained in:
parent
1d49ec63f8
commit
1dbc5ed523
6 changed files with 86 additions and 12 deletions
21
CHANGES
21
CHANGES
|
@ -1,4 +1,25 @@
|
|||
|
||||
2.3-582 | 2015-03-23 11:34:25 -0700
|
||||
|
||||
* BIT-1313: In debug builds, "bro -B <x>" now supports "all" and
|
||||
"help" for "<x>". "all" enables all debug streams. "help" prints a
|
||||
list of available debug streams. (John Donnelly/Robin Sommer).
|
||||
|
||||
* BIT-1324: Allow logging filters to inherit default path from
|
||||
stream. This allows the path for the default filter to be
|
||||
specified explicitly through $path="..." when creating a stream.
|
||||
Adapted the existing Log::create_stream calls to explicitly
|
||||
specify a path value. (Jon Siwek)
|
||||
|
||||
* BIT-1199: Change the way the input framework deals with values it
|
||||
cannot convert into BroVals, raising error messages instead of
|
||||
aborting execution. (Johanna Amann)
|
||||
|
||||
* BIT-788: Use DNS QR field to better identify flow direction. (Jon
|
||||
Siwek)
|
||||
|
||||
* BIT-342: Add "icmp_sent_payload" event. (Jon Siwek)
|
||||
|
||||
2.3-570 | 2015-03-23 09:51:20 -0500
|
||||
|
||||
* Correct a spelling error (Daniel Thayer)
|
||||
|
|
2
NEWS
2
NEWS
|
@ -61,6 +61,8 @@ New Functionality
|
|||
|
||||
- [TODO] Add new BroControl features.
|
||||
|
||||
- A new icmp_sent_payload event provides access to ICMP payload.
|
||||
|
||||
Changed Functionality
|
||||
---------------------
|
||||
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.3-570
|
||||
2.3-582
|
||||
|
|
|
@ -55,32 +55,81 @@ DebugLogger::~DebugLogger()
|
|||
fclose(file);
|
||||
}
|
||||
|
||||
void DebugLogger::ShowStreamsHelp()
|
||||
{
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "Enable debug output into debug.log with -B <streams>.\n");
|
||||
fprintf(stderr, "<streams> is a comma-separated list of streams to enable.\n");
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "Available streams:\n");
|
||||
|
||||
for ( int i = 0; i < NUM_DBGS; ++i )
|
||||
fprintf(stderr," %s\n", streams[i].prefix);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, " plugin-<plugin-name> (replace '::' in name with '-'; e.g., '-B plugin-Bro-Netmap')\n");
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "Pseudo streams\n");
|
||||
fprintf(stderr, " verbose Increase verbosity.\n");
|
||||
fprintf(stderr, " all Enable all streams at maximum verbosity.\n");
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
void DebugLogger::EnableStreams(const char* s)
|
||||
{
|
||||
char* tmp = copy_string(s);
|
||||
char* brkt;
|
||||
char* tmp = copy_string(s);
|
||||
char* tok = strtok(tmp, ",");
|
||||
|
||||
while ( tok )
|
||||
{
|
||||
if ( strcasecmp("all", tok) == 0 )
|
||||
{
|
||||
for ( int i = 0; i < NUM_DBGS; ++i )
|
||||
{
|
||||
streams[i].enabled = true;
|
||||
enabled_streams.insert(streams[i].prefix);
|
||||
}
|
||||
|
||||
verbose = true;
|
||||
goto next;
|
||||
}
|
||||
|
||||
if ( strcasecmp("verbose", tok) == 0 )
|
||||
{
|
||||
verbose = true;
|
||||
goto next;
|
||||
}
|
||||
|
||||
if ( strcasecmp("help", tok) == 0 )
|
||||
{
|
||||
ShowStreamsHelp();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ( strncmp(tok, "plugin-", strlen("plugin-")) == 0 )
|
||||
{
|
||||
// Cannot verify this at this time, plugins may not
|
||||
// have been loaded.
|
||||
enabled_streams.insert(tok);
|
||||
goto next;
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < NUM_DBGS; ++i )
|
||||
{
|
||||
if ( strcasecmp(streams[i].prefix, tok) == 0 )
|
||||
{
|
||||
streams[i].enabled = true;
|
||||
break;
|
||||
enabled_streams.insert(tok);
|
||||
goto next;
|
||||
}
|
||||
|
||||
if ( i == NUM_DBGS )
|
||||
{
|
||||
if ( strcasecmp("verbose", tok) == 0 )
|
||||
verbose = true;
|
||||
else if ( strncmp(tok, "plugin-", 7) != 0 )
|
||||
reporter->FatalError("unknown debug stream %s\n", tok);
|
||||
}
|
||||
|
||||
enabled_streams.insert(tok);
|
||||
reporter->FatalError("unknown debug stream '%s', try -B help.\n", tok);
|
||||
|
||||
next:
|
||||
tok = strtok(0, ",");
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
void SetVerbose(bool arg_verbose) { verbose = arg_verbose; }
|
||||
bool IsVerbose() const { return verbose; }
|
||||
|
||||
void ShowStreamsHelp();
|
||||
|
||||
private:
|
||||
FILE* file;
|
||||
bool verbose;
|
||||
|
|
|
@ -188,7 +188,7 @@ void usage()
|
|||
fprintf(stderr, " -x|--print-state <file.bst> | print contents of state file\n");
|
||||
fprintf(stderr, " -z|--analyze <analysis> | run the specified policy file analysis\n");
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " -B|--debug <dbgstreams> | Enable debugging output for selected streams\n");
|
||||
fprintf(stderr, " -B|--debug <dbgstreams> | Enable debugging output for selected streams ('-B help' for help)\n");
|
||||
#endif
|
||||
fprintf(stderr, " -C|--no-checksums | ignore checksums\n");
|
||||
fprintf(stderr, " -D|--dfa-size <size> | DFA state cache size\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue