redcanaryco / surveyor

A cross-platform baselining, threat hunting, and attack surface analysis tool for security teams.
MIT License
169 stars 59 forks source link

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

Closed xC0uNt3r7hr34t closed 1 year ago

xC0uNt3r7hr34t commented 1 year ago

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

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 commented 1 year ago

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"]
  }
}