事实上,我们直接利用dbgeng.h+dbgeng.lib,已经可以完成windbg的所有功能了
dbgeng.h文件在C:\Program Files\Debugging Tools for Windows (x86)\sdk\inc
这个文件大小为521kb,包括了一切windbg所用的debugapi
安装windbg的时候一定要选择安装sdk,不然可能没有这个文件
从上面的站点里面可以获取很多资料
我们看看介绍
PyDbgEng is a Python Wrapper For Microsoft Debug Engine.
kernel mode debugging
x86, x64 support
Wrapper for DebugCreate() API which creates IDebugClient COM interface.
Easy access to IDebugClient COM interface
Easy access to all other DbgEng COM interfaces via IDebugClient.QueryInterface()
Easy access to all DbgEng structs and enums.
Receive DbgEng events. Currently supported: IDebugEventCallbacks, IDebugOutputCallbacks
很好.完全封装了IDebugClient COM interface. 从而我们可以直接使用
py的代码有个好处就是可以用最快的速度写出测试程序
def NtCreateThread_at_entry(dbg, args):
sys.stdout.write("NtCreateThread() called with following call stack:\n")
stack_frames = dbg.get_stack_trace(FRAMES_COUNT)
for i in range(FRAMES_COUNT):
eip = stack_frames[i].InstructionOffset
if (eip == 0):
break
func_symbol = dbg.get_symbol(eip)
sys.stdout.write("[%d] %s\n" % (i, func_symbol))
sys.stdout.write("\n")
文中提到的工具
1.windbg
Install Debugging Tools for Windows 32-bit Version
http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx
Install Debugging Tools for Windows 64-bit Versions
http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx