mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

This reflects the `spicy-plugin` code as of `d8c296b81cc2a11`. In addition to moving the code into Zeek's source tree, this comes with a couple small functional changes: - `spicyz` no longer tries to infer if it's running from the build directory. Instead `ZEEK_SPICY_LIBRARY` can be set to a custom location. `zeek-set-path.sh` does that now. - ZEEK_CONFIG can be set to change what `spicyz -z` print out. This is primarily for backwards compatibility. Some further notes on specifics: - We raise the minimum Spicy version to 1.8 (i.e., current `main` branch). - Renamed the `compiler/` subdirectory to `spicyz` to avoid include-path conflicts with the Spicy headers. - In `cmake/`, the corresponding PR brings a new/extended version of `FindZeek`, which Spicy analyzer packages need. We also now install some of the files that the Spicy plugin used to bring for testing, so that existing packages keep working. - For now, this all remains backwards compatible with the current `zkg` analyzer templates so that they work with both external and integrated Spicy support. Later, once we don't need to support any external Spicy plugin versions anymore, we can clean up the templates as well. - All the plugin's tests have moved into the standard test suite. They are skipped if configure with `--disable-spicy`. This holds off on adapting the new code further to Zeek's coding conventions, so that it remains easier to maintain it in parallel to the (now legacy) external plugin. We'll make a pass over the formatting for (presumable) Zeek 6.1.
70 lines
1.6 KiB
Text
70 lines
1.6 KiB
Text
# @TEST-REQUIRES: have-spicy
|
|
#
|
|
# @TEST-EXEC: spicyz -d -o foo.hlto foo.spicy foo.evt
|
|
# @TEST-EXEC: spicyz -d -o bar.hlto bar.spicy bar.evt foo.spicy
|
|
# @TEST-EXEC: zeek -r ${TRACES}/ssh/single-conn.trace foo.hlto %INPUT | sort >>output
|
|
# @TEST-EXEC: echo >>output
|
|
# @TEST-EXEC: zeek -r ${TRACES}/ssh/single-conn.trace bar.hlto %INPUT | sort >>output
|
|
# @TEST-EXEC: echo >>output
|
|
# @TEST-EXEC: zeek -r ${TRACES}/ssh/single-conn.trace foo.hlto bar.hlto %INPUT | sort >>output
|
|
# @TEST-EXEC: echo >>output
|
|
# @TEST-EXEC: zeek -r ${TRACES}/ssh/single-conn.trace bar.hlto foo.hlto %INPUT | sort >>output
|
|
# @TEST-EXEC: btest-diff output
|
|
#
|
|
# @TEST-DOC: Check that HLTOs remain isolated from each other when reusing another's units.
|
|
#
|
|
# The events triggered should reflect what's being loaded, and not depend on any loading ordering either.
|
|
|
|
event foo::test(x: string)
|
|
{
|
|
print "foo", x;
|
|
}
|
|
|
|
event bar::test(x: string)
|
|
{
|
|
print "bar", x;
|
|
}
|
|
|
|
# @TEST-START-FILE foo.spicy
|
|
module Foo;
|
|
|
|
public type Banner = unit {
|
|
%port = 22/tcp;
|
|
|
|
magic : /SSH-/;
|
|
version : /[^-]*/;
|
|
dash : /-/;
|
|
software: /[^\r\n]*/;
|
|
};
|
|
# @TEST-END-FILE
|
|
#
|
|
# @TEST-START-FILE foo.evt
|
|
import Foo;
|
|
|
|
protocol analyzer spicy::Foo over TCP:
|
|
parse with Foo::Banner;
|
|
|
|
on Foo::Banner -> event foo::test(self.version);
|
|
# @TEST-END-FILE
|
|
|
|
# @TEST-START-FILE bar.spicy
|
|
module Bar;
|
|
|
|
import Foo;
|
|
|
|
public type Banner = unit {
|
|
%port = 22/tcp;
|
|
x: Foo::Banner;
|
|
};
|
|
|
|
# @TEST-END-FILE
|
|
#
|
|
# @TEST-START-FILE bar.evt
|
|
import Foo;
|
|
import Bar;
|
|
|
|
protocol analyzer spicy::Bar over TCP:
|
|
parse with Bar::Banner;
|
|
|
|
on Foo::Banner -> event bar::test(self.version);
|
|
# @TEST-END-FILE
|