windbg脚本实践3----监控特定进程创建

$$*****************************************************************
$$ Script by kms_hhl to monitor process create  and show call stack
$$ Create Time 2014_11
$$ nt5 NtCreateProcess->NtCreateProcessEx->PspCreateProcess
$$ nt6 NtCreateUserProcess
$$ Execute by $$><D:BaiduYunTongBu百度云同步盘windbg_sc2sc_process_monitor_x32.txt
$$ 我们通过遍历链表 ActiveProcessLinks的尾部 在ImageFileName里面的进程名字匹配上
$$ 的一瞬间断下来
$$*****************************************************************

bp nt!pspcreateprocess"
gu
r @$t0=0
r @$t1=0
r @$t2=0
r @$t0=nt!PsActiveProcessHead+4
r @$t1=poi(@$t0)
r? @$t2= #CONTAINING_RECORD(@$t1, nt!_EPROCESS, ActiveProcessLinks)
    as /x ${/v:$Procc} @$t2
    as /ma $ImageName @@c++(&@$t2->ImageFileName[0])
    .block
{
        .if ($sicmp(" ${$ImageName} ", " calc.exe ") == 0)
        {
        .echo found the pattern
        .echo ${$ImageName}
        ad *
        }
.else
        {
        .echo not found the pattern
        .echo ' ${$ImageName} '
        ad *
        gc
        }    
}"

        工作的时候经常会有这样的需求,明明禁用掉了某个开机启动项,但是开机的时候这个启动项又自己悄悄启动了,使用这个脚本,可以很方便的纠出开机被禁用掉的启动项是通过什么方式又把自己拉起来了。

原文地址:https://www.cnblogs.com/kmshhl/p/4116355.html