#include<iostream>
00F64351 mov ebp,esp ;设置main函数的栈帧基址,即将栈顶指针esp赋给ebp(栈帧基址寄存器)
00F64353 sub esp,0D4h ;设置新的栈顶 D4h = 212 ,用户初始化堆栈和存放局部变量
00F64359 push ebx ;保护上下文 ebx
00F6435A push esi ;保护上下文 esi
00F6435B push edi ;保护上下文 edi
00F6435C lea edi,[ebp-0D4h] ;将edi设置为栈顶位置
00F64362 mov ecx,35h ;ecx为rep重复的次数
00F64367 mov eax,0CCCCCCCCh ; 在目的地址写入的数据
00F6436C rep stos dword ptr es:[edi] ;将eax的内容写入到es:[edi]处ccccccc为int 3中断,防止意外执行了该处的内容,stos指令可参 考: http://hi.baidu.com/freeboundless/item/bbcb3408cca31e026c90482b
00F6436E mov eax,dword ptr ds:[00F6F0E0h] ;此处代码用于将security_cookie 存放到堆栈帧中,security _cookie可参考: http://bbs.pediy.com/archive/index.php?t-126858.html
00F64373 xor eax,ebp
00F64375 mov dword ptr [ebp-4],eax
char cards[] = "strings"; // 定义数组并初始化为“string”,该数组为静态数组,在编译时就分配了存储空间
00F64378 mov eax,dword ptr ds:[00F6CC70h] ; 在内存0x 00f6cc70h 处可以看到字符串 strings\0
00F6437D mov dword ptr [1bf96c],eax ;
4380 mov ecx,dword ptr ds:[0F6CC74h]
00F64386 mov dword ptr [ebp-0Ch],ecx ;ebp 为main函数的栈帧基址 esp指向栈帧的栈顶 ,每一个函数都有一个栈帧
return 0;
00F64389 xor eax,eax ; 返回值 0 使用异或运算的到返回值,将返回值保存到 eax 寄存器中返回
int main(){
; main函数,main函数保存调用main函数的函数上下文
00F64351 mov ebp,esp ;设置main函数的栈帧基址,即将栈顶指针esp赋给ebp(栈帧基址寄存器)
00F64353 sub esp,0D4h ;设置新的栈顶 D4h = 212 ,用户初始化堆栈和存放局部变量
00F64359 push ebx ;保护上下文 ebx
00F6435A push esi ;保护上下文 esi
00F6435B push edi ;保护上下文 edi
00F6435C lea edi,[ebp-0D4h] ;将edi设置为栈顶位置
00F64362 mov ecx,35h ;ecx为rep重复的次数
00F64367 mov eax,0CCCCCCCCh ; 在目的地址写入的数据
00F6436C rep stos dword ptr es:[edi] ;将eax的内容写入到es:[edi]处ccccccc为int 3中断,防止意外执行了该处的内容,stos指令可参 考: http://hi.baidu.com/freeboundless/item/bbcb3408cca31e026c90482b
00F6436E mov eax,dword ptr ds:[00F6F0E0h] ;此处代码用于将security_cookie 存放到堆栈帧中,security _cookie可参考: http://bbs.pediy.com/archive/index.php?t-126858.html
00F64373 xor eax,ebp
00F64375 mov dword ptr [ebp-4],eax
char cards[] = "strings"; // 定义数组并初始化为“string”,该数组为静态数组,在编译时就分配了存储空间
00F64378 mov eax,dword ptr ds:[00F6CC70h] ; 在内存0x 00f6cc70h 处可以看到字符串 strings\0
00F6437D mov dword ptr [1bf96c],eax ;
4380 mov ecx,dword ptr ds:[0F6CC74h]
00F64386 mov dword ptr [ebp-0Ch],ecx ;ebp 为main函数的栈帧基址 esp指向栈帧的栈顶 ,每一个函数都有一个栈帧
return 0;
00F64389 xor eax,eax ; 返回值 0 使用异或运算的到返回值,将返回值保存到 eax 寄存器中返回
}
以上加红的的代码就是将堆中0x00f6cc70处的strings\0转移到了main的栈帧0x001bf96c 处,刚好转移了8个字符(包括空字符\0)