Skip to content

Instantly share code, notes, and snippets.

@spnow
Forked from evernick/IOport.cpp
Created August 1, 2017 23:06
Show Gist options
  • Save spnow/d3421fef7c04908e4a0fe588ef557bb8 to your computer and use it in GitHub Desktop.
Save spnow/d3421fef7c04908e4a0fe588ef557bb8 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <windows.h>
int anti_debug(){
int rc=0;
__try
{
__asm
{
mov eax, 'VMXh'
mov ebx, 0;
mov ecx, 0xA
mov edx, 'VX'
in eax, dx;
cmp ebx, 'VMXh'
jne notVmware
jmp isVmware
notVmware:
mov rc, 0
jmp done
isVmware:
mov rc, eax
done:
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
rc = 0;
}
return rc;
}
int main(int argc, char **argv)
{
if(anti_debug())
printf("VM Detected\n");
else
printf("No VM...\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment