如题所说。
这是一个简单的PYTHON HOOK引擎。
因为PYTHON是一个高效率的脚本语言,所以借住这个你能快速高效的HOOK所要分析的目标函数,进而分析各种你需要的。
当然,具体如何使用就得看你的意愿和想法了。
update 2010.9.17:
增加了一个HOOKDecorator,使用更简单。
p.s.还并不明白Decorator是为什么而设计,所以也不知道在这里用Decorator是否合适。
等有机会弄清楚了,如果不合适的话就去掉
update 2010.9.28
把HookProc代码放上去了。并且增加了一个IATHOOK和EATHOOK。
以后不会再在这儿更新了。
新地址:http://code.google.com/p/pydotdll/
欢迎加入 = =#
Hook LoadLibraryA
代码:
@HOOKDecorator('kernel32.LoadLibraryA', dll=ctypes.c_char_p) def LoadLibraryA(dll): handle = OriginFuncion(dll) print '%s: 0x%08X' % (os.path.basename(dll), handle) return handle
代码:
@HOOKDecorator('user32.MessageBoxA', title=ctypes.c_char_p) def MessageBoxA(handle, msg, title, type): return OriginFuncion(handle, msg, 'PYdotDLL!!', type)
代码:
format PE console include "%include%/win32ax.inc" xx: i MessageBoxA, 0, 'Hello guy !', 'i am title .', 0 ret entry $ i LoadLibraryA, 'PYdotDLL.dll' i CreateThread, 0, 0, xx, 0, 0, 0 ret
Hook InternetConnectA
redirect www.baidu.com 2 bbs.pediy.com
代码:
@HOOKDecorator('wininet.InternetConnectA', servername=ctypes.c_char_p) def InternetConnectA(handle, servername, serverport, username, password, service, flags, context): if servername.lower() == 'www.baidu.com': servername = 'bbs.pediy.com' print 'Redirect It ! : www.baidu.com -> bbs.pediy.com' sys.stdout.flush() return OriginFuncion(handle, servername, serverport, username, password, service, flags, context)
你可以在这里下载所有代码PYdotDLL-0.7.6.zip。