动态的查找Kernel32.dll的模块句柄与 GetPro
未识别博客 · seath · 2004-01-03
动态的查找Kernel32.dll的模块句柄与 GetProcAddress的API函数地址
时间: 2004-01-03
;适用系统Win9x/me/2k/xp/nt
extrn MessageBoxA: proc
extrn ExitProcess: proc
include wap32.inc
.386
.model flat,stdcall
.data
db 0
.code
Start:
mov eax,[esp] ;//取Kernel32返回地址
and ax,0f000h
mov esi,eax ;//得到Kernel.PELoader代码位置(不精确)
LoopFindKernel32:
sub esi,1000h
cmp W [esi],'ZM' ;//搜索EXE文件头
jnz short LoopFindKernel32
GetPeHeader:
movzx edi,W [esi.PEHeaderOffset]
add edi,esi
cmp W [edi],'EP' ;//确认是否PE文件头
jnz short LoopFindKernel32
;//////////////////////////////////////////////////任务:查找GetProcAddress函数地址
GetPeExportTable:
mov ebp,[edi.fhExportsRVA]
add ebp,esi ;//得到输出函数表
GetExportNameList:
mov ebx,[ebp.etExportNameList] ;//得到输出函数名表
add ebx,esi
xor eax,eax ;//函数序号计数
mov edx,esi ;//暂存Kernel32模块句柄
LoopFindApiStr:
add ebx,04
inc eax ;//增加函数计数
mov edi,[ebx]
add edi,edx ;//得到一个Api函数名字符串
call PushStrGetProcAddress
db 'GetProcAddress',0
PushStrGetProcAddress:
pop esi ;//得到Api名字字符串
xor ecx,ecx
mov cl,15 ;//GetProcAddress串大小
cld
rep cmpsb
jnz short LoopFindApiStr
mov esi,edx
movebx,[ebp.etExportOrdlList]
addebx,esi ;//取函数序号地址列表
movzx ecx,W [ebx+eax*2]
mov ebx,[ebp.etExportAddrList]
add ebx,esi ;//得到Kernel32函数地址列表
mov ebx,[ebx+ecx*4]
add ebx,esi ;//计算GetProcAddress函数地址
;现在: esi=Kernel32.dll hModule ebx=GetProcAddress
int3;
ret
end Start
seath
引用(Trackback0)
|
编辑
评论
发表评论
用户名:
Email:
主页:
最后更新
我写的病毒疫苗程序
我编写的病毒Trojan.Dicta.5632
动态的查找Kernel32.dll的模块句柄与 GetProcAddress的API函数地址
WIN9X内核线程注入及进程不死技
SEH in ASM 研究
p2p蠕虫的代码
Elkern.C源代码
CIH1.2完全源程序
MBR加载过程
中断发生时候
原始快照:web.archive.org