Skip to content

Instantly share code, notes, and snippets.

@OlivierLaflamme
Created February 24, 2022 18:55
Show Gist options
  • Save OlivierLaflamme/4d5bea0adb395d6b34c598884b5fef08 to your computer and use it in GitHub Desktop.
Save OlivierLaflamme/4d5bea0adb395d6b34c598884b5fef08 to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <stdio.h>
#define MIN_COUNT 10
CHAR current[256];
int main() {
DWORD passed = 0;
memset(current, 0x00, 256);
while(passed < MIN_COUNT) {
HWND hwnd = GetForegroundWindow();
CHAR *title = (CHAR*)GlobalAlloc(GPTR, 256);
GetWindowTextA(hwnd, title, 256);
if(strcmp(title, current) == 0) {
passed++;
}
GlobalFree(title);
}
// You passed the user interaction check at this point code execute malicious code
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment