热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

ntsd强制杀进程

ntsd从Windows2000开始就是系统自带的进程调试工具,在system32目录下。NTSD的功能非常的强大,用法也比较复杂,但如果只用来结束一些进程,那就比较简单了。在Wi
ntsd从Windows 2000开始就是系统自带的进程调试工具,在system32目录下。NTSD的功能非常的强大,用法也比较复杂,但如果只用来结束一些进程,那就比较简单了。在Windows中只有System、SMSS.EXE和CSRSS.EXE不能杀。前两个是纯内核态的,最后那个是Win32子系统,ntsd本身需要它。lsass.exe也不要杀掉,它是负责本地账户安全的。被调试器附着(attach)的进程会随调试器一起退出,所以可以用来在命令行下终止进程。
打开cmd 后输入以下命令就可以结束进程:
方法一:利用进程的PID结束进程
命令格式:ntsd -c q -p pid
命令范例: ntsd -c q -p 1332 (结束explorer.exe进程)
范例详解:explorer.exe的pid为1332,但是如何获取进程的pid呢?在CMD下输入TASKLIST就可以获取当前任务管理器所有进程的PID。或者打开任务管理器,在菜单栏,选择“查看”—“选择列”,在打开的选择项窗口中将“PID(进程标识符)”项选择钩上,这样任务管理器的进程中就会多出PID一项了。(PID的分配并不固定,是在进程启动是由系统随机分配的,所以进程每次启动的进程一般都不会一样。)
方法二:利用进程名结束进程
命令格式: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} ]
            [-- | -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} 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 specifies the source search path
       -v enables verbose output from debugger
       -wake wakes up a sleeping debugger and exits
       -y specifies the symbol search path (see _NT_SYMBOL_PATH)
       -z specifies the name of a crash dump file to debug
       -zp 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&#61;
                   for npipe use:  pipe&#61;
                   for 1394 use:  channel&#61;
                   for com use:  port&#61;,baud&#61;,
                                 channel&#61;
                   for ssl and spipe see the documentation
               example: ... -remote npipe:server&#61;yourmachine,pipe&#61;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&#61;
                   for npipe use:  pipe&#61;
                   for 1394 use:  channel&#61;
                   for com use:  port&#61;,baud&#61;,
                                 channel&#61;
                   for ssl and spipe see the documentation
               example: ... -server npipe:pipe&#61;foobar
       -premote transport specifies the process server to connect to
              transport arguments are given as with remoting
Environment Variables:
    _NT_SYMBOL_PATH&#61;[Drive:][Path]
        Specify symbol image path.
    _NT_ALT_SYMBOL_PATH&#61;[Drive:][Path]
        Specify an alternate symbol image path.
    _NT_DEBUGGER_EXTENSION_PATH&#61;[Drive:][Path]
        Specify a path which should be searched first for extensions dlls
    _NT_EXECUTABLE_IMAGE_PATH&#61;[Drive:][Path]
        Specify executable image path.
    _NT_SOURCE_PATH&#61;[Drive:][Path]
        Specify source file path.
    _NT_DEBUG_LOG_FILE_OPEN&#61;filename
        If specified, all output will be written to this file from offset 0.
    _NT_DEBUG_LOG_FILE_APPEND&#61;filename
        If specified, all output will be APPENDed to this file.
    _NT_DEBUG_HISTORY_SIZE&#61;size
        Specifies the size of a server&#39;s output history in kilobytes
Control Keys:
      Quit debugger
             Break into Target
      Force a break into debuggee (same as Ctrl-C)
      Debug Current debugger
      Toggle Verbose mode
      Print version information
ntsd: exiting - press enter ---
选项option&#xff1a;
-2打开一个用于调试字符模式的应用程序的新窗口
-d将输出重定向到调试终端-g 使执行自动通过第一个断点
-G使 NTSD 在子程序终止时立即退出o启用多个进程的调试&#xff0c;默认值为由调试程序衍生的一个进程
-p指定调试由进程 ID 标识的进程
-v产生详细的输出。
例如&#xff0c;假设 inetinfo.exe 的进程 ID 为 104。键入命令“NTSD -p 104”将 NTSD 调试程序连接到 inetinfo 进程 (IIS)。也可使用 NTSD 启动一个新进程来进行调试。例如&#xff0c;NTSD notepad.exe 将启动一个新的 notepad.exe 进程&#xff0c;并与它建立连接。一旦连接到某个进程&#xff0c;您就可以用各种命令来查看堆栈、设置断点、转储内存&#xff0c;等等。
命令含义~显示所有线程的一个列表KB 显示当前线程的堆栈轨迹~*KB显示所有线程的堆栈轨迹R显示当前
帧的寄存器输出U反汇编代码并显示过程名和偏移量D[type][]转储内存BP设置断点BC[]清除一个或多个断点BD[]禁用一个或多个断点BE[]启用一个或多个断点BL[]列出一个或多个断点。
个人意见,有一个非常重要的参数就是-v参数,我们可以通过它发现一个进程下面挂接了哪些连接库文件。有很多病毒,木马,或者恶意软件,都喜欢把自己做成动态库,然后注册到系统正常程序的加载库列表中,达到隐藏自己的目的.
首先我们需要设置一下ntsd的输出重定向,最好是重定向到一个文本文件,方便我们分析研究.
c:\>set _NT_DEBUG_LOG_FILE_APPEND&#61;c:\pdw.txt
注意,虽然输出重定向了,但是我们的输出依然会继续显示在屏幕上,而且会进入到debug模式,我们使用-c q参数,就可以避免这个问题.
c:\>ntsd -c q -v notepad.exe
现在我们的pdw.txt文件中,就可以看见notepad.exe文件的调试信息.

转载于:https://www.cnblogs.com/rootq/articles/1252286.html


推荐阅读
  • 本文介绍了三种方法来实现在Win7系统中显示桌面的快捷方式,包括使用任务栏快速启动栏、运行命令和自己创建快捷方式的方法。具体操作步骤详细说明,并提供了保存图标的路径,方便以后使用。 ... [详细]
  • 移动端常用单位——rem的使用方法和注意事项
    本文介绍了移动端常用的单位rem的使用方法和注意事项,包括px、%、em、vw、vh等其他常用单位的比较。同时还介绍了如何通过JS获取视口宽度并动态调整rem的值,以适应不同设备的屏幕大小。此外,还提到了rem目前在移动端的主流地位。 ... [详细]
  • 本文介绍了pack布局管理器在Perl/Tk中的使用方法及注意事项。通过调用pack()方法,可以控制部件在显示窗口中的位置和大小。同时,本文还提到了在使用pack布局管理器时,应注意将部件分组以便在水平和垂直方向上进行堆放。此外,还介绍了使用Frame部件或Toplevel部件来组织部件在窗口内的方法。最后,本文强调了在使用pack布局管理器时,应避免在中间切换到grid布局管理器,以免造成混乱。 ... [详细]
  • python3 nmap函数简介及使用方法
    本文介绍了python3 nmap函数的简介及使用方法,python-nmap是一个使用nmap进行端口扫描的python库,它可以生成nmap扫描报告,并帮助系统管理员进行自动化扫描任务和生成报告。同时,它也支持nmap脚本输出。文章详细介绍了python-nmap的几个py文件的功能和用途,包括__init__.py、nmap.py和test.py。__init__.py主要导入基本信息,nmap.py用于调用nmap的功能进行扫描,test.py用于测试是否可以利用nmap的扫描功能。 ... [详细]
  • 使用C++编写程序实现增加或删除桌面的右键列表项
    本文介绍了使用C++编写程序实现增加或删除桌面的右键列表项的方法。首先通过操作注册表来实现增加或删除右键列表项的目的,然后使用管理注册表的函数来编写程序。文章详细介绍了使用的五种函数:RegCreateKey、RegSetValueEx、RegOpenKeyEx、RegDeleteKey和RegCloseKey,并给出了增加一项的函数写法。通过本文的方法,可以方便地自定义桌面的右键列表项。 ... [详细]
  • Postgresql备份和恢复的方法及命令行操作步骤
    本文介绍了使用Postgresql进行备份和恢复的方法及命令行操作步骤。通过使用pg_dump命令进行备份,pg_restore命令进行恢复,并设置-h localhost选项,可以完成数据的备份和恢复操作。此外,本文还提供了参考链接以获取更多详细信息。 ... [详细]
  • REVERT权限切换的操作步骤和注意事项
    本文介绍了在SQL Server中进行REVERT权限切换的操作步骤和注意事项。首先登录到SQL Server,其中包括一个具有很小权限的普通用户和一个系统管理员角色中的成员。然后通过添加Windows登录到SQL Server,并将其添加到AdventureWorks数据库中的用户列表中。最后通过REVERT命令切换权限。在操作过程中需要注意的是,确保登录名和数据库名的正确性,并遵循安全措施,以防止权限泄露和数据损坏。 ... [详细]
  • 十大经典排序算法动图演示+Python实现
    本文介绍了十大经典排序算法的原理、演示和Python实现。排序算法分为内部排序和外部排序,常见的内部排序算法有插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等。文章还解释了时间复杂度和稳定性的概念,并提供了相关的名词解释。 ... [详细]
  • 本文介绍了如何在Azure应用服务实例上获取.NetCore 3.0+的支持。作者分享了自己在将代码升级为使用.NET Core 3.0时遇到的问题,并提供了解决方法。文章还介绍了在部署过程中使用Kudu构建的方法,并指出了可能出现的错误。此外,还介绍了开发者应用服务计划和免费产品应用服务计划在不同地区的运行情况。最后,文章指出了当前的.NET SDK不支持目标为.NET Core 3.0的问题,并提供了解决方案。 ... [详细]
  • 本文介绍了使用readlink命令获取文件的完整路径的简单方法,并提供了一个示例命令来打印文件的完整路径。共有28种解决方案可供选择。 ... [详细]
  • TPL实现Task.WhileAll扩展方法
    文章翻译整理自NikolaMalovic两篇博文:Task.WhileAllAwaitabletaskprogressreporting当Task.WhenAll遇见 ... [详细]
  • SQL Server 2008 到底需要使用哪些端口?
    SQLServer2008到底需要使用哪些端口?-下面就来介绍下SQLServer2008中使用的端口有哪些:  首先,最常用最常见的就是1433端口。这个是数据库引擎的端口,如果 ... [详细]
  • imnewtotheswiftandxcodeworld,soimhavingaproblemtryingtointegrateapackagetomypro ... [详细]
  • 基于词向量计算文本相似度1.测试数据:链接:https:pan.baidu.coms1fXJjcujAmAwTfsuTg2CbWA提取码:f4vx2.实验代码:imp ... [详细]
  • 折腾个半死,数据库初始化设置不当报错 ORA01078: failure in proces...
    2019独角兽企业重金招聘Python工程师标准[oraclelocalhost~]$sqlplusassysdba提示Connectedtoanidleinstance.连 ... [详细]
author-avatar
段娜688
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有