test.dat格式为:
AA BB CC DD(有空格)
先把字符转成字节,对应:
D1 D2 D3 D4
------------------------------------
00401832 . 8B8D ACFDFFFF mov ecx,dword ptr ss:[ebp-0x254] ; |D2
00401838 . 8B95 B0FDFFFF mov edx,dword ptr ss:[ebp-0x250] ; |D1
0040183E . 89C8 mov eax,ecx ; |
00401840 . C1E0 08 shl eax,0x8 ; |
00401843 . 29C8 sub eax,ecx ; |
00401845 . C1E2 0A shl edx,0xA ; |
00401848 . 01C2 add edx,eax ; |
0040184A . 8B8D A8FDFFFF mov ecx,dword ptr ss:[ebp-0x258] ; |D3
00401850 . 8B85 A4FDFFFF mov eax,dword ptr ss:[ebp-0x25C] ; |D4
00401856 . 8D0481 lea eax,dword ptr ds:[ecx+eax*4] ; |
00401859 . C1E0 07 shl eax,0x7 ; |
0040185C . 29C2 sub edx,eax ; |
0040185E . 81C2 92070000 add edx,0x792 ; |
00401864 . 66:85D2 test dx,dx ; |
00401867 > . 0F85 5D040000 jnz 00401CCA ; |
文件只用4个字节D1,D2,D3,D4,运算后DX为0就成功!
void main()
{
int a,b,c,d,e=0;
for (a=0;a<=0xFF;a++)
{
for (b=0;b<=0xFF;b++)
{
for (c=0;c<=0xFF;c++)
{
for (d=0;d<=0xFF;d++)
{
__asm
{
mov ecx,b
mov edx,a
mov eax,ecx
shl eax,0x8
sub eax,ecx
shl edx,0xa
add edx,eax
mov ecx,c
mov eax,d
lea eax,dword ptr ds:[ecx+eax*4]
shl eax,0x7
sub edx,eax
add edx,0x792
movzx eax,dx
mov e,eax
}
if (e==0)
{
printf("%02X %02X %02X %02X\n",a,b,c,d);
goto endend;
}
}
}
}
}
endend:
return;
}