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: add test for ldap operation keywords - v4 #2238

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
5 changes: 5 additions & 0 deletions tests/detect-ldap-operation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Test ldap.request.operation, ldap.responses.operation and ldap.responses.count keywords.

PCAP from ../ldap-search/ldap.pcap

Redmine ticket: https://redmine.openinfosecfoundation.org/issues/7453
12 changes: 12 additions & 0 deletions tests/detect-ldap-operation/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
alert tcp any any -> any any (msg:"Test search request number argument"; ldap.request.operation:3; sid:1;)
alert tcp any any -> any any (msg:"Test search request str argument"; ldap.request.operation:search_request; sid:2;)
alert tcp any any -> any any (msg:"Test search result entry"; ldap.responses.operation:search_result_entry; sid:3;)
alert tcp any any -> any any (msg:"Test search result done"; ldap.responses.operation:search_result_done; sid:4;)
alert tcp any any -> any any (msg:"Test search result done at index 1"; ldap.responses.operation:search_result_done,1; sid:5;)
alert tcp any any -> any any (msg:"Test search result done at any index"; ldap.responses.operation:search_result_done,any; sid:6;)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also test ,all ?

alert tcp any any -> any any (msg:"Test search result done at last index"; ldap.responses.operation:search_result_done,-1; sid:7;)
alert tcp any any -> any any (msg:"Test number of LDAP responses is 2"; ldap.responses.count:2; sid:8;)
alert tcp any any -> any any (msg:"Test number of LDAP responses is greater than 0"; ldap.responses.count:>0; sid:9;)
alert tcp any any -> any any (msg:"Test search result done at index 0"; ldap.responses.operation:search_result_done,0; sid:10;)
alert tcp any any -> any any (msg:"Test number of LDAP responses is 10"; ldap.responses.count:10; sid:11;)
alert tcp any any -> any any (msg:"Test number of LDAP responses is greater than 2"; ldap.responses.count:>2; sid:12;)
85 changes: 85 additions & 0 deletions tests/detect-ldap-operation/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
requires:
min-version: 8

pcap: ../ldap-search/ldap.pcap

args:
- -k none --set stream.inline=true

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 4
ldap.request.operation: search_request
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 4
ldap.request.operation: search_request
alert.signature_id: 2
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 6
ldap.responses[0].operation: search_result_entry
alert.signature_id: 3
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 8
ldap.responses[1].operation: search_result_done
alert.signature_id: 4
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 8
ldap.responses[1].operation: search_result_done
alert.signature_id: 5
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 8
ldap.responses[1].operation: search_result_done
alert.signature_id: 6
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 8
ldap.responses[1].operation: search_result_done
alert.signature_id: 7
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 8
alert.signature_id: 8
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 9
- filter:
count: 0
match:
event_type: alert
alert.signature_id: 10
- filter:
count: 0
match:
event_type: alert
pcap_cnt: 8
alert.signature_id: 11
- filter:
count: 0
match:
event_type: alert
alert.signature_id: 12
Loading