-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcrc.cpp
45 lines (38 loc) · 795 Bytes
/
crc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
#include <windows.h>
#include "crc.h"
static void guard_func()
{
char pass[100];
printf("Input String : ");
scanf("%100s", pass);
if(!strcmp(pass, "test"))
printf("Good\n");
else
printf("Bad Password\n");
}
static void dummy() {}
DWORD WINAPI anti_debug(LPVOID lpParam)
{
unsigned long szFunc = (unsigned long)&dummy - (unsigned long)&guard_func;
unsigned char *buf = (unsigned char *)malloc(szFunc);
printf("%X\n", szFunc);
while(1)
{
memset(buf, 0, szFunc+1);
memcpy(buf, guard_func, szFunc);
initCRC(szFunc, buf);
unsigned __int64 crc = make_crc();
if(crc != 0x26af9b5e0bcafe9e)
ExitProcess(-1);
Sleep(1000);
}
free(buf);
return 0;
}
int main(int argc, char **argv)
{
CreateThread(0,0,anti_debug,0,0,0);
guard_func();
return 0;
}