mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Beginning exploration of network centric data types, starting with subnets.
This commit is contained in:
parent
d1d7fe5d4d
commit
d35268a41c
3 changed files with 107 additions and 11 deletions
|
@ -0,0 +1,4 @@
|
|||
172.16.4.56 belongs to subnet 172.16.0.0/20
|
||||
172.16.47.254 belongs to subnet 172.16.32.0/20
|
||||
172.16.22.45 belongs to subnet 172.16.16.0/20
|
||||
172.16.1.1 belongs to subnet 172.16.0.0/20
|
22
testing/btest/doc/manual/data_type_subnets.bro
Normal file
22
testing/btest/doc/manual/data_type_subnets.bro
Normal file
|
@ -0,0 +1,22 @@
|
|||
# @TEST-EXEC: bro -b %INPUT
|
||||
# @TEST-EXEC: btest-diff .stdout
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
local subnets = vector(172.16.0.0/20, 172.16.16.0/20, 172.16.32.0/20, 172.16.48.0/20);
|
||||
local addresses = vector(172.16.4.56, 172.16.47.254, 172.16.22.45, 172.16.1.1);
|
||||
for (a in addresses)
|
||||
{
|
||||
for (s in subnets)
|
||||
{
|
||||
if (addresses[a] in subnets[s])
|
||||
{
|
||||
print fmt("%s belongs to subnet %s", addresses[a], subnets[s]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue