mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
39 lines
1.2 KiB
Text
39 lines
1.2 KiB
Text
# @TEST-DOC: Smoke test for a custom Spicy analyzer hooked into Zeek with JIT via Zeek itself.
|
|
#
|
|
# @TEST-REQUIRES: $SCRIPTS/have-spicy
|
|
|
|
# Use a script here to prevent spicy from outputting warnings during compilation. If the build is
|
|
# failing, the script can be modified to not redirect the output.
|
|
# @TEST-EXEC: HILTI_CXX=$SCRIPTS/hilti-ignore-cxx-errors zeek -NN test.zeek test.spicy test.evt | grep -q ANALYZER_SPICY_TEST
|
|
# @TEST-EXEC: HILTI_CXX=$SCRIPTS/hilti-ignore-cxx-errors zeek -r ${TRACES}/http/post.trace test.spicy test.evt test.zeek "Spicy::enable_print = T;" >>output 2>&1
|
|
# @TEST-EXEC: btest-diff output
|
|
|
|
# @TEST-START-FILE test.spicy
|
|
module test;
|
|
|
|
import zeek;
|
|
|
|
public type Dummy = unit {
|
|
# Consume all data. We split data into lines and log the number of lines and the lines when done.
|
|
data: bytes &eod &convert=$$.split(b"\r\n");
|
|
|
|
on %done { print |self.data|, self; }
|
|
};
|
|
# @TEST-END-FILE
|
|
|
|
# @TEST-START-FILE test.evt
|
|
protocol analyzer spicy::Test over TCP:
|
|
parse with test::Dummy,
|
|
port 80/tcp;
|
|
|
|
on test::Dummy -> event test::dummy(self.data);
|
|
# @TEST-END-FILE
|
|
|
|
# @TEST-START-FILE test.zeek
|
|
module test;
|
|
|
|
event test::dummy(data: vector of string)
|
|
{
|
|
print "Event:", data;
|
|
}
|
|
# @TEST-END-FILE
|