mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
Add table_keys function
This commit is contained in:
parent
cb71b15eab
commit
ba552ceeaf
5 changed files with 73 additions and 21 deletions
5
testing/btest/Baseline/bifs.table_keys/out
Normal file
5
testing/btest/Baseline/bifs.table_keys/out
Normal file
|
@ -0,0 +1,5 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
{
|
||||
http,
|
||||
https
|
||||
}
|
15
testing/btest/bifs/table_keys.zeek
Normal file
15
testing/btest/bifs/table_keys.zeek
Normal file
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# @TEST-EXEC: zeek -b %INPUT > out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local t = table(
|
||||
["http"] = "http://www.google.com/",
|
||||
["https"] = "https://www.google.com/"
|
||||
);
|
||||
|
||||
local v: set[string] = table_keys(t);
|
||||
|
||||
print v;
|
||||
}
|
|
@ -5,14 +5,14 @@
|
|||
event zeek_init()
|
||||
{
|
||||
local t = table(
|
||||
["web"] = { [80/tcp, "http"], [443/tcp, "https"] },
|
||||
["login"] = { [21/tcp, "ftp"], [23/tcp, "telnet"] }
|
||||
["web"] = { [80/tcp, "http"], [443/tcp, "https"] },
|
||||
["login"] = { [21/tcp, "ftp"], [23/tcp, "telnet"] }
|
||||
);
|
||||
|
||||
local v: vector of set[port, string] = table_values(t);
|
||||
|
||||
local v: vector of set[port, string] = table_values(t);
|
||||
|
||||
for ( i in v )
|
||||
{
|
||||
print v[i];
|
||||
}
|
||||
{
|
||||
print v[i];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue