Skip to content

Commit

Permalink
rules/bidir: adds engine-analysis tests
Browse files Browse the repository at this point in the history
Ticket: 5665
  • Loading branch information
catenacyber committed Oct 8, 2024
1 parent e8287ca commit acbf4ea
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/rules/detect-bidir-http-rule/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Description

Test bidirection rule with HTTP analysis

# Ticket

https://redmine.openinfosecfoundation.org/issues/5665
1 change: 1 addition & 0 deletions tests/rules/detect-bidir-http-rule/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http1 any any => any any (msg:"matching both uri and status"; sid: 1; http.uri; content: "/download"; http.stat_code; content: "200";)
20 changes: 20 additions & 0 deletions tests/rules/detect-bidir-http-rule/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
requires:
min-version: 8
pcap: false

args:
- --engine-analysis

checks:
- filter:
filename: rules.json
count: 1
match:
id: 1
engines[0].name: "http_uri"
engines[0].direction: "toserver"
engines[0].app_proto: "http"
engines[1].name: "http_stat_code"
engines[1].direction: "toclient"
engines[1].app_proto: "http"
mpm.buffer: "http_uri"
7 changes: 7 additions & 0 deletions tests/rules/detect-bidir-ja3-rule/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Description

Test bidirection rule with TLS ja3 analysis

# Ticket

https://redmine.openinfosecfoundation.org/issues/5665
1 change: 1 addition & 0 deletions tests/rules/detect-bidir-ja3-rule/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert tls any any => any any (msg:"bidir ja3"; ja3s.hash; content:"5d79edf64e03689ff559a54e9d9487bc"; ja3.string; content:"771,49196-49200"; sid:1;)
20 changes: 20 additions & 0 deletions tests/rules/detect-bidir-ja3-rule/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
requires:
min-version: 8
pcap: false

args:
- --engine-analysis

checks:
- filter:
filename: rules.json
count: 1
match:
id: 1
engines[0].name: "ja3.string"
engines[0].direction: "toserver"
engines[0].app_proto: "tls"
engines[1].name: "ja3s.hash"
engines[1].direction: "toclient"
engines[1].app_proto: "tls"
mpm.buffer: "ja3.string"

0 comments on commit acbf4ea

Please sign in to comment.