From de4ab1a964a4ea5683b04dd595b9a3bca7fa28e0 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 24 Jun 2024 14:18:08 +0200 Subject: [PATCH] tests: add threshold backoff tests --- .../test.rules | 4 +++ .../test.yaml | 26 +++++++++++++++++++ .../threshold-rule-flow-backoff/test.rules | 4 +++ .../threshold-rule-flow-backoff/test.yaml | 26 +++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 tests/threshold/threshold-rule-flow-backoff-single-flow/test.rules create mode 100644 tests/threshold/threshold-rule-flow-backoff-single-flow/test.yaml create mode 100644 tests/threshold/threshold-rule-flow-backoff/test.rules create mode 100644 tests/threshold/threshold-rule-flow-backoff/test.yaml diff --git a/tests/threshold/threshold-rule-flow-backoff-single-flow/test.rules b/tests/threshold/threshold-rule-flow-backoff-single-flow/test.rules new file mode 100644 index 000000000..38e4ebd05 --- /dev/null +++ b/tests/threshold/threshold-rule-flow-backoff-single-flow/test.rules @@ -0,0 +1,4 @@ +alert tcp any any -> any any (dsize:>0; sid:1;) +alert tcp any any -> any any (dsize:>0; threshold:type backoff, track by_flow, count 1, multiplier 2; sid:2;) +alert tcp any any -> any any (dsize:>0; threshold:type backoff, track by_flow, count 3, multiplier 2; sid:3;) +alert tcp any any -> any any (dsize:>0; threshold:type backoff, track by_flow, count 5, multiplier 5; sid:4;) diff --git a/tests/threshold/threshold-rule-flow-backoff-single-flow/test.yaml b/tests/threshold/threshold-rule-flow-backoff-single-flow/test.yaml new file mode 100644 index 000000000..dca2674f2 --- /dev/null +++ b/tests/threshold/threshold-rule-flow-backoff-single-flow/test.yaml @@ -0,0 +1,26 @@ +requires: + min-version: 8 + +pcap: ../../filestore-filecontainer-smb/filecontainer-smb.pcap + +checks: + - filter: + count: 6676 + match: + event_type: alert + alert.signature_id: 1 + - filter: + count: 13 + match: + event_type: alert + alert.signature_id: 2 + - filter: + count: 12 + match: + event_type: alert + alert.signature_id: 3 + - filter: + count: 5 + match: + event_type: alert + alert.signature_id: 4 diff --git a/tests/threshold/threshold-rule-flow-backoff/test.rules b/tests/threshold/threshold-rule-flow-backoff/test.rules new file mode 100644 index 000000000..16727efc1 --- /dev/null +++ b/tests/threshold/threshold-rule-flow-backoff/test.rules @@ -0,0 +1,4 @@ +alert tcp any any -> any any (dsize:>0; sid:1;) +alert tcp any any -> any any (dsize:>0; threshold:type backoff, track by_flow, count 1, multiplier 2; sid:2;) +alert tcp any any -> any any (dsize:>0; threshold:type backoff, track by_flow, count 3, multiplier 2; sid:3;) +alert tcp any any -> any any (dsize:>0; threshold:type backoff, track by_flow, count 1, multiplier 10; sid:4;) diff --git a/tests/threshold/threshold-rule-flow-backoff/test.yaml b/tests/threshold/threshold-rule-flow-backoff/test.yaml new file mode 100644 index 000000000..6a8f1c05b --- /dev/null +++ b/tests/threshold/threshold-rule-flow-backoff/test.yaml @@ -0,0 +1,26 @@ +requires: + min-version: 8 + +pcap: ../../bug-2482-01/proxyCONNECT_443.pcap + +checks: + - filter: + count: 1725 + match: + event_type: alert + alert.signature_id: 1 + - filter: + count: 707 + match: + event_type: alert + alert.signature_id: 2 + - filter: + count: 338 + match: + event_type: alert + alert.signature_id: 3 + - filter: + count: 257 + match: + event_type: alert + alert.signature_id: 4 -- 2.47.2