首页
社区
课程
招聘
[求助]关于卡巴斯基的反汇编书e版的不明白地方请指教下
发表于: 2007-8-3 23:41 3927

[求助]关于卡巴斯基的反汇编书e版的不明白地方请指教下

2007-8-3 23:41
3927
小弟破解方面菜鸟一只,英文一般,最近在啃这本书的英文电子版,作为入门,
可是看书的时候感觉这书里好像很多错误,也不知道是不是我没理解,还是英文太差

列出看到现在遇到的不明白的地方请大家指点下,谢谢了(以后有不明白的我就在这帖子里续贴,请大家帮忙哈):
1
.text:00401000 push  ebp
.text:00401001 mov   ebp, esp
.text:00401003 sub   esp, 14h
.text:00401006 mov   [ebp+0xC], offset sub_401046
.text:0040100D mov   [ebp+0x8], offset sub_401058
.text:00401014 mov   [ebp+0x4], offset sub_40106A
.text:0040101B mov   [ebp+0x14], 0
.text:00401022 jmp   short loc_40102D
.text:00401024 mov   eax, [ebp+0x14]
.text:00401027 add   eax, 1
.text:0040102A mov   [ebp+0x14], eax
.text:0040102D cmp   [ebp+0x14], 3
.text:00401031 jge   short loc_401042
.text:00401033 mov   ecx, [ebp+0x14]
.text:00401036 mov   edx, [ebp+ecx*4+0xC]
.text:0040103A mov   [ebp+0x10], edx
.text:0040103D call [ebp+0x10]
这段代码的stack frame作者都用的 ebp+* 那不是破坏父函数的栈内容了吗?是不是应该是减?

2
.text:00401000 push  ebp
.text:00401001 mov   ebp, esp
.text:00401003 push  ebx
.text:00401004 push  esi
.text:00401005 push  edi
.text:00401006 lea   esi, [401012h]
.text:0040100C push  esi
.text:0040100D jmp 401017
.text:0040100D ; This would seem to be a simple branch -
.text:0040100D ; what could possibly be unusual in it? However, it's not
.text:0040100D ; a simple branch, but a masked function call. How
.text:0040100D ; do we know this? Let's go to address 0x401017 and see.
.text:0040100D ; .text:00401017   push   ebp
.text:0040100D ; .text:00401018   mov    ebp, esp
.text:0040100D ; .text:0040101A   pop    ebp
.text:0040100D ; .text:0040101B   retn
.text:0040100D ; What do you think - where does this ret return control?
.text:0040100D ; Naturally, to the address that lies on the top of the
.text:0040100D ; stack. And what do we have there? PUSH EBP from line
.text:0040100D ; 401017 is popped back by the POP from line 40101B.
.text:0040100D ; Well... let's return back to the JMP instruction
.text:0040100D ; and begin slowly scrolling the disassembler window up,
.text:0040100D ; tracing all calls to the stack. Here it is!
.text:0040100D ; The PUSH ESI instruction from line 401000C throws the
.text:0040100D ; contents of the SI register onto the top of the stack,
.text:0040100D ; and the register takes the value of 0x401012,
.text:0040100D ; which is simply the address of the beginning
.text:0040100D ; of the function called by the JMP instruction.
.text:0040100D ; (To be more exact, it's not an address but an offset.
.text:0040100D ; But this isn't of great importance.)
.text:00401012 pop   edi
.text:00401013 pop   esi
.text:00401014 pop   ebx
.text:00401015 pop   ebp
.text:00401016 retn
作者在注释的最后说0x401012是jmp跳去的函数的开始,那不是函数返回的应该执行的语句吗?

3
The Generalized Code of a Function Epilog

Epilog 1
pop        ebp
add        esp, 64h
retn

函数的结尾是先出栈ebp 然后再加esp?作者是不是写反了啊?

请指教!

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 846
活跃值: (221)
能力值: (RANK:570 )
在线值:
发帖
回帖
粉丝
2
堆栈,就是从高象低增长

所以减是分配堆栈空间,加是释放堆栈空间

建议楼主先去看看数据结构里面有关堆栈的描述,然后再看这个就比较好理解了
2007-8-4 14:52
0
雪    币: 203
活跃值: (11)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
斑竹大大,栈结构我知道啊,书里这3个例子都没有错误吗?我怎么算都不对啊。
怎么看的人好多,只有一个回复。。。这问题太菜了吗?
2007-8-4 16:48
0
游客
登录 | 注册 方可回帖
返回
//