我们如何使用脚本在windbg下递归搜索结构的变量值

时间:2018-05-25 13:46:50

标签: scripting windbg

我们可以编写一个脚本来递归搜索结构下的特定值吗? 我能想到的一种手动方式(和时间)是使用" dt -r"创建一个日志文件。并手动搜索。

1 个答案:

答案 0 :(得分:0)

通过递归搜索值是什么意思?

dt -r跟随结构中的结构,因此它们的地址不会是连续的

您可以在有限的空间内使用简单的 s命令,例如

kd> r? $t0 = sizeof(nt!_EPROCESS)
kd> ? @$t0
Evaluate expression: 704 = 000002c0

kd> r? $t1 =  @@masm(@$proc)
kd> ? @$t1
Evaluate expression: -2063606960 = 84ffdb50


kd> $$ @$proc is pointer to current process in kernel mode
let us search for char 'k' within this range

kd> s -b @$t1 l?@$t0 'k'

84ffdcbc  6b 64 2e 65 78 65 00 00-00 00 00 00 00 00 00 02  kd.exe..........

kd> dt nt!_EPROCESS ImageFileName @$proc
   +0x16c ImageFileName : [15]  "kd.exe"

kd> ? @$t1+0x16c
Evaluate expression: -2063606596 = 84ffdcbc
kd>