zeek/scripts/policy/misc/loaded-scripts.bro
Seth Hall f1d165956a Fix path compression to include removing "/./".
- This involved a fix to the FTP scripts that relied on the old behavior.
2013-04-02 00:16:56 -04:00

39 lines
No EOL
854 B
Text

##! Log the loaded scripts.
@load base/utils/paths
module LoadedScripts;
export {
redef enum Log::ID += { LOG };
type Info: record {
## Name of the script loaded potentially with spaces included before
## the file name to indicate load depth. The convention is two spaces
## per level of depth.
name: string &log;
};
}
const depth: table[count] of string = {
[0] = "",
[1] = " ",
[2] = " ",
[3] = " ",
[4] = " ",
[5] = " ",
[6] = " ",
[7] = " ",
[8] = " ",
[9] = " ",
[10] = " ",
};
event bro_init() &priority=5
{
Log::create_stream(LoadedScripts::LOG, [$columns=Info]);
}
event bro_script_loaded(path: string, level: count)
{
Log::write(LoadedScripts::LOG, [$name=cat(depth[level], compress_path(path))]);
}