|
本帖最后由 diddom 于 2012-5-30 03:34 编辑
主题: 紫水晶 WinDBG 使用教学(二)
这篇文章是第二章
我的学习经验告诉我, 先了解 WinDBG 才是最重要的
所以这篇不会是指令的应用范例, 别急着想操纵 WinDBG 这怪物
在我刚学习使用 WinDBG 时, 根本还不了解它
确忙着收集一堆指令的应用范例, ><"
後来却发现指令不能用, 且指令打上去後,
WinDBG 会给你一堆让你措手不及的回应
所以还是一步一步来吧
废话少说
一. WinDBG 内建许多指令供你应用, 但其他指令是怎麽来的呢?
其实是 DLL 档案的 export function, 你也可以称这些 DLL file 是 WinDBG 的外挂(plugin)
(你可别说每个 DLL 档案的 export function 都可拿来当 WinDBG 的指令呢)
e文对这些扩充指令的正式称呼是 Extension Command
我们先来实做一个实验
先在 WinDBG 命令列输入 !strct _EPROCESS
你得到什麽回应呢?
不卖关子
因为你还没有 load 该指令的 DLL 档案, 所以没有得到你想要的答案
先用 explorer 浏览到 C:\Program Files\Debugging Tools for Windows (x86)\w2kfre 这目录
里面有个 kdex2x86.dll 档案
将它拷贝到 C:\Program Files\Debugging Tools for Windows (x86) 底下
(也就你WinDBG的安装目录)
然後在 WinDBG 指令列输入 .load kdex2x86.dll
是的, .load 指令就是装载 DLL, 完毕後你再输入 !strct _EPROCESS
现在你应该看到 _EPROCESS 这结构的面貌了吧
strct 只是 kdex2x86.dll 的 export function 的其中之一, 功能是用来看结构的
这小段的介绍, 只是想告诉你 Extension Command 是怎麽来的
二. 善用 help 指令, 快速的了解每个 Dll 的 export function 的功能
(也就是 Extension Command)
在安装 WinDBG 後, 里面好几个目录, 每个目录里面都有众多的 Dll files,
我们不知道这些 Dll File 是做什麽用的, 但如何快速了解它的功能呢
嗯~, 是的, 每个 Dll file 里面都有一个 help function,
好让我们快速的了解每个 Extension Command 的功能和使用方法
首先, 让我们用 IDA 来看看 kdex2x86.dll 它的 export function
ExtensionApiVersion 4B405920 1
WinDbgExtensionDllInit 4B405840 2
apc 4B409070 3
dpc 4B409390 4
ethread 4B408E00 5
help 4B40D980 6
idt 4B4095B0 7
ip 4B403FE0 8
kqueue 4B408FA0 9
kthread 4B408ED0 10
lastlivetime 4B410D70 11
list 4B408540 12
s 4B4033A0 13
singlelist 4B4087B0 14
smb 4B407F30 15
stack 4B4115F0 16
strct 4B409B20 17
version 4B405930 18
xpool 4B40A210 19
DllEntryPoint 4B447370
虽然不多, 但一个一个摸索也很浪费时间
现在让我们在 WinDBG 的命令列输入
!kdex2x86.help
你将得到下面列表的讯息,
lkd> !kdex2x86.help
help - Display this message
version - Display extension dll version
apc [-?h] [expression] - Dump APC or all APCs
dpc [-?h] [expression] - Dump DPC or all DPCs
ethread [-?h] [expression] - Display ETHREAD structure
kthread [-?h] [expression] - Display KTHREAD structure
idt [-?h] [processornumber [interruptnumber]]
- Dump information about IDT and handlers
kqueue [-?h] [expression] - Display queue of worker thread
[single]list [-?h] <expression> [count] [structname[.listnodemembername]]
- Chain display of LIST_ENTRY and SINGLE_LIST_ENTRY
smb [-?hd] <expression> - Display SMB structure from header
strct [-?h] <structname/"load"/"unload"> [fieldname] [expression]
- Display member offset and structure data
xpool [-?h] [address] | [modulename[tag][-flag]]
-fill modulename
-log [[recent] [modulename] | [address]]
-map [flag]
- Dump information about managed pool blocks
lastlivetime - Display the last time of system activity
stack - Do stack trace for specified thread
s [-?h] [StartAddress] [EndAddress | [l Size]] [Value]
- Pattern search.
ip [-?h] [Address] - Display IPPacket information.
疑~ 有 IDT 指令耶, 很好奇它能让我们知道哪些资讯吧
记的在使用这些 Extension Command 时前面要加个惊叹号 "!" 来开头唷
而 WinDBG 的内建指令 (Meta-Command) 要加上句号 "." 来开头, 也有人称它为点符号
如有错误,请各位大侠帮忙指正一下, thx |
评分
-
查看全部评分
|