Skip to content

Instantly share code, notes, and snippets.

@Antonlovesdnb
Created March 19, 2022 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Antonlovesdnb/1c9f32237794be08a1d8ca347e4ccce5 to your computer and use it in GitHub Desktop.
Save Antonlovesdnb/1c9f32237794be08a1d8ca347e4ccce5 to your computer and use it in GitHub Desktop.

Splunk PS Tree Enriched Query

Notes

Query

Query is very finnicky and considered alpha, probably not suitable for production use, but useful for digging into a particular event

index=sysmon

| eval guid_noramlized=coalesce(ProcessGuid,SourceProcessGUID)

| stats values(DestinationIp) AS DestinationIp, values(CommandLine) AS CommandLine,values(Initiated) AS Initiated,values(_time) AS time,values(ParentImage) AS ParentImage, values(Image) AS Image,values(ParentProcessId) AS ParentProcessId,values(ProcessId) AS ProcessId, values(ImageLoaded) AS ImageLoaded,values(TargetObject) AS TargetObject,values(TargetImage) AS TargetImage, values(ParentCommandLine) AS ParentCommandLine, values(User) AS User,values(OriginalFileName) AS OriginalFileName BY guid_noramlized

| fillnull value="NULL" 

| mvexpand time
| mvcombine ImageLoaded
| mvcombine TargetImage
| mvcombine TargetObject
| mvcombine DestinationIp

| eval parent = ParentImage." (".ParentProcessId.")"
| eval child = Image." (".ProcessId.")"
| eval detail=strftime(time,"%Y-%m-%d %H:%M:%S")." 

[User Name]:
".User."

[Original File Names]:
".OriginalFileName."

[Parent Process Value]:
".ParentImage."

[Parent Command Line Value]:
".ParentCommandLine." 

[Command Line Value]:
".CommandLine." 

[Destination IPs Contacted]:
".DestinationIp." 

[Initiated (T/F)]:
".Initiated." 

[Images Loaded]:
".ImageLoaded."

[Processes Accessed]:
".TargetImage."

[Registry Keys Modified]: 
".TargetObject

| pstree child=child parent=parent detail=detail spaces=50
| table tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment