mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00

Part of this involves making the file-analysis tests independent of specific hash values. I've done that only partially though.
27 lines
838 B
Text
27 lines
838 B
Text
# This tests that the contents of a DCC transfer negotiated with IRC can be
|
|
# correctly extracted. The mime type of the file transferred is normalized
|
|
# to prevent sensitivity to libmagic version being used.
|
|
|
|
# @TEST-EXEC: bro -r $TRACES/irc-dcc-send.trace %INPUT
|
|
# @TEST-EXEC: btest-diff irc.log
|
|
# @TEST-EXEC: mv irc-dcc-item-*-0.dat irc-dcc-item.dat
|
|
# @TEST-EXEC: btest-diff irc-dcc-item.dat
|
|
# @TEST-EXEC: bro -r $TRACES/irc-dcc-send.trace %INPUT IRC::extraction_prefix="test"
|
|
# @TEST-EXEC: test -e test-*-0.dat
|
|
|
|
redef IRC::extract_file_types=/.*/;
|
|
|
|
event bro_init()
|
|
{
|
|
Log::remove_default_filter(IRC::LOG);
|
|
Log::add_filter(IRC::LOG, [$name="normalized-mime-types",
|
|
$pred=function(rec: IRC::Info): bool
|
|
{
|
|
if ( rec?$dcc_mime_type )
|
|
{
|
|
rec$dcc_mime_type = "FAKE_MIME";
|
|
}
|
|
return T;
|
|
}
|
|
]);
|
|
}
|