王朝百科
分享
 
 
 

ntsd

王朝百科·作者佚名  2010-02-18  
宽屏版  字体: |||超大  

Ntsd简介ntsd从Windows 2000开始就是系统自带的进程调试工具,在system32目录下。NTSD的功能非常的强大,用法也比较复杂,但如果只用来结束一些进程,那就比较简单了。

Ntsd用法Ntsd在Windows中只有System、SMSS.EXE和CSRSS.EXE不能杀。前两个是纯内核态的,最后那个是Win32子系统,ntsd本身需要它。lsass.exe也不要杀掉,它是负责本地账户安全的。被调试器附着的进程会随调试器一起退出,所以可以用来在命令行下终止进程。

打开cmd 后输入以下命令就可以结束进程:

利用进程PID结束进程

命令格式:ntsd -c q -p pid

命令范例: ntsd -c q -p 4 (结束System进程。当然,System进程是杀不掉的)

范例详解:System的pid为4,但是如何获取进程的pid呢?在CMD下输入TASKLIST就可以获取当前任务管理器所有进程的PID。或者打开任务管理器,在菜单栏,选择“查看”—“选择列”,在打开的选择项窗口中将“PID(进程标识符)”项选择钩上,这样任务管理器的进程中就会多出PID一项了。(PID的分配并不固定,是在进程启动是由系统随机分配的,所以进程每次启动的进程一般都不会一样。)

可使用以下批处理:

=================================================

rem 复制以下内容到记事本,另存为pid.bat

@echo off

mode con cols=30 lines=5

color 1e

echo.

set /p t=请输入进程名:

tasklist /fo csv>2.txt

find "%t%" 2.txt>1.txt

for /f "delims=, tokens=2" %%i in (1.txt) do set a=%%i

ntsd -c q -p %a%

echo PID NAME

echo ============

echo %a% %T%

del 1.txt

del 2.txt

pause >nul

exit

=================================================

利用进程名结束进程

命令格式:ntsd -c q -pn ***.exe (***.exe 为进程名,exe不能省)

命令范例:ntsd -c q -pn explorer.exe

另外的能结束进程的DOS命令还有taskkill和tskill命令:

命令格式: taskkill /pid 1234 /f ( 也可以达到同样的效果。)

Ntsd详解有一些高等级的进程,tskill和taskkill或许无法结束,那么我们还有一个更强大的工具,那就是系统debug级的ntsd.准确的说,ntsd是一个系统调试工具,只提供给系统开发级的管理员使用,但是对我们杀掉进程还是很爽的.基本上除了WINDOWS系统自己的管理进程,ntsd几乎都可以杀掉。NTSD 调试程序在启动时要求用户指定一个要连接的进程。使用 TLIST 或 PVIEWER,您可以获得某个现有进程的进程 ID,然后键入 NTSD -p pid 来调试这个进程。NTSD 命令行使用如下的句法:

NTSD [options] imagefile

其中,imagefile 是要调试的映像名称。

用法usage: ntsd [-?] [-2] [-d] [-g] [-G] [-myob] [-lines] [-n] [-o] [-s] [-v] [-w]

[-r BreakErrorLevel] [-t PrintErrorLevel]

[-hd] [-pd] [-pe] [-pt #] [-pv] [-x | -x{e|d|n|i} <event>]

[-- | -p pid | -pn name | command-line | -z CrashDmpFile]

[-zp CrashPageFile] [-premote transport] [-robp]

[-aDllName] [-c "command"] [-i ImagePath] [-y SymbolsPath]

[-clines #] [-srcpath SourcePath] [-QR \machine] [-wake ]

[-remote transport:server=name,portid] [-server transport:portid]

[-ses] [-sfce] [-sicv] [-snul] [-noio] [-failinc] [-noshell]

where: -? displays this help text

command-line is the command to run under the debugger

-- is the same as -G -g -o -p -1 -d -pd

-aDllName sets the default extension DLL

-c executes the following debugger command

-clines number of lines of output history retrieved by a remote client

-failinc causes incomplete symbol and module loads to fail

-d sends all debugger output to kernel debugger via DbgPrint

-d cannot be used with debugger remoting

-d can only be used when the kernel debugger is enabled

-g ignores initial breakpoint in debuggee

-G ignores final breakpoint at process termination

-hd specifies that the debug heap should not be used

for created processes. This only works on Windows Whistler.

-o debugs all processes launched by debuggee

-p pid specifies the decimal process Id to attach to

-pd specifies that the debugger should automatically detach

-pe specifies that any attach should be to an existing debug port

-pn name specifies the name of the process to attach to

-pt # specifies the interrupt timeout

-pv specifies that any attach should be noninvasive

-r specifies the (0-3) error level to break on (SeeSetErrorLevel)

-robp allows breakpoints to be set in read-only memory

-t specifies the (0-3) error level to display (SeeSetErrorLevel)

-w specifies to debug 16 bit applications in a separate VDM

-x sets second-chance break on AV exceptions

-x{e|d|n|i} <event> sets the break status for the specified event

-2 creates a separate console window for debuggee

-i ImagePath specifies the location of the executables that generated

the fault (see _NT_EXECUTABLE_IMAGE_PATH)

-lines requests that line number information be used if present

-myob ignores version mismatches in DBGHELP.DLL

-n enables verbose output from symbol handler

-noio disables all I/O for dedicated remoting servers

-noshell disables the .shell (!!) command

-QR <\machine> queries for remote servers

-s disables lazy symbol loading

-ses enables strict symbol loading

-sfce fails critical errors encountered during file searching

-sicv ignores the CV record when symbol loading

-snul disables automatic symbol loading for unqualified names

-srcpath <SourcePath> specifies the source search path

-v enables verbose output from debugger

-wake wakes up a sleeping debugger and exits

-y <SymbolsPath> specifies the symbol search path (see _NT_SYMBOL_PATH)

-z <CrashDmpFile> specifies the name of a crash dump file to debug

-zp <CrashPageFile> specifies the name of a page.dmp file

to use with a crash dump

-remote lets you connect to a debugger session started with -server

must be the first argument if present

transport: tcp | npipe | ssl | spipe | 1394 | com

name: machine name on which the debug server was created

portid: id of the port the debugger server was created on

for tcp use: port=<socket port #>

for npipe use: pipe=<name of pipe>

for 1394 use: channel=<channel #>

for com use: port=<COM port>,baud=<baud rate>,

channel=<channel #>

for ssl and spipe see the documentation

example: ... -remote npipe:server=yourmachine,pipe=foobar

-server creates a debugger session other people can connect to

must be the first argument if present

transport: tcp | npipe | ssl | spipe | 1394 | com

portid: id of the port remote users can connect to

for tcp use: port=<socket port #>

for npipe use: pipe=<name of pipe>

for 1394 use: channel=<channel #>

for com use: port=<COM port>,baud=<baud rate>,

channel=<channel #>

for ssl and spipe see the documentation

example: ... -server npipe:pipe=foobar

-premote transport specifies the process server to connect to

transport arguments are given as with remoting

Environment Variables:

_NT_SYMBOL_PATH=[Drive:][Path]

Specify symbol image path.

_NT_ALT_SYMBOL_PATH=[Drive:][Path]

Specify an alternate symbol image path.

_NT_DEBUGGER_EXTENSION_PATH=[Drive:][Path]

Specify a path which should be searched first for extensions dlls

_NT_EXECUTABLE_IMAGE_PATH=[Drive:][Path]

Specify executable image path.

_NT_SOURCE_PATH=[Drive:][Path]

Specify source file path.

_NT_DEBUG_LOG_FILE_OPEN=filename

If specified, all output will be written to this file from offset 0.

_NT_DEBUG_LOG_FILE_APPEND=filename

If specified, all output will be APPENDed to this file.

_NT_DEBUG_HISTORY_SIZE=size

Specifies the size of a server's output history in kilobytes

Control Keys:

<Ctrl-B><Enter> Quit debugger

<Ctrl-C> Break into Target

<Ctrl-F><Enter> Force a break into debuggee (same as Ctrl-C)

<Ctrl-P><Enter> Debug Current debugger

<Ctrl-V><Enter> Toggle Verbose mode

<Ctrl-W><Enter> Print version information

ntsd: exiting - press enter ---

选项option:

-2打开一个用于调试字符模式的应用程序的新窗口

-d将输出重定向到调试终端-g 使执行自动通过第一个断点

-G使 NTSD 在子程序终止时立即退出o启用多个进程的调试,默认值为由调试程序衍生的一个进程

-p指定调试由进程 ID 标识的进程

-v产生详细的输出。

例如,假设 inetinfo.exe 的进程 ID 为 104。键入命令“NTSD -p 104”将 NTSD 调试程序连接到 inetinfo 进程 (IIS)。也可使用 NTSD 启动一个新进程来进行调试。例如,NTSD notepad.exe 将启动一个新的 notepad.exe 进程,并与它建立连接。一旦连接到某个进程,您就可以用各种命令来查看堆栈、设置断点、转储内存,等等。

命令含义~显示所有线程的一个列表KB 显示当前线程的堆栈轨迹~*KB显示所有线程的堆栈轨迹R显示当前

帧的寄存器输出U反汇编代码并显示过程名和偏移量D[type][< range>]转储内存BP设置断点BC[]清除一个或多个断点BD[]禁用一个或多个断点BE[< bp>]启用一个或多个断点BL[]列出一个或多个断点。

个人意见,有一个非常重要的参数就是-v参数,我们可以通过它发现一个进程下面挂接了哪些连接库文件。有很多病毒,木马,或者恶意软件,都喜欢把自己做成动态库,然后注册到系统正常程序的加载库列表中,达到隐藏自己的目的.

首先我们需要设置一下ntsd的输出重定向,最好是重定向到一个文本文件,方便我们分析研究.

c:>set _NT_DEBUG_LOG_FILE_APPEND=c:pdw.txt

注意,虽然输出重定向了,但是我们的输出依然会继续显示在屏幕上,而且会进入到debug模式,我们使用-c q参数,就可以避免这个问题.

c:>ntsd -c q -v notepad.exe

现在我们的pdw.txt文件中,就可以看见notepad.exe文件的调试信息.

可以知道,ntsd的软件终止能力是很好很强大的,一些taskkill都无法终止的软件(如Student.exe这一类或木马)可以用ntsd轻易终止

但是它仍有缺点,因为技术在不断更新,在对付最新的有很强防护的病毒等程序时

,仍建议使用IceSword等专业工具。可以试一下ntsd拿360,IceSword,nod32等杀软程序毫无办法。

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
如何用java替换看不见的字符比如零宽空格&#8203;十六进制U+200B
 干货   2023-09-10
网页字号不能单数吗,网页字体大小为什么一般都是偶数
 干货   2023-09-06
java.lang.ArrayIndexOutOfBoundsException: 4096
 干货   2023-09-06
Noto Sans CJK SC字体下载地址
 干货   2023-08-30
window.navigator和navigator的区别是什么?
 干货   2023-08-23
js获取referer、useragent、浏览器语言
 干货   2023-08-23
oscache遇到404时会不会缓存?
 干货   2023-08-23
linux下用rm -rf *删除大量文件太慢怎么解决?
 干货   2023-08-08
刀郎新歌破世界纪录!
 娱乐   2023-08-01
js实现放大缩小页面
 干货   2023-07-31
生成式人工智能服务管理暂行办法
 百态   2023-07-31
英语学习:过去完成时The Past Perfect Tense举例说明
 干货   2023-07-31
Mysql常用sql命令语句整理
 干货   2023-07-30
科学家复活了46000年前的虫子
 探索   2023-07-29
英语学习:过去进行时The Past Continuous Tense举例说明
 干货   2023-07-28
meta name="applicable-device"告知页面适合哪种终端设备:PC端、移动端还是自适应
 干货   2023-07-28
只用css如何实现打字机特效?
 百态   2023-07-15
css怎么实现上下滚动
 干货   2023-06-28
canvas怎么画一个三角形?
 干货   2023-06-28
canvas怎么画一个椭圆形?
 干货   2023-06-28
canvas怎么画一个圆形?
 干货   2023-06-28
canvas怎么画一个正方形?
 干货   2023-06-28
中国河南省郑州市金水区蜘蛛爬虫ip大全
 干货   2023-06-22
javascript简易动态时间代码
 干货   2023-06-20
感谢员工的付出和激励的话怎么说?
 干货   2023-06-18
 
>>返回首页<<
 
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有