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

Added Regex and full query for definition files with additional parameter mappings and output fields for SentinelOne #87

Merged
merged 13 commits into from
Feb 27, 2023

Conversation

xC0uNt3r7hr34t
Copy link
Contributor

@xC0uNt3r7hr34t xC0uNt3r7hr34t commented Nov 23, 2022

changes are only applied to the SentinelOne product in this PR.

  • Regex filtering is added to properly identify regex strings in a definition file and apply the appropriate operators.
  • a parameter 'query' was added to filter full queries defined in definition files and properly add them to the list of queries with the proper formatting.
  • Additional parameter mappings were added to support additional query fields in definition files.
  • Additional output fields have been added to support multiple event types that are returned in order to better see when and where matches occur with queries and definition files. StorylineID was added to be able to pivot to SentinelOne console for further investigation when necessary.

Validation:
definition file containing full query options and regular definitions
query_testing_regex_full_query

successful output of definition file using regex and showing added fields in CSV
csv_output

Resolves #85
Resolves #86

@rc-csmith rc-csmith self-requested a review December 8, 2022 16:32
@rc-csmith
Copy link
Contributor

rc-csmith commented Dec 9, 2022

Still working on a review of this but in the meantime, this is the test file I'm using for future reference

{
  "query_i_know_works":{
    "process_name":["services.exe"]
  },
  "two_1-field_queries":{
    "query":[
      "TgtProcName = \"services.exe\"",
      "DnsRequest = \"google.com\""
    ]
  },
  "1-field_query":{
    "query":["TgtProcName = \"powershell.exe\""]
  },
  "2-field_query":{
    "query":["TgtProcName = \"svchost.exe\" AND DnsRequest = \"github.com\""]
  },
  "two_2-field_queries":{
    "query":[
      "TgtProcName = \"chrome.exe\" AND DnsRequest = \"gmail.com\"",
      "FilePath = \"malware.zip\" AND TgtProcName = \"firefox.exe\""
    ]
  },
  "regex_test":{
    "ipaddr":["(^127\\.)|(^10\\.)|(^172\\.1[6-9]\\.)|(^172\\.2[0-9]\\.)|(^172\\.3[0-1]\\.)|(^192\\.168\\.)"],
    "process_name":["[A-Z]{9}.exe"]
  }
}

Copy link
Contributor

@rc-csmith rc-csmith left a comment

Choose a reason for hiding this comment

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

Simplified the code a little bit to avoid using regex checks unless absolutely necessary.

I really like the expanded list of supported event fields - I haven't fully tested that portion but the column orders look good and the names make sense.

products/sentinel_one.py Outdated Show resolved Hide resolved
products/sentinel_one.py Outdated Show resolved Hide resolved
products/sentinel_one.py Outdated Show resolved Hide resolved
products/sentinel_one.py Outdated Show resolved Hide resolved
products/sentinel_one.py Outdated Show resolved Hide resolved
Copy link
Contributor

@rc-csmith rc-csmith left a comment

Choose a reason for hiding this comment

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

Looks great to me!

edit: going to go ahead and merge so we can update future branches with these changes and adjust code accordingly

@rc-csmith rc-csmith merged commit bc25c96 into redcanaryco:master Feb 27, 2023
xC0uNt3r7hr34t pushed a commit to xC0uNt3r7hr34t/surveyor that referenced this pull request Jun 30, 2023
Added Regex and full query for definition files with additional parameter mappings and output fields for SentinelOne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants