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

detect/datasets: adds test for unset operation #2071

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
20 changes: 20 additions & 0 deletions tests/datasets-10-unset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Test Description
================

This test demonstrates the unset operation for datasets.

PCAP
====

Running as server `python3 -m http.server 8001`
And as clients
```
curl -A "useragent1" http://127.0.0.1:8001/toto
curl -A "useragent2" http://127.0.0.1:8001/toto
curl -A "useragent1" http://127.0.0.1:8001/tata
```

Related tickets
===============

https://redmine.openinfosecfoundation.org/issues/7195
1 change: 1 addition & 0 deletions tests/datasets-10-unset/expected/after.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dXNlcmFnZW50Mg==
2 changes: 2 additions & 0 deletions tests/datasets-10-unset/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alert http any any -> any any (http.uri; content: "/toto"; http.user_agent; dataset:set,ua-seen,type string,save after.csv; sid:1;)
alert http any any -> any any (http.uri; content: "/tata"; http.user_agent; dataset:unset,ua-seen,type string,save after.csv; sid:2;)
21 changes: 21 additions & 0 deletions tests/datasets-10-unset/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
requires:
min-version: 7

args:
- --data-dir=${OUTPUT_DIR} -k none --runmode single

checks:
# 2 sets and 1 unset alerts
- filter:
count: 2
match:
event_type: alert
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 2
- file-compare:
filename: after.csv
expected: expected/after.csv
Binary file added tests/datasets-10-unset/unset.pcap
Binary file not shown.
Loading