Skip to content

Commit

Permalink
tests: add tests for smb.version keyword
Browse files Browse the repository at this point in the history
Signed-off-by: jason taylor <[email protected]>
  • Loading branch information
jmtaylor90 committed Aug 29, 2023
1 parent e338b7b commit 500c99e
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/smb-version-keyword-invalid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TEST
====

Test invalid smb.version keyword syntax in signature
1 change: 1 addition & 0 deletions tests/smb-version-keyword-invalid/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert smb any any -> any any (msg:"Two smb version declarations"; flow:established; smb.version:2; smb.version:1; sid:1;)
14 changes: 14 additions & 0 deletions tests/smb-version-keyword-invalid/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
requires:
min-version: 7

args:
- -k none

pcap: ../smb-version-keyword/input.pcap

checks:
- shell:
args: grep "Can't use 2 or more smb.version declarations" suricata.log | wc -l | xargs
expect: 1

exit-code: 1
4 changes: 4 additions & 0 deletions tests/smb-version-keyword/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TEST
====

Test smb.version keyword
Binary file added tests/smb-version-keyword/input.pcap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/smb-version-keyword/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alert smb any any -> any any (msg:"SMBv1 Request"; flow:established; smb.version:1; sid:1;)
alert smb any any -> any any (msg:"SMBv2 Request"; flow:established; smb.version:2; sid:2;)
17 changes: 17 additions & 0 deletions tests/smb-version-keyword/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
requires:
min-version: 7

args:
- -k none

checks:
- filter:
count: 2
match:
event_type: alert
alert.signature_id: 1
- filter:
count: 14
match:
event_type: alert
alert.signature_id: 2

0 comments on commit 500c99e

Please sign in to comment.