这就是源代码了.其他工作就是VM做的了.
我写算法是烂过了头...其实就是简单的加下密,当时hexer说byte 穷举很容易...所以我加成了DWORD...可还是很容易..
#include <windows.h>
#include "resource.h"
#include <math.h>
#include <stdio.h>
#include <commctrl.h>
#pragma comment(lib,"comctl32.lib")
int ProcDlgMain(HWND hWnd,DWORD uMsg,DWORD wParam,DWORD lParam);
HINSTANCE hInst;
const BYTE base_key[16*16] = {
0x1a,0x75,0x19,0x4d,0x63,0x3c,0xef,0xab,0x0f,0x21,0x57,0xa0,0x01,0x12,0x72,0x1a,
0xda,0x4e,0xf3,0x6c,0xfe,0xed,0x2a,0x03,0xec,0xf5,0xb2,0x30,0x6e,0x7c,0x17,0xc4,
0x58,0x68,0x5a,0x0b,0x6f,0xeb,0x44,0xf1,0x76,0x06,0x81,0x7d,0xdc,0x29,0xfa,0x8c,
0xf4,0x64,0x10,0x95,0xe2,0xbd,0x70,0x85,0xdf,0xf0,0xe5,0x3a,0xa5,0x48,0x5b,0x5d,
0x09,0xc5,0x22,0xad,0xae,0xe6,0xd0,0xfd,0x08,0x37,0x02,0x5c,0x8f,0xea,0x54,0x9a,
0xcc,0x3f,0x20,0x3d,0x40,0x77,0xb4,0x99,0x8a,0x67,0xc9,0xcd,0x3b,0x11,0xdd,0x0a,
0x24,0x71,0xe1,0x52,0xa1,0x46,0xd8,0x92,0x8b,0xe8,0x6b,0x42,0x6d,0xfc,0xca,0x91,
0xc0,0x51,0x86,0x60,0xfb,0xb5,0xb8,0x45,0xb6,0xd6,0x31,0xc6,0x9c,0x93,0x56,0xdb,
0xf6,0x05,0x1f,0xa7,0x47,0xf8,0x80,0x79,0x66,0xa2,0xa8,0xe3,0x32,0x0e,0x00,0xee,
0x38,0x4f,0x04,0x23,0xd4,0x2c,0xde,0x89,0xaf,0xa9,0x62,0xff,0xd1,0xb9,0x9b,0x28,
0x87,0x3e,0x7f,0x96,0x98,0x4a,0x61,0x26,0x9f,0x9d,0x78,0x4b,0xd2,0x6a,0xc8,0x35,
0x94,0x50,0xb3,0x5e,0x16,0x7a,0xe4,0xe9,0x27,0x97,0x2f,0xce,0x65,0xbf,0xe7,0x39,
0x7e,0x8e,0x4c,0x25,0xbb,0xe0,0x1d,0x33,0xd7,0xf2,0x8d,0x88,0xb7,0x2e,0x90,0x69,
0x7b,0x83,0x82,0xac,0x36,0x59,0x15,0xf7,0x07,0xa6,0x1c,0xb1,0xa3,0x0d,0x2b,0xba,
0xa4,0xbc,0xd3,0x1e,0x18,0x53,0x73,0xb0,0x13,0x34,0xaa,0x41,0xcf,0xc1,0x43,0x14,
0xd9,0x2d,0xd5,0xc7,0x5f,0x55,0xc2,0x49,0x74,0x9e,0xcb,0x84,0xf9,0xbe,0xc3,0x0c
};
BOOL CheckLetter(char* p,int len)
{
for(int i = 0; i < len; i++)
{
if( ( p[i] < 'a' || p[i] > 'z' ) && ( p[i] < 'A' || p[i] > 'Z' ) )
{
return FALSE;
}
}
return TRUE;
}
BOOL CheckHexNum(char* p,int len)
{
for(int i = 0; i < len; i++)
{
if(p[i] < 'A'|| p[i] > 'F')
{
if( p[i] < '0' || p[i] > '9' )
{
return FALSE;
}
}
}
return TRUE;
}
BYTE StringToHex(char* strSource)
{
BYTE nTemp=0;
char strTemp[64];
if( strSource == NULL )
return -1;
strcpy_s(strTemp,64,strSource);
for(char cc='G',dd='g';cc<='Z',dd<='z'; cc++,dd++) //判断输入的字符串是否合法
{
if( strchr(strTemp,cc) != NULL || strchr(strTemp,dd) != NULL )
{
//::MessageBox(NULL,"请输入正确的16进制字符串!","输入错误",MB_ICONEXCLAMATION);
return -1;
}
}
for(int i = 0; i < (int)::strlen(strSource); i++)
{
int nDecNum;
switch(strSource[i])
{
case 'a':
case 'A':
nDecNum = 10;
break;
case 'b':
case 'B':
nDecNum = 11;
break;
case 'c':
case 'C':
nDecNum = 12;
break;
case 'd':
case 'D':
nDecNum = 13;
break;
case 'e':
case 'E':
nDecNum = 14;
break;
case 'f':
case 'F':
nDecNum = 15;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
nDecNum = strSource[i] - '0';
break;
default:
return 0;
}
nTemp += (WORD)nDecNum * (double)::pow((double)16,(int)strlen(strSource)-i-1);
}
return nTemp;
}
#define XORADD(a,b) a^=b;a++;
#define ADDXOR(a,b) a++;a^=b;
#define MUL(a,b) a--;a*=b;
#define MOD(a,b) a*=2;a%=b;
//void KeygenMe(char* name)
//{
// char keystr[1024] = {0};
// int namelen = strlen(name);
// for(int i = 0;i < namelen; i++)
// {
// BYTE tmp = name[i];
// tmp ^= base_key[(tmp ^ name[namelen-i] )+i];
//
// for( int j = 0; j < 10; j++ )
// {
// for(int k = 0; k < 10; k++ )
// {
// for(int l = 0; l < 5; l++)
// {
// XORADD(tmp,base_key[j*16-5]);
// XORADD(tmp,base_key[j*16-4]);
// XORADD(tmp,base_key[j*16-3]);
// XORADD(tmp,base_key[j*16-2]);
// MOD(tmp,100-i*j);
// ADDXOR(tmp,base_key[j*16-1]);
// XORADD(tmp,base_key[j*16-6]);
// ADDXOR(tmp,base_key[j*16-7]);
// XORADD(tmp,base_key[j*16-8]);
// }
// XORADD(tmp,base_key[j*16-4]);
// ADDXOR(tmp,base_key[j*16-5]);
// XORADD(tmp,base_key[j*16-6]);
// }
// XORADD(tmp,base_key[j*16-2]);
// ADDXOR(tmp,base_key[j*16-3]);
// XORADD(tmp,base_key[j*16-4]);
// }
// sprintf_s(keystr,1024,"%s%02X",keystr,tmp);
// }
//
// MessageBox(0,keystr,"ok",MB_OK);
// return;
//}
STARTUPINFO si;
int WINAPI CrackMe(HWND hwnd)
{
char strname[32] = {0};
char strserial[40] = {0};
GetStartupInfo(&si);
if (
(si.dwX != 0) ||
(si.dwY != 0) ||
(si.dwXCountChars != 0) ||
(si.dwYCountChars != 0) ||
(si.dwFillAttribute != 0) ||
(si.dwXSize != 0) ||
(si.dwYSize != 0) ||
(si.dwFlags & STARTF_FORCEOFFFEEDBACK)
)
{
return -2;
}
if( GetDlgItemText(hwnd,IDC_NAME,strname,200+1) < 2 )
{
return -1;
}
if( GetDlgItemText(hwnd,IDC_SERIAL,strserial,200+1) == 0 )
{
return -1;
}
int namelen = strlen(strname);
int seriallen = strlen(strserial);
if( namelen > 20 )
{
return -1;
}
if( namelen*2 != seriallen )
{
return -1;
}
if( !CheckLetter(strname,namelen) )
{
return -1;
}
if( !CheckHexNum(strserial,seriallen) )
{
return -1;
}
//KeygenMe(strname);
BYTE code1[40] = {0};
BYTE code2[40] = {0};
for(int i = 0;i < namelen; i++)
{
BYTE tmp = strname[i];
tmp ^= base_key[(tmp ^ strname[namelen-i] )+i];
for( int j = 0; j < 10; j++ )
{
for(int k = 0; k < 10; k++ )
{
for(int l = 0; l < 5; l++)
{
XORADD(tmp,base_key[j*16-5]);
XORADD(tmp,base_key[j*16-4]);
XORADD(tmp,base_key[j*16-3]);
XORADD(tmp,base_key[j*16-2]);
MOD(tmp,100-i*j);
ADDXOR(tmp,base_key[j*16-1]);
XORADD(tmp,base_key[j*16-6]);
ADDXOR(tmp,base_key[j*16-7]);
XORADD(tmp,base_key[j*16-8]);
}
XORADD(tmp,base_key[j*16-4]);
ADDXOR(tmp,base_key[j*16-5]);
XORADD(tmp,base_key[j*16-6]);
}
XORADD(tmp,base_key[j*16-2]);
ADDXOR(tmp,base_key[j*16-3]);
XORADD(tmp,base_key[j*16-4]);
}
char tmpkey[3] = "";
memcpy(tmpkey,&strserial[i*2],2);
BYTE cmd1 = tmp;
BYTE hexcode = StringToHex(tmpkey);
BYTE cmd2 = hexcode;
for(int j = 0; j < 2; j++)
{
for(int k = 0; k < 3; k++)
{
for(int l = 0; l < 4; l++)
{
for(int m = 0;m < 3; m++)
{
int ff = j+k+l+m;
ADDXOR(cmd1,base_key[ff*ff]);
ADDXOR(cmd1,base_key[ff*ff]);
ADDXOR(cmd1,base_key[ff*ff]);
XORADD(cmd1,base_key[j*16-5]);
ADDXOR(cmd1,base_key[j*16-5]);
}
int gg = j+k+l;
ADDXOR(cmd1,base_key[gg*gg]);
ADDXOR(cmd1,base_key[gg*gg]);
XORADD(cmd1,base_key[j*16-5]);
ADDXOR(cmd1,base_key[j*16-5]);
}
int kk = j+k;
ADDXOR(cmd1,base_key[kk*kk]);
ADDXOR(cmd1,base_key[kk*kk]);
XORADD(cmd1,base_key[j*16-5]);
ADDXOR(cmd1,base_key[j*16-5]);
}
int jj = j+j;
ADDXOR(cmd1,base_key[jj*jj]);
ADDXOR(cmd1,base_key[jj*jj]);
XORADD(cmd1,base_key[j*16-5]);
ADDXOR(cmd1,base_key[j*16-5]);
}
code1[i] = cmd1;
for(int j = 0; j < 2; j++)
{
for(int k = 0; k < 3; k++)
{
for(int l = 0; l < 4; l++)
{
for(int m = 0;m < 3; m++)
{
int ff = j+k+l+m;
ADDXOR(cmd2,base_key[ff*ff]);
ADDXOR(cmd2,base_key[ff*ff]);
ADDXOR(cmd2,base_key[ff*ff]);
XORADD(cmd2,base_key[j*16-5]);
ADDXOR(cmd2,base_key[j*16-5]);
}
int gg = j+k+l;
ADDXOR(cmd2,base_key[gg*gg]);
ADDXOR(cmd2,base_key[gg*gg]);
XORADD(cmd2,base_key[j*16-5]);
ADDXOR(cmd2,base_key[j*16-5]);
}
int kk = j+k;
ADDXOR(cmd2,base_key[kk*kk]);
ADDXOR(cmd2,base_key[kk*kk]);
XORADD(cmd2,base_key[j*16-5]);
ADDXOR(cmd2,base_key[j*16-5]);
}
int jj = j+j;
ADDXOR(cmd2,base_key[jj*jj]);
ADDXOR(cmd2,base_key[jj*jj]);
XORADD(cmd2,base_key[j*16-5]);
ADDXOR(cmd2,base_key[j*16-5]);
}
code2[i] = cmd2;
}
for( int i = 0; i < 40; i+=4 )
{
if( *(DWORD*)&code1[i] != *(DWORD*)&code2[i] )
{
return 0;
}
}
MessageBox(0,"注册成功!","CrackMe",MB_OK);
return 1;
}
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
hInst = hInstance;
DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,(DLGPROC)ProcDlgMain,NULL);
return 0;
}
int ProcDlgMain(HWND hWnd,DWORD uMsg,DWORD wParam,DWORD lParam)
{
switch( uMsg )
{
case WM_COMMAND:
{
switch( LOWORD(wParam) )
{
case IDC_ABOUT:
{
MessageBox( hWnd,"author:bug<RCT>","pediy",MB_OK|MB_ICONASTERISK|MB_APPLMODAL );
return 0;
}
break;
case IDC_CHECK:
{
int result = CrackMe(hWnd);
if( !result )
{
MessageBox(0,"注册失败","错误",MB_OK);
}
else if( result == -1 )
{
MessageBox(0,"填写不规范:\nName只能是字母\nName的长度不能大于20\nKey只能是16进制数\nKey和Name长度不匹配","错误",MB_OK);
}
else if( result == -2 )
{
MessageBox(0,"发现调试器","错误",MB_OK);
}
}
break;
}
}
break;
case WM_INITDIALOG:
{
SendMessage(hWnd,WM_SETICON,1,(LPARAM)::LoadIcon( hInst,MAKEINTRESOURCE(IDI_BUGICON)) );
InitCommonControls();
}
break;
case WM_CLOSE:
{
EndDialog(hWnd,0);
}
}
return 0;
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课