Skip to content

Instantly share code, notes, and snippets.

@bats3c
Created September 4, 2020 16:22
Show Gist options
  • Save bats3c/92d9660fbeef8b8204ca9301d8c36fe1 to your computer and use it in GitHub Desktop.
Save bats3c/92d9660fbeef8b8204ca9301d8c36fe1 to your computer and use it in GitHub Desktop.
Yara Scan Memory
INT ToReportOrNotToReportThatIsTheQuestion( YR_SCAN_CONTEXT* Context,
INT Message,
PVOID pMessageData,
PVOID pUserData
)
{
if (Message == CALLBACK_MSG_RULE_MATCHING)
{
(*(int*)pUserData) = 1;
}
if (Message == CALLBACK_MSG_RULE_NOT_MATCHING)
{
(*(int*)pUserData) = 0;
}
return CALLBACK_CONTINUE;
}
YRRulesScanMem(yrRules, (uint8_t*)StringBuffer, strlen(StringBuffer), 0, ToReportOrNotToReportThatIsTheQuestion, &dwReport, 0);
if (dwReport == 0)
{
if (strstr(StringBuffer, PIPE_NAME) == NULL)
{
DoOriginalEtwCallback(EventRecord);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment