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: add tests for smb.version keyword v3 #1380

Closed
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
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: 8

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
14 changes: 14 additions & 0 deletions tests/smb-version-keyword/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test
====

Test alerts with the smb.version keyword

PCAP
----

The pcap is a sample of network traffic provided by the original author.

Related Issues
--------------

https://redmine.openinfosecfoundation.org/issues/5075
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"; smb.version:1; sid:1;)
alert smb any any -> any any (msg:"SMBv2 Request"; 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: 8

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
Loading