|
[原创]手写PE导入表,打造超小快速关机程序
不知这样解决跨平台问题没 .386 .model flat, stdcall option casemap:none include windows.inc ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .data ShutDown dd ? RtlAdjustPrivilege db 'RtlAdjustPrivilege',0 BaseNtdll dd ? ZwShutdownSystem db 'ZwShutdownSystem',0 lby db 'LoadLibraryA',0 gpa db 'GetProcAddress',0 apiaddr dd ? apiaddr1 dd ? apiaddr2 dd ? apiaddr3 dd ? baseKernel dd ? szntdll db 'ntdll.dll',0 .code GetApiAddress proc uses ecx ebx edx esi edi hModule:DWORD, szApiName:DWORD LOCAL dwReturn: DWORD LOCAL dwApiLength: DWORD mov dwReturn, 0 ;计算 API 字符串的长度(带尾部的0) mov esi, szApiName mov edx, esi Continue_Searching_Null: cmp byte ptr [esi], 0 ; 是否为 Null-terminated char ? jz We_Got_The_Length ; Yeah, we got it. :) inc esi ; No, continue searching. jmp Continue_Searching_Null ; searching....... We_Got_The_Length: inc esi ; 呵呵, 别忘了还有最后一个“0”的长度。 sub esi, edx ; esi = API Name size mov dwApiLength, esi ; dwApiLength = API Name size ;从 PE 文件头的数据目录获取输出表的地址 mov esi, hModule add esi, [esi + 3ch] assume esi: ptr IMAGE_NT_HEADERS mov esi, [esi].OptionalHeader.DataDirectory.VirtualAddress add esi, hModule assume esi:ptr IMAGE_EXPORT_DIRECTORY ; esi 指向 Kernel32.dll 的输出表 ;遍历 AddressOfNames 指向的数组匹配名字: mov ebx, [esi].AddressOfNames add ebx, hModule ; 别忘了加上基地址,AddressOfNames 是 RVA xor edx, edx ; edx = "函数计数",初始化为0 .repeat push esi ; 保存esi,后面会用到。 mov edi, [ebx] ; edi = 输出表中的当前函数名字 add edi, hModule ; 别忘了加上基地址 mov esi, szApiName ; 函数名字的首地址 mov ecx, dwApiLength ; 函数名字的长度 cld ; 设置方向标志 repz cmpsb ; 开始查找,我们先去喝杯咖啡吧 :) .if ZERO? ; 找到啦? pop esi ; 恢复 esi jmp _Find_Index ; 查找该函数的地址索引 .endif pop esi ; 恢复 esi add ebx, 4 ; 下一个函数(每个函数的地址占用4个字节) inc edx ; 增加函数计数 .until edx >= [esi].NumberOfNames jmp _Exit ; faint,没找到,凄然退出…… ;函数名称索引 -> 序号索引 -> 地址索引 ;公式: ;API’s Address = ( API’s Ordinal * 4 ) + AddressOfFunctions’ VA + Kernel32 imagebase _Find_Index: sub ebx, [esi].AddressOfNames ; 上面的 repz cmpsb 那里,如果匹配的话, ; esi 就指向了下一个函数的首地址,所以要先减掉它。 sub ebx, hModule ; 减掉基地址,得到 RVA shr ebx, 1 ; 要除以 2 ,还是因为 repz cmpsb 那行 add ebx, [esi].AddressOfNameOrdinals ; AddressOfNameOrdinals add ebx, hModule ; 别忘了基地址 movzx eax, word ptr [ebx] ; Now, eax = API’s Ordinal shl eax, 2 ; 要乘以 4 才得到偏移 add eax,[esi].AddressOfFunctions; + AddressOfFunctions’ VA add eax, hModule ; + Kernel32 imagebase ;从地址表得到导出函数地址 mov eax, [eax] ; 得到函数的 RVA add eax, hModule ; 别忘了基地址(说了很多次了,呵呵) mov dwReturn, eax ; 最终得到的函数的线性地址。(呼……好累啊,终于完成了) _Exit: mov eax, dwReturn ; done! :) ret GetApiAddress endp strat: db 64h,8Bh,40h,30h,8Bh,40h,0Ch,8Bh,70h,0Ch,0ADh,8Bh,00h,8Bh,40h,18h mov baseKernel,eax invoke GetApiAddress,baseKernel,addr lby mov apiaddr2,eax lea eax,dword ptr ds:[szntdll] push eax call apiaddr2 mov BaseNtdll,eax invoke GetApiAddress,baseKernel,offset gpa mov apiaddr3,eax ;lea eax,dword ptr ds:[RtlAdjustPrivilege] push offset RtlAdjustPrivilege push BaseNtdll call apiaddr3 mov apiaddr,eax lea eax,dword ptr ds:[ZwShutdownSystem] push eax push BaseNtdll call apiaddr3 mov apiaddr1,eax lea eax,dword ptr ds:[ShutDown] push eax push 0 push 1 push 13h call apiaddr push 2 call apiaddr1 end strat |
|
[求助]OD有没有一次性给所有相同代码下断的功能
JMP const |
|
[求助]未知壳跟踪时跑太空去了
一看入口,我就很怕很怕啦 |
|
[求助]快一个月了,实在搞不定 PC Guard5.0
发软件地址上来看看 |
|
[求助]有没有人破解过“PDF文件加密器”?网上搜不到注册机或破解版。。。
我测试了,强度不高,无论是原程序还是被加密的程序 |
|
[ZT]PhantOm plugin 1.25
崩溃中。。。。。。 |
|
[求助]程序必须脱了壳才能调试吗?
首先你的书写都没有通过微软的眼睛 嘿嘿 BP WSASend 这样吧 |
|
[求助]跪求大侠指点下Borland C++ 1999写的程序怎么破
先用DEDE来分析下,看看区段有没有VM0,如果有大事不妙 |
|
[原创]按键精灵商业版外挂破解--之--DOFUS循环战斗元旦版篇
传了份本地,为什么用那个特征码搜索呢,如果你有旧版的按键做的挂,就知道呢,第2个网络地址,是下 过了本地后下BP MessageBoxA回溯得到的,掉线是也是一样得到 |
|
[推荐]人家是怎么破风火小强1.18A的
发出来给大家看看而已 嘿嘿 |
|
[求助]现在DLL内存补丁的漏洞是不是被封了~
地址会不一样的把 系统都不一样了 |
|
[求助]现在DLL内存补丁的漏洞是不是被封了~
貌似只对XP这样的有用吧 |
|
[讨论]易语言加密安全性!伤心!
是 东城 那彩票软件? |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值