Skip to content
Closed
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
7 changes: 7 additions & 0 deletions tests/datasets-validate-postmatch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Description

Test datasets only sets when there is a full signature match.

# Ticket

https://redmine.openinfosecfoundation.org/issues/5576
Binary file added tests/datasets-validate-postmatch/input.pcap
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/datasets-validate-postmatch/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this will not match, and thus not write to the dataset
alert http any any -> $HOME_NET any (msg:"HTTP learning"; flow:established,to_client; http.content_type; content:"noone"; http.server; content:"ECS"; fast_pattern; dataset:set,http_none,type string,state output/none.intel; sid:2; rev:1; priority:2;)
# this will match, and thus write to the dataset
alert http any any -> $HOME_NET any (msg:"HTTP learning"; flow:established,to_client; http.content_type; content:"ocsp"; http.server; content:"ECS"; fast_pattern; dataset:set,http_match,type string,state output/match.intel; sid:3; rev:1; priority:2;)
25 changes: 25 additions & 0 deletions tests/datasets-validate-postmatch/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
requires:
min-version: 8

args:
- -k none

checks:
# only sid 3 should trigger
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 3
- filter:
count: 0
match:
event_type: alert
alert.signature_id: 2
# data should only be written to one dataset
- shell:
args: cat none.intel | wc -l | xargs
expect: 0
- shell:
args: cat match.intel | wc -l | xargs
expect: 1
Loading