首页 网络安全 安全学院 查看内容

获取LoadLibrary函数的代码

2009-8-13 10:19 933 0

摘要: pushad//获取kernel32.dll的基址mov eax, fs:0x30 //PEB的地址mov eax, [eax + 0x0c]mov esi, [eax + 0x1c]lodsdmov...
关键词: nbsp eax 地址 基址 ebp LoadLibrary mov ebx GetProcAddress edx

pushad//获取kernel32.dll的基址mov eax, fs:0x30 //PEB的地址mov eax, [eax + 0x0c]mov esi, [eax + 0x1c]lodsdmov eax, [eax + 0x08] //eax就是kernel32.dll的基址mov edi, eax        //同时保存kernel32.dll的基址到edimov ebp, eaxmov eax, [ebp + 3ch]   //PE首部mov edx, [ebp + eax + 78h]add edx, ebp         //edx等于引出表地址mov ecx, [edx + 18h] //ecx等于输出函数个数mov ebx, [edx + 20h]add ebx, ebp //ebx等于函数名地址 search:dec ecxmov esi, [ebx + ecx * 4]add esi, ebp //依次找到每个函数名mov eax, 0x50746547 //"PteG"cmp [esi], eax //比较"PteG"jne searchmov eax, 0x41636f72 //"Acor"cmp [esi + 4], eax //比较'Acor'jne search         //只到找到GetProcAddress()mov ebx, [edx + 24h]add ebx, ebpmov cx, [ebx + ecx * 2] //ecx=计算出来的序号值mov ebx, [edx + 1ch]add ebx, ebp //ebx=函数地址的起始位置mov eax, [ebx + ecx * 4]add eax, ebp //eax保存的就是GetProcAddress的地址//为局部变量分配空间push ebpsub esp, 50hmov ebp, esp//查找LoadLibrary的地址mov [ebp + 40h], eax //把GetProcAddress的地址保存到ebp + 40中//开始查找LoadLibrary的地址, 先构造"LoadLibrary\0"push 0x0 //即'\0'push DWORD PTR 0x41797261push DWORD PTR 0x7262694cpush DWORD PTR 0x64616f4cpush esp //压入"LoadLibrary\0"的地址push edi //edi:kernel32的基址call [ebp + 40h] //返回值(即LoadLibrary的地址)保存在eax中mov [ebp + 44h], eax //保存LoadLibrary的地址到ebp + 44hpush 0x0 下面就是看你自己的了,想做什么就做什么吧....
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部