-
-
[讨论]天书夜读 逆向例子,求大牛鉴定。
-
发表于:
2014-3-21 12:07
5802
-
今天读了一下天书夜读 这本书。逆向基础不是很好,所以练习一下例子,但是例子没有给出答案。写出高级语言代码无法验证,所以请大牛看一眼,是否正确,不正确的话,还望大牛指正。
---------------------------------------------天书夜读的汇编代码--------------------------------------
00411A20 push ebp
00411A21 mov ebp,esp
00411A23 sub esp,0E8h
00411A29 push ebx
00411A2A push esi
00411A2B push edi
00411A2C lea edi,[ebp-0E8h]
00411A32 mov ecx,3Ah
00411A37 mov eax,0CCCCCCCCh
00411A3C rep stos dword ptr [edi]
00411A3E mov eax,dword ptr [a]
00411A41 add eax,dword ptr
00411A44 mov dword ptr [d],eax
00411A47 mov dword ptr [i],1
00411A4E mov dword ptr [c],0
00411A55 cmp dword ptr [c],64h
00411A59 jge myfunction+46h (411A66h)
00411A5B mov eax,dword ptr [c]
00411A5E add eax,dword ptr [i]
00411A61 mov dword ptr [c],eax
00411A64 jmp myfunction+35h (411A55h)
00411A66 mov eax,dword ptr [c]
00411A69 mov dword ptr [ebp-0E8h],eax
00411A6F cmp dword ptr [ebp-0E8h],0
00411A76 je myfunction+63h (411A83h)
00411A78 cmp dword ptr [ebp-0E8h],1
00411A7F je myfunction+6Ah (411A8Ah)
00411A81 jmp myfunction+72h (411A92h)
00411A83 mov dword ptr [d],1
00411A8A mov eax,dword ptr [c]
00411A8D mov dword ptr [d],eax
00411A90 jmp myfunction+79h (411A99h)
00411A92 mov dword ptr [d],0
00411A99 mov eax,dword ptr [d]
00411A9C pop edi
00411A9D pop esi
00411A9E pop ebx
00411A9F mov esp,ebp
-------------------------------------------写出来后的高级语言---------------------------------------
int MyFun(int a,int b)
{
int d=a+b;
int c=0;
Start:
if(c<=100)
{
c++;
goto Start;
}
switch (c)
{
case 0:
d=1;
break;
case 1:
d=c;
break;
default:
d=0;
break;
}
return d;
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课