mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
36 lines
900 B
Text
36 lines
900 B
Text
# @TEST-REQUIRES: have-spicy
|
|
#
|
|
# @TEST-EXEC: spicyz -d -o test.hlto test.evt test.spicy
|
|
# @TEST-EXEC: zeek -r ${TRACES}/ssh/single-conn.trace test.hlto %INPUT >output
|
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=diff-canonifier-spicy btest-diff output
|
|
#
|
|
# @TEST-DOC: In EVT, provide access to hooks arguments
|
|
|
|
event Banner::error(msg: string) {
|
|
print fmt("Error message: %s", msg);
|
|
}
|
|
|
|
event zeek_init() {
|
|
Analyzer::register_for_port(Analyzer::ANALYZER_SPICY_SSH, 22/tcp);
|
|
}
|
|
|
|
# @TEST-START-FILE test.spicy
|
|
module SSH;
|
|
|
|
public type Banner = unit {
|
|
magic : /SSH-/;
|
|
version : /[^-]*/;
|
|
dash : /-/;
|
|
software: /KAPUTT/;
|
|
};
|
|
# @TEST-END-FILE
|
|
|
|
# @TEST-START-FILE test.evt
|
|
|
|
protocol analyzer spicy::SSH over TCP:
|
|
parse originator with SSH::Banner;
|
|
|
|
on SSH::Banner::%error(msg: string) -> event Banner::error(msg);
|
|
on SSH::Banner::%error() -> event Banner::error("n/a");
|
|
|
|
# @TEST-END-FILE
|