mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
FileAnalysis: unit test tweaks (portability, etc.)
This commit is contained in:
parent
dce3e6448f
commit
7caa4aa45c
7 changed files with 15 additions and 11 deletions
|
@ -1 +1 @@
|
||||||
555523 7gZBKVUgy4l-file0
|
555523 7gZBKVUgy4l-file0
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1022920 oDwT1BbzjM1-file0
|
1022920 oDwT1BbzjM1-file0
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
498668 uHS14uhRKGe-file0
|
498668 uHS14uhRKGe-file0
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<!-- proxied : table[string] -->
|
<!-- proxied : table[string] -->
|
||||||
<!-- mime_type : string -->
|
<!-- mime_type : string -->
|
||||||
<!-- md5 : string -->
|
<!-- md5 : string -->
|
||||||
<!-- extraction_file : file -->
|
<!-- extraction_file : string -->
|
||||||
|
|
||||||
# Extent, type='http'
|
# Extent, type='http'
|
||||||
ts uid id.orig_h id.orig_p id.resp_h id.resp_p trans_depth method host uri referrer user_agent request_body_len response_body_len status_code status_msg info_code info_msg filename tags username password proxied mime_type md5 extraction_file
|
ts uid id.orig_h id.orig_p id.resp_h id.resp_p trans_depth method host uri referrer user_agent request_body_len response_body_len status_code status_msg info_code info_msg filename tags username password proxied mime_type md5 extraction_file
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
# @TEST-EXEC: bro -r $TRACES/http/206_example_a.pcap $SCRIPTS/file-analysis-test.bro %INPUT >a.out
|
# @TEST-EXEC: bro -r $TRACES/http/206_example_a.pcap $SCRIPTS/file-analysis-test.bro %INPUT >a.out
|
||||||
# @TEST-EXEC: btest-diff a.out
|
# @TEST-EXEC: btest-diff a.out
|
||||||
# @TEST-EXEC: wc -c 7gZBKVUgy4l-file0 >a.size
|
# @TEST-EXEC: wc -c 7gZBKVUgy4l-file0 | sed 's/^[ \t]* //g' >a.size
|
||||||
# @TEST-EXEC: btest-diff a.size
|
# @TEST-EXEC: btest-diff a.size
|
||||||
|
|
||||||
# @TEST-EXEC: bro -r $TRACES/http/206_example_b.pcap $SCRIPTS/file-analysis-test.bro %INPUT >b.out
|
# @TEST-EXEC: bro -r $TRACES/http/206_example_b.pcap $SCRIPTS/file-analysis-test.bro %INPUT >b.out
|
||||||
# @TEST-EXEC: btest-diff b.out
|
# @TEST-EXEC: btest-diff b.out
|
||||||
# @TEST-EXEC: wc -c oDwT1BbzjM1-file0 >b.size
|
# @TEST-EXEC: wc -c oDwT1BbzjM1-file0 | sed 's/^[ \t]* //g' >b.size
|
||||||
# @TEST-EXEC: btest-diff b.size
|
# @TEST-EXEC: btest-diff b.size
|
||||||
|
|
||||||
# @TEST-EXEC: bro -r $TRACES/http/206_example_c.pcap $SCRIPTS/file-analysis-test.bro %INPUT >c.out
|
# @TEST-EXEC: bro -r $TRACES/http/206_example_c.pcap $SCRIPTS/file-analysis-test.bro %INPUT >c.out
|
||||||
# @TEST-EXEC: btest-diff c.out
|
# @TEST-EXEC: btest-diff c.out
|
||||||
# @TEST-EXEC: wc -c uHS14uhRKGe-file0 >c.size
|
# @TEST-EXEC: wc -c uHS14uhRKGe-file0 | sed 's/^[ \t]* //g' >c.size
|
||||||
# @TEST-EXEC: btest-diff c.size
|
# @TEST-EXEC: btest-diff c.size
|
||||||
|
|
||||||
global cnt: count = 0;
|
global cnt: count = 0;
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
#
|
#
|
||||||
# Default canonifier used with the tests in testing/btest/*.
|
# Default canonifier used with the tests in testing/btest/*.
|
||||||
|
|
||||||
`dirname $0`/diff-remove-timestamps
|
`dirname $0`/diff-remove-timestamps \
|
||||||
|
| `dirname $0`/diff-remove-mime-types
|
||||||
|
|
|
@ -76,13 +76,16 @@ hook FileAnalysis::policy(trig: FileAnalysis::Trigger, info: FileAnalysis::Info)
|
||||||
for ( act in info$actions )
|
for ( act in info$actions )
|
||||||
switch ( act$act ) {
|
switch ( act$act ) {
|
||||||
case FileAnalysis::ACTION_MD5:
|
case FileAnalysis::ACTION_MD5:
|
||||||
print fmt("MD5: %s", info$actions[act]$md5);
|
if ( info$actions[act]?$md5 )
|
||||||
|
print fmt("MD5: %s", info$actions[act]$md5);
|
||||||
break;
|
break;
|
||||||
case FileAnalysis::ACTION_SHA1:
|
case FileAnalysis::ACTION_SHA1:
|
||||||
print fmt("SHA1: %s", info$actions[act]$sha1);
|
if ( info$actions[act]?$sha1 )
|
||||||
|
print fmt("SHA1: %s", info$actions[act]$sha1);
|
||||||
break;
|
break;
|
||||||
case FileAnalysis::ACTION_SHA256:
|
case FileAnalysis::ACTION_SHA256:
|
||||||
print fmt("SHA256: %s", info$actions[act]$sha256);
|
if ( info$actions[act]?$sha256 )
|
||||||
|
print fmt("SHA256: %s", info$actions[act]$sha256);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue