-
Notifications
You must be signed in to change notification settings - Fork 121
detect: add checks for count keyword #2634
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Test Description | ||
|
|
||
| Test mime email.received keyword with multi-buffer features | ||
|
|
||
| ## PCAP | ||
|
|
||
| reused | ||
|
|
||
| ## Redmine Ticket | ||
|
|
||
| https://redmine.openinfosecfoundation.org/issues/5044 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| %YAML 1.1 | ||
| --- | ||
|
|
||
| outputs: | ||
| - eve-log: | ||
| enabled: yes | ||
| filename: eve.json | ||
| types: | ||
| - smtp: | ||
| custom: [received] # for 'received' logging information | ||
| - alert: | ||
| smtp: yes # enable dumping of smtp fields |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Match | ||
| alert smtp any any -> any any (msg:"Test mime email received count 3"; email.received: count 3; sid:10;) | ||
| alert smtp any any -> any any (msg:"Test mime email received count !2"; email.received: count !2; sid:11;) | ||
| # No match | ||
| alert smtp any any -> any any (msg:"Test mime email received count 0"; email.received: count 0; sid:20;) | ||
| alert smtp any any -> any any (msg:"Test mime email received count <3"; email.received: count <3; sid:21;) | ||
|
|
||
| # Match | ||
| alert smtp any any -> any any (msg:"Test mime email received"; email.received: all; content:"from"; sid: 30;) | ||
| alert smtp any any -> any any (msg:"Test mime email received"; email.received: all_or_absent; content:"from"; sid: 31;) | ||
| alert smtp any any -> any any (msg:"Test mime email received"; email.received: nb 2; content:"relay1"; sid: 32;) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/nb/index/g
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. specifies the number of expected matches of the content match following it
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| requires: | ||
| min-version: 9 | ||
|
|
||
| args: | ||
| - -k none --set stream.inline=true | ||
|
|
||
| pcap: ../detect-email-received/input.pcap | ||
|
|
||
| checks: | ||
| - filter: | ||
| count: 1 | ||
| match: | ||
| event_type: smtp | ||
| email.received[0]: "from client.local (client.local [10.0.0.1]) by smtp.relay1.com with ESMTP id relay1abc; Thu, 10 Apr 2025 12:00:00 -0000" | ||
| email.received[1]: "from smtp.relay1.com (smtp.relay1.com [10.0.0.10]) by smtp.relay2.com with ESMTP id relay2xyz; Thu, 10 Apr 2025 12:01:00 -0000" | ||
| email.received[2]: "from smtp.relay2.com (smtp.relay2.com [10.0.0.20]) by smtp.destination.com with ESMTP id final123; Thu, 10 Apr 2025 12:02:00 -0000" | ||
| - filter: | ||
| count: 1 | ||
| match: | ||
| event_type: smtp | ||
| email.received.__len: 3 | ||
| - filter: | ||
| count: 1 | ||
| match: | ||
| event_type: alert | ||
| alert.signature_id: 10 | ||
| # we do not have a way to log email.received in alerts | ||
| # see https://redmine.openinfosecfoundation.org/issues/7696 | ||
| - filter: | ||
| count: 1 | ||
| match: | ||
| event_type: alert | ||
| alert.signature_id: 11 | ||
| - filter: | ||
| count: 0 | ||
| match: | ||
| event_type: alert | ||
| alert.signature_id: 20 | ||
| - filter: | ||
| count: 0 | ||
| match: | ||
| event_type: alert | ||
| alert.signature_id: 21 | ||
|
|
||
| - filter: | ||
| count: 1 | ||
| match: | ||
| event_type: alert | ||
| alert.signature_id: 30 | ||
| - filter: | ||
| count: 1 | ||
| match: | ||
| event_type: alert | ||
| alert.signature_id: 31 | ||
| - filter: | ||
| count: 1 | ||
| match: | ||
| event_type: alert | ||
| alert.signature_id: 32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work with count as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving
countout for now