Skip to content

Conversation

@0xHasanM
Copy link

This artifact constructs a timeline of PowerShell command execution by correlating commands from ConsoleHost_History.txt with USNJRNL Data_Added events.

query: |
LET USN_EVENTS <= SELECT
Timestamp,
split(string=OSPath, sep_string="\\")[-8] AS username,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You dont need to split here - just use OSPath[-8]

https://docs.velociraptor.app/docs/forensic/filesystem/paths/

*
FROM PSReadline

LET results_with_timestamp <= SELECT *
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will be very slow. It looks like you want to do a join. See this

https://docs.velociraptor.app/docs/vql/join/

WHERE CommandID = EventID
})

LET PSReadline_length <= array(_={ SELECT CommandID FROM PSReadline_Indexed }).CommandID
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can just do LET PSReadline_length <= PSReadline_Indexed.CommandID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants