Skip to content

Instantly share code, notes, and snippets.

@spnow
Forked from evernick/RDTSC.cpp
Created August 1, 2017 23:10
Show Gist options
  • Save spnow/1d397b3cfa8f3946df32f990fad7d98c to your computer and use it in GitHub Desktop.
Save spnow/1d397b3cfa8f3946df32f990fad7d98c to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <stdio.h>
#include <intrin.h>
BOOL anti_debug(unsigned __int64 cnt1)
{
unsigned __int64 cnt2;
cnt2 = __rdtsc();
if ((cnt2-cnt1) > 0xFF) {
return 1;
}
return 0;
}
int main(int argc, char **argv)
{
unsigned __int64 cnt1;
cnt1 = __rdtsc();
if(anti_debug(cnt1))
printf("Debugger Detected\n");
else
printf("No Debugger...\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment