mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
32 lines
994 B
Text
32 lines
994 B
Text
# @TEST-REQUIRES: have-spicy
|
|
#
|
|
# @TEST-EXEC: spicyz -d -o test.hlto %INPUT ./udp-test.evt
|
|
# @TEST-EXEC: zeek -Cr ${TRACES}/udp-packet.pcap test.hlto network-time.zeek Spicy::enable_print=T >output
|
|
# @TEST-EXEC: btest-diff output
|
|
|
|
module Test;
|
|
|
|
import zeek;
|
|
|
|
# Before any processing has started the network time should be zero.
|
|
assert(zeek::network_time() == time(0));
|
|
|
|
public type Message = unit {
|
|
data: bytes &eod {
|
|
# For real traffic we would expect the network time to increase as we progress.
|
|
print zeek::network_time().nanoseconds();
|
|
}
|
|
};
|
|
|
|
# @TEST-START-FILE udp-test.evt
|
|
protocol analyzer spicy::TEST over UDP:
|
|
parse with Test::Message;
|
|
# @TEST-END-FILE
|
|
|
|
|
|
# @TEST-START-FILE network-time.zeek
|
|
event zeek_init() {
|
|
Analyzer::register_for_ports(Analyzer::ANALYZER_SPICY_TEST, set(11337/udp, 11338/udp, 11339/udp, 11340/udp));
|
|
Analyzer::register_for_ports(Analyzer::ANALYZER_SPICY_TEST, set(31337/udp, 31338/udp, 31339/udp, 31340/udp));
|
|
}
|
|
# @TEST-END-FILE
|