反汇编逆向实例_ifelse语句反汇编

反汇编逆向实例_ifelse语句反汇编

                                                    by:比方

逆向反汇编第五章,ifelse语句反汇编  by:比方
示例代码:

 

 1  #include"stdio.h"
 2 int function(int a,int b)
 3 {
 4     int c=a+b;
 5     
 6     if(c>0&&c<10)
 7     {
 8         printf("c>0");
 9     }
10     else if(c>10&&c<100)
11     {
12         printf("c>10&&c<100");
13     }
14     else
15     {
16         printf("c>10&&c<100");
17     }
18     return c;
19 }
20 void main()
21 {
22     function(1,2);
23 }

反汇编结果:

1 #include "stdio.h"
2 
3 int function(int a,int b)
4 {
00E12FE0 push ebp
00E12FE1 mov ebp,esp
00E12FE3 sub esp,0CCh
00E12FE9 push ebx
00E12FEA push esi
00E12FEB push edi
00E12FEC lea edi,[ebp-0CCh]
00E12FF2 mov ecx,33h
00E12FF7 mov eax,0CCCCCCCCh
00E12FFC rep stos dword ptr es:[edi]                   ;开始分配33个4字节空间,定位到edi,edi是来自[ebp-0CCh],定位到缓冲区头部并初始化为CC,
 
1   int c=a+b;
00E12FFE mov eax,dword ptr [a]                             变量A放入到eax,
00E13001 add eax,dword ptr [b]                             ;   变量B加上个变量A ,结果放入到eax
00E13004 mov dword ptr [c],eax                            ;   变量C等于变量A+变量B,等于 C = A+B;

 
1 if(c>0&&c<10)
00E13007 cmp dword ptr [c],0
00E1300B jle function+4Ch (0E1302Ch)                  ;比较变量C是否大于等于0,
00E1300D cmp dword ptr [c],0Ah                             ;再次比较变量C是否小于等于0x0A(16进制)
00E13011 jge function+4Ch (0E1302Ch)

 

1 {
2      printf("c>0");

00E13013 mov esi,esp                                                   ;如果大于0,且小于等于0x0A(16进制)

00E13015 push offset string "c>0" (0E1573Ch)           ;则调用printf函数,输出字符"c>0",否则跳转到0x00e1302ch
00E1301A call dword ptr [__imp__printf (0E182B8h)]
00E13020 add esp,4
00E13023 cmp esi,esp
00E13025 call @ILT+315(__RTC_CheckEsp) (0E11140h)
00E1302A jmp function+88h (0E13068h)

 

1  {
2      printf("c>10&&c<100");

00E13038 mov esi,esp

00E1303A push offset string "c>10&&c<100" (0E157A0h)       ;如果大于0x0A(16进制) ,且小于等于0x64h(16进制) 
00E1303F call dword ptr [__imp__printf (0E182B8h)]               ;则调用printf函数,输出字符"c>10&&c<100",否则跳转到0x00E13051h处
00E13045 add esp,4
00E13048 cmp esi,esp
00E1304A call @ILT+315(__RTC_CheckEsp) (0E11140h)

 

1  }    else

00E1304F jmp function+88h (0E13068h)

 

 {
     printf("c>10&&c<100");
00E13051 mov esi,esp                                                                         ;如果以上条件都不满足,直接调用printf函数,
00E13053 push offset string "c>10&&c<100" (0E157A0h)               ;这里需要注意的是,比较函数执行完会有一个jmp指令,,                                                                                                                 ; 如果jmp指令跳转的地址在下面则就是if else语句,                                                                                                                 ; 如果往上跳,则是while语句,do while语句
00E13058 call dword ptr [__imp__printf (0E182B8h)]
00E1305E add esp,4
00E13061 cmp esi,esp
00E13063 call @ILT+315(__RTC_CheckEsp) (0E11140h)
1    }
2     return c;
00E13068 mov eax,dword ptr [c]
}
00E1306B pop edi
00E1306C pop esi
00E1306D pop ebx
00E1306E add esp,0CCh
00E13074 cmp ebp,esp
00E13076 call @ILT+315(__RTC_CheckEsp) (0E11140h)
00E1307B mov esp,ebp
00E1307D pop ebp

00E1307E ret

 

 

 


 

该死的排版,麻烦死了  

转载于:https://www.cnblogs.com/hailunchina/p/3906726.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值