Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: flowbit prefilter tests #2131

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/flowbits-prefilter-01/flowbit-prefilter.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alert tcp any any -> any any (flow:to_client; content:"HTTP"; flowbits:set,rare; flowbits:set,common; sid:11;)
alert tcp any any -> any any (dsize:10; flowbits:set,never; flowbits:set,common; sid:12;)
alert tcp any any -> any any (flowbits:isset,never; sid:21;)
alert tcp any any -> any any (flowbits:isset,common; prefilter; dsize:259; sid:22;)
alert tcp any any -> any any (flowbits:isset,never; prefilter; dsize:10; sid:23;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; dsize:11; sid:24;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; ack:3308437468; sid:25;)
alert tcp any any -> any any (priority:10; dsize:11; sid:31;)
alert tcp any any -> any any (priority:10; dsize:10; sid:32;)
alert tcp any any -> any any (priority:10; ack:3308437468; sid:33;)
22 changes: 22 additions & 0 deletions tests/flowbits-prefilter-01/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 11
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 22
10 changes: 10 additions & 0 deletions tests/flowbits-prefilter-02-auto/flowbit-prefilter-tx.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alert tcp any any -> any any (flow:to_client; http.response_line; content:"HTTP"; flowbits:set,rare; flowbits:set,common; sid:11;)
alert tcp any any -> any any (http.request_line; content:"ABC"; flowbits:set,never; flowbits:set,common; sid:12;)
alert tcp any any -> any any (flowbits:isset,never; sid:21;)
alert tcp any any -> any any (flowbits:isset,common; http.stat_code; content:"200"; sid:22;)
alert tcp any any -> any any (flowbits:isset,never; http.stat_code; content:"200"; sid:23;)
alert tcp any any -> any any (flowbits:isset,rare; http.stat_code; content:"201"; sid:24;)
alert tcp any any -> any any (flowbits:isset,rare; http.stat_code; content:"200"; sid:25;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"202"; sid:31;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"201"; sid:32;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"200"; sid:33;)
35 changes: 35 additions & 0 deletions tests/flowbits-prefilter-02-auto/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips
- --set detect.prefilter.default=auto

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 11
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 22
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 25
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 33
2 changes: 2 additions & 0 deletions tests/flowbits-prefilter-03/flowbit-prefilter.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alert tcp any any -> any any (flow:to_server; content:"GET"; flowbits:set,abc; sid:1;)
alert tcp any any -> any any (flow:to_client; content:"HTTP"; flowbits:isset,abc; prefilter; sid:2;)
22 changes: 22 additions & 0 deletions tests/flowbits-prefilter-03/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 4
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 2
10 changes: 10 additions & 0 deletions tests/flowbits-prefilter-04-pkt-auto/flowbit-prefilter.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alert tcp any any -> any any (flow:to_client; content:"HTTP"; flowbits:set,rare; flowbits:set,common; sid:11;)
alert tcp any any -> any any (dsize:81; flowbits:set,common; sid:12;)
alert tcp any any -> any any (flowbits:isset,never; sid:21;)
alert tcp any any -> any any (flowbits:isset,common; dsize:259; sid:22;)
alert tcp any any -> any any (flowbits:isset,never; dsize:10; sid:23;)
alert tcp any any -> any any (flowbits:isset,rare; dsize:11; sid:24;)
alert tcp any any -> any any (flowbits:isset,rare; ack:3308437468; sid:25;)
alert tcp any any -> any any (priority:10; dsize:11; sid:31;)
alert tcp any any -> any any (priority:10; dsize:10; sid:32;)
alert tcp any any -> any any (priority:10; ack:3308437468; sid:33;)
23 changes: 23 additions & 0 deletions tests/flowbits-prefilter-04-pkt-auto/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips
- --set detect.prefilter.default=auto

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 11
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 22
2 changes: 2 additions & 0 deletions tests/flowbits-prefilter-05-onedir/flowbit-prefilter.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alert tcp any any -> any any (flow:to_client; dsize:259; flowbits:set,size; sid:1;)
alert tcp any any -> any any (flowbits:isset,size; prefilter; sid:2;)
22 changes: 22 additions & 0 deletions tests/flowbits-prefilter-05-onedir/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 2
4 changes: 4 additions & 0 deletions tests/flowbits-prefilter-06-opdir/flowbit-prefilter.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# packet 6 to client
alert tcp any any -> any any (flow:to_client; dsize:259; flowbits:set,size; sid:1;)
# packet 7 to server
alert tcp any any -> any any (flow:to_server; tcp.flags:A; tcp.ack:2548486954; flowbits:isset,size; prefilter; sid:2;)
22 changes: 22 additions & 0 deletions tests/flowbits-prefilter-06-opdir/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 7
alert.signature_id: 2
10 changes: 10 additions & 0 deletions tests/flowbits-prefilter-07-tx-onedir/flowbit-prefilter-tx.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alert tcp any any -> any any (flow:to_client; http.response_line; content:"HTTP"; flowbits:set,rare; flowbits:set,common; sid:11;)
alert tcp any any -> any any (http.request_line; content:"ABC"; flowbits:set,never; flowbits:set,common; sid:12;)
alert tcp any any -> any any (flowbits:isset,never; sid:21;)
alert tcp any any -> any any (flowbits:isset,common; prefilter; http.stat_code; content:"200"; sid:22;)
alert tcp any any -> any any (flowbits:isset,never; prefilter; http.stat_code; content:"200"; sid:23;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; http.stat_code; content:"201"; sid:24;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; http.stat_code; content:"200"; sid:25;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"202"; sid:31;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"201"; sid:32;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"200"; sid:33;)
34 changes: 34 additions & 0 deletions tests/flowbits-prefilter-07-tx-onedir/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 11
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 22
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 25
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 33
10 changes: 10 additions & 0 deletions tests/flowbits-prefilter-08-tx-opdir/flowbit-prefilter-tx.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alert tcp any any -> any any (http.request_line; content:"HTTP"; flowbits:set,common; sid:11;)
alert tcp any any -> any any (http.request_line; content:"ABC"; flowbits:set,rare; flowbits:set,common; sid:12;)
alert tcp any any -> any any (flowbits:isset,never; sid:21;)
alert tcp any any -> any any (flowbits:isset,common; prefilter; http.stat_code; content:"200"; sid:22;)
alert tcp any any -> any any (flowbits:isset,never; prefilter; http.stat_code; content:"200"; sid:23;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; http.stat_code; content:"201"; sid:24;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; http.stat_code; content:"200"; sid:25;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"202"; sid:31;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"201"; sid:32;)
alert tcp any any -> any any (priority:10; http.stat_code; content:"200"; sid:33;)
32 changes: 32 additions & 0 deletions tests/flowbits-prefilter-08-tx-opdir/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 4
alert.signature_id: 11
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 22
- filter:
count: 0
match:
event_type: alert
alert.signature_id: 23
- filter:
count: 0
match:
event_type: alert
alert.signature_id: 25
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alert tcp 82.165.177.154 any -> any any (flowbits:set,set_by_iponly; sid:1;)
alert tcp any any -> any any (flow:to_client; dsize:259; flowbits:isset,set_by_iponly; prefilter; sid:2;)
22 changes: 22 additions & 0 deletions tests/flowbits-prefilter-09-iponly-onedir/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 2
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alert tcp any any -> 82.165.177.154 any (flowbits:set,set_by_iponly; sid:1;)
alert tcp any any -> any any (flow:to_client; dsize:259; flowbits:isset,set_by_iponly; prefilter; sid:2;)
22 changes: 22 additions & 0 deletions tests/flowbits-prefilter-10-iponly-opdir/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 1
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 2
10 changes: 10 additions & 0 deletions tests/flowbits-prefilter-11-pkt-auto/flowbit-prefilter.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alert tcp any any -> any any (flow:to_client; content:"HTTP"; flowbits:set,rare; flowbits:set,common; sid:11;)
alert tcp any any -> any any (dsize:10; flowbits:set,never; flowbits:set,common; sid:12;)
alert tcp any any -> any any (flowbits:isset,never; sid:21;)
alert tcp any any -> any any (flowbits:isset,common; dsize:259; sid:22;)
alert tcp any any -> any any (flowbits:isset,never; dsize:10; sid:23;)
alert tcp any any -> any any (flowbits:isset,rare; dsize:11; sid:24;)
alert tcp any any -> any any (flowbits:isset,rare; ack:3308437468; sid:25;)
alert tcp any any -> any any (priority:10; dsize:11; sid:31;)
alert tcp any any -> any any (priority:10; dsize:10; sid:32;)
alert tcp any any -> any any (priority:10; ack:3308437468; sid:33;)
23 changes: 23 additions & 0 deletions tests/flowbits-prefilter-11-pkt-auto/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
requires:
min-version: 8

pcap: ../flowbit-oring/input.pcap

args:
- -k none
- --simulate-ips
- --set detect.prefilter.default=auto

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 11
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
alert.signature_id: 22
10 changes: 10 additions & 0 deletions tests/flowbits-prefilter-12-toggle/flowbit-prefilter.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alert tcp any any -> any any (flow:to_client; content:"HTTP"; flowbits:toggle,rare; flowbits:toggle,common; sid:11;)
alert tcp any any -> any any (dsize:10; flowbits:set,never; flowbits:toggle,common; sid:12;)
alert tcp any any -> any any (flowbits:isset,never; sid:21;)
alert tcp any any -> any any (flowbits:isset,common; prefilter; dsize:259; sid:22;)
alert tcp any any -> any any (flowbits:isset,never; prefilter; dsize:10; sid:23;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; dsize:11; sid:24;)
alert tcp any any -> any any (flowbits:isset,rare; prefilter; ack:3308437468; sid:25;)
alert tcp any any -> any any (priority:10; dsize:11; sid:31;)
alert tcp any any -> any any (priority:10; dsize:10; sid:32;)
alert tcp any any -> any any (priority:10; ack:3308437468; sid:33;)
Loading
Loading