Skip to content

Commit 259b15a

Browse files
committed
Zeekify intel-limiter.
1 parent e7ba41c commit 259b15a

File tree

14 files changed

+60
-41
lines changed

14 files changed

+60
-41
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 by Jan Grashoefer
1+
Copyright (c) 2019-2022 by Jan Grashoefer
22

33
Redistribution and use in source and binary forms, with or without
44
modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ This package provides limiting mechanisms for Zeek's intelligence framework. Thi
44

55
## Installation
66

7-
The scripts are available as package for the [Bro/Zeek Package Manager](https://github.com/zeek/package-manager) and can be installed using the following command: `bro-pkg install intel-limiter`
7+
The scripts are available as package for the [Zeek Package Manager](https://github.com/zeek/package-manager) and can be installed using the following command: `zkg install intel-limiter`
88

99
## General Usage
1010

11-
To enable per item thresholds and heavy hitter suppression make sure the package is loaded: `bro-pkg load intel-limiter`
11+
To enable per item thresholds and heavy hitter suppression make sure the package is loaded: `zkg load intel-limiter`
1212

1313
### Matching Thresholds
1414

@@ -20,22 +20,22 @@ With the package loaded, intel items might specify a new meta data field `meta.m
2020
```
2121
Once a match is triggered, the internal match counter will be reset and the next match is triggered after the threshold is reached again. The threshold counters are managed per item. If two items that are obtained from different sources share the *same* indicator, thresholds do not interfere. For example, if thresholds of two and four are specified for a single indicator, every fourth time the indicator is seen a hit containing all meta data will be generated, while every second reporting will cause a match containing only the meta data of the item that defines the threshold of two.
2222

23-
**Note:** As Bro 2.6 does not pass modified hook parameters along the chain, hits will be reported in the correct frequency but contain the meta data of all items.
23+
**Note:** Since version 2.6, Zeek does not pass modified hook parameters along the chain. Thus, hits will be reported in the correct frequency but contain the meta data of all items.
2424

2525
### Heavy Hitter Suppression
2626

2727
To enable heavy hitter suppression, a heavy hitter interval and threshold have to be specified. The option `heavy_hitter_interval` defines the time window in which at most `heavy_hitter_threshold` hits might occur. If more hits are observed in that time window, the indicator is removed. By default the threshold is set to zero which disables suppression. When removing an heavy hitter, a reporter warning is generated to inform the user about the removal.
2828

2929
## Background
3030

31-
The script `item-threshold.bro` implements per item thresholds and is loaded by default. Per item thresholds are realized using two additional meta data fields:
31+
The script `item-threshold.zeek` implements per item thresholds and is loaded by default. Per item thresholds are realized using two additional meta data fields:
3232
* `matching_threshold` defines the number of reports required to trigger a match
3333
* `recent_matches` implements a counter for recent matches
3434

3535
To prevent matching of an item before the specified threshold is reached, the script handles the `extend_match` hook of the intelligence framework and checks the number of recent hits.
3636
For further details on the intel framework see the corresponding [blog post](https://blog.zeek.org/2016/12/the-intelligence-framework-update.html).
3737

38-
The script `heaver-hitter.bro` implements heavy hitter suppression simply by tracking hits per indicator in a table. Note that item removal and reporting a warning is a very simple strategy. In more complex environments one would want to report heavy hitters using a dedicated feedback channel, e.g. implemented with broker.
38+
The script `heaver-hitter.zeek` implements heavy hitter suppression simply by tracking hits per indicator in a table. Note that item removal and reporting a warning is a very simple strategy. In more complex environments one would want to report heavy hitters using a dedicated feedback channel, e.g. implemented with broker.
3939

4040
## Acknowledgments
4141

File renamed without changes.
File renamed without changes.
File renamed without changes.

testing/Baseline/scripts.test-heavy-hitter/output

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#open 2019-08-31-19-35-18
77
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p seen.indicator seen.indicator_type seen.where seen.node matched sources fuid file_mime_type file_desc
88
#types time string addr port addr port string enum enum string set[enum] set[string] string string string
9-
1.000011 - - - - - 1.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
10-
1.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
11-
2.000011 - - - - - 1.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
12-
2.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
13-
3.000011 - - - - - 1.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
14-
6.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
9+
1.000011 - - - - - 1.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
10+
1.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
11+
2.000011 - - - - - 1.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
12+
2.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
13+
3.000011 - - - - - 1.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
14+
6.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
1515
#close 2019-08-31-19-35-18
1616
>> Run 0:
1717
>> Run 1:

testing/Baseline/scripts.test-item-threshold/output

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#open 2019-08-27-18-33-06
77
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p seen.indicator seen.indicator_type seen.where seen.node matched sources fuid file_mime_type file_desc
88
#types time string addr port addr port string enum enum string set[enum] set[string] string string string
9-
3.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
10-
6.000011 - - - - - 3.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
11-
7.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1 - - -
9+
3.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
10+
6.000011 - - - - - 3.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
11+
7.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source1 - - -
1212
#close 2019-08-27-18-33-06
1313
>> Run 0:
1414
>> Run 1:

testing/Baseline/scripts.test-multiple-thresholds/output

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#open 2019-08-31-15-15-42
77
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p seen.indicator seen.indicator_type seen.where seen.node matched sources fuid file_mime_type file_desc
88
#types time string addr port addr port string enum enum string set[enum] set[string] string string string
9-
2.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1,source2 - - -
10-
5.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1,source2 - - -
11-
7.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE bro Intel::ADDR source1,source2 - - -
9+
2.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source2,source1 - - -
10+
5.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source2,source1 - - -
11+
7.000011 - - - - - 2.0.0.0 Intel::ADDR SOMEWHERE zeek Intel::ADDR source2,source1 - - -
1212
#close 2019-08-31-15-15-42
1313
>> Run 0:
1414
>> Run 1:

testing/btest.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ IgnoreDirs = .tmp
66
IgnoreFiles = *.tmp *.swp
77

88
[environment]
9-
BRO_SEED_FILE=%(testbase)s/random.seed
10-
BROPATH=`bro-config --bropath`:%(testbase)s/../scripts
9+
ZEEK_SEED_FILE=%(testbase)s/random.seed
10+
ZEEKPATH=`zeek-config --zeekpath`:%(testbase)s/../scripts
1111
TZ=UTC
1212
LC_ALL=C
1313
TRACES=%(testbase)s/traces

testing/scripts/test-heavy-hitter-cluster.bro renamed to testing/scripts/test-heavy-hitter-cluster.zeek

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# @TEST-SERIALIZE: comm
22
#
3-
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
4-
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -r $TRACES/ticks.pcap --pseudo-realtime %INPUT
3+
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek %INPUT
4+
# @TEST-EXEC: btest-bg-run worker-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -r $TRACES/ticks.pcap --pseudo-realtime %INPUT
55
# @TEST-EXEC: btest-bg-wait -k 13
66
# @TEST-EXEC: btest-diff manager-1/intel.log
77

8-
# @TEST-START-FILE cluster-layout.bro
8+
# @TEST-START-FILE cluster-layout.zeek
99
redef Cluster::nodes = {
1010
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=37757/tcp],
1111
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37760/tcp, $manager="manager-1"],
@@ -39,7 +39,7 @@ event Cluster::node_up(name: string, id: string)
3939
# Worker
4040

4141
@if ( Cluster::local_node_type() == Cluster::WORKER )
42-
event bro_init()
42+
event zeek_init()
4343
{
4444
suspend_processing();
4545
}

0 commit comments

Comments
 (0)