Merge branch 'master' into topic/vlad/page_hostnames

This commit is contained in:
Vlad Grigorescu 2021-06-11 10:18:15 -05:00
commit e579497247
421 changed files with 32918 additions and 5368 deletions

View file

@ -5,6 +5,10 @@
@TEST-START-FILE configfile
mycolors Red,asdf,Blue
nocolors
color_vec Green
bad_color_vec Green,1234,Blue
no_color_vec
@TEST-END-FILE
@load base/frameworks/config
@ -12,9 +16,21 @@ mycolors Red,asdf,Blue
type Color: enum { Red, Green, Blue, };
option mycolors = set(Red, Green);
option nocolors = set(Red, Green);
option color_vec: vector of Color = { Red };
option bad_color_vec: vector of Color = { Red };
option no_color_vec: vector of Color = { Red };
event zeek_init()
{ Config::read_config("../configfile"); }
event Input::end_of_data(name: string, source:string)
{ print mycolors; terminate(); }
{
print mycolors;
print nocolors;
print color_vec;
print bad_color_vec;
print no_color_vec;
terminate();
}

View file

@ -1,3 +1,8 @@
# Don't run the test for compiled scripts. To work, they need separate
# compilation of the manager and worker parts, and that also leads to
# lines (and sets) being displayed in a different order due to different
# hash function seedings (though probably -D would control for that).
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
# @TEST-PORT: BROKER_PORT1
# @TEST-PORT: BROKER_PORT2
# @TEST-PORT: BROKER_PORT3

View file

@ -0,0 +1,38 @@
#
# @TEST-EXEC: mkdir logdir
# @TEST-EXEC: zeek -b %INPUT LogAscii::logdir=logdir
# @TEST-EXEC: cat logdir/ssh.log | grep -v PREFIX.*20..- >ssh-filtered.log
# @TEST-EXEC: btest-diff ssh-filtered.log
redef LogAscii::output_to_stdout = F;
redef LogAscii::separator = "|";
redef LogAscii::empty_field = "EMPTY";
redef LogAscii::unset_field = "NOT-SET";
redef LogAscii::meta_prefix = "PREFIX<>";
module SSH;
export {
redef enum Log::ID += { LOG };
type Log: record {
t: time;
id: conn_id; # Will be rolled out into individual columns.
status: string &optional;
country: string &default="unknown";
b: bool &optional;
} &log;
}
event zeek_init()
{
Log::create_stream(SSH::LOG, [$columns=Log]);
local cid = [$orig_h=1.2.3.4, $orig_p=1234/tcp, $resp_h=2.3.4.5, $resp_p=80/tcp];
Log::write(SSH::LOG, [$t=network_time(), $id=cid, $status="success"]);
Log::write(SSH::LOG, [$t=network_time(), $id=cid, $country="US"]);
Log::write(SSH::LOG, [$t=network_time(), $id=cid, $status="failure", $country="UK"]);
Log::write(SSH::LOG, [$t=network_time(), $id=cid, $country="BR"]);
Log::write(SSH::LOG, [$t=network_time(), $id=cid, $b=T, $status="failure", $country=""]);
}