【玩转腾讯云】Windows云服务器排障思路
Windows排障对我来说很简单,毕竟是鼠标操作,而且有那么多小工具辅助排障,非常轻松。本文更偏重通用能力,不仅适用腾讯云,其他云也适用。专对腾讯云的话,推荐我写的一篇腾讯云SDK踩坑、填坑的文档,那个花了我上百个小时,是我10篇云+社区文档的集锦,腾讯云API Explorer工具的基本用法,让你熟练掌握6种SDK的使用。
回归本文主题,在说Windows排障思路之前,我先提醒一下大家,PC软件在Windows服务器上的一些意外表现我在这里特别介绍过,服务器上使用PC软件要谨慎。另外,Windows日志获取和分析并不难,我一般都自己分析,有提工单的功夫自己都分析出来原因了(个人感觉阿里云的工单服务最慢、腾讯云的工单服务给用户打电话的频率最高、华为云的工单服务我还在体验中……)。
言归正传,本文从系统驱动、应用软件、计划任务、开机加载项、系统关键目录、病毒木马、dmp文件分析、常用软件集nirsoft.net和sysinternals.com、通用软件10个方面进行简要介绍Windows排障思路。
1、系统驱动
①process explorer
如上图,只能选System进程,选择后点“view → Lower Pane View → Dlls (Ctrl+D)”,在下方有系统所有驱动,有4列:Name、Description、Company Name、Path,主要通过看“Company Name”这一列比较能容易分辨出哪些是新引入的。
也可以通过autoruns查看系统驱动、服务列表、计划任务来找异常。
https://docs.microsoft.com/en-us/sysinternals/downloads/autoruns
https://cloud.tencent.com/developer/article/1557575
整体来说,autoruns和process explorer是我进行Windows排障的必用工具,是性价比最高的Windows排障工具。
②nirsoft.net ServiWin
ServiWin utility displays the list of installed drivers and services on your system.
ServiWin实用程序显示系统上已安装的驱动程序和服务的列表。
http://www.nirsoft.net/utils/serviwin.html
nirsoft.net里还有个小工具叫InstalledDriversList,顾名思义就知道其作用。
2、应用软件
appwiz.cpl
第三方软件比如revo uninstaller pro、UninstallView(nirsoft.net小工具之一)等都可以查看系统已经安装的软件有哪些,这些软件可以比appwiz.cpl更详细地展示各软件安装的先后顺序,卸载的话也比appwiz.cpl卸载得干净一些。
3、计划任务
①计划任务快捷方式的位置
C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Administrative Tools\\Task Scheduler.lnk
②命令:
taskschd.msc
③计划任务存在于4个位置:
C:\\Windows\\SysWOW64\\Tasks
C:\\Windows\\System32\\Tasks
C:\\Windows\\System\\
C:\\Windows\\Tasks\\
4、开机加载项
①对分析开机加载项有用的软件:
AnVir Task Manager
WhatInStartup
Autoruns
Security Task Manager
Startup Delayer
WinPatrol
②Winlogon Shell,打开组策略分析,没有的话略过
③分析注册表位置
HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\Explorer\\Run
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\Explorer\\Run
HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce
HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx
HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices
HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad\\
④Startup目录
C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup
C:\\Users\\Administrator\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup
C:\\Windows\\SysWOW64\\config\\systemprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup
C:\\Windows\\System32\\GroupPolicy\\Machine\\Scripts\\Startup
C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup
C:\\ProgramData\\Start Menu\\Programs\\Startup
⑤%xxx%目录
%APPDATA%
%CommonProgramFiles%
%TEMP% 和 %TMP%
%ProgramW6432%
%programfiles(X86)%
%programfiles%
%SYSTEMROOT%
%WINDIR%
%HOMEDRIVE%
%SYSTEMDRIVE%
%ALLUSERSPROFILE%
%USERPROFILE%
%public%
[c:\\progra~1]=[C:\\Program Files]
[c:\\progra~2]=[C:\\Program Files (x86)]
[c:\\progra~3]=[C:\\ProgramData]
[c:\\progra~1\\Intern~1\\]=[C:\\Program Files\\Internet Explorer\\]
[C:\\Users\\ADMINI~1\\]=[C:\\Users\\Administrator\\]
5、系统关键目录
C:\\Windows\\Fonts
C:\\Users\\Administrator\\Desktop
C:\\Windows\\Web
C:\\Windows\\Temp
C:\\Windows\\System
C:\\Windows\\System32
C:\\Windows\\
C:\\Windows\\System32\\Logs
C:\\Windows\\security
C:\\Windows\\INF
C:\\Windows\\debug
C:\\ProgramData\\Microsoft\\Windows\\Caches
C:\\Windows\\apppatch
C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files
C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files\\Content.IE5
……
运行框输入以上文件夹名称即可打开
例如
⑥系统环境变量
echo %path% (跟Linux不一样,Linux是echo $PATH)
6、服务列表
services.msc
HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\
好多木马病毒存在于硬盘并且在注册表里注册了“服务”,但是这个服务是隐藏的,并不能在services.msc列表里看到
psservice (sysinternals.com pstools工具集 https://cloud.tencent.com/developer/article/1617430)
7、病毒木马
360、电脑管家 https://cloud.tencent.com/developer/article/1612225
https://www.virustotal.com/gui/home/upload
http://lockhunter.com/download.htm
Windows木马病毒经常藏匿于以下位置
C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files
(还有其他用户的temp目录,替换用户名即可)
(还有其他用户的temp目录,替换用户名即可)
(还有其他用户的temp目录,替换用户名即可)
C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files\\Content.IE5
(还有其他用户的temp目录,替换用户名即可)
(还有其他用户的temp目录,替换用户名即可)
(还有其他用户的temp目录,替换用户名即可)
还有其他Content.IE5,用Everything搜一下
C:\\Windows\\Temp
C:\\Users\\ADMINI~1\\AppData\\Local\\Temp
C:\\Users\\Administrator\\AppData\\Local\\Temp同上
(还有其他用户的temp目录,替换用户名即可)
(还有其他用户的temp目录,替换用户名即可)
(还有其他用户的temp目录,替换用户名即可)
XP、2003的temp路径如下
C:\\DocumentsandSettings\\用户名\\LocalSettings\\Temp
C:\\DocumentsandSettings\\用户名\\LocalSettings\\Temporary Internet Files
C:\\Windows\\System32\\wbem
C:\\Windows\\System32\\drivers
C:\\Windows\\System32\\……
C:\\Windows\\inf\\
C:\\Windows\\Web\\
C:\\Windows\\debug\\
C:\\Windows\\Fonts
C:\\Windows\\……
各个分区的System Volume Information
杀毒命令(正常系统文件都有固定位置,不在原有位置的同名文件一般都是病毒木马)
wmic process where "name='svchost.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\svchost.exe'" call Terminate
wmic process where "name='wininit.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\wininit.exe'" call Terminate
wmic process where "name='csrss.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\csrss.exe'" call Terminate
wmic process where "name='csrs.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\csrs.exe'" call Terminate
wmic process where "name='WUDFHost.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\WUDFHost.exe'" call Terminate
wmic process where "name='services.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\services.exe'" call Terminate
wmic process where "name='taskhost.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\taskhost.exe'" call Terminate
wmic process where "name='conhost.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\conhost.exe'" call Terminate
wmic process where "name='winlogon.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\winlogon.exe'" call Terminate
wmic process where "name='msinfo.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\msinfo.exe'" call Terminate
wmic process where "name='explorer.exe' and executablepath<>'%SystemDrive%\\\\windows\\\\explorer.exe'" call Terminate
wmic process where "name='msinfo.exe' and ExecutablePath<>'C:\\\\WINDOWS\\\\system32\\\\msinfo.exe'" delete
wmic process where "name='explorer.exe' and executablepath<>'%SystemDrive%\\\\windows\\\\explorer.exe'" delete
获取字体目录里异常进程的命令,结果集里并不都是病毒,命令的作用是排除掉字体文件把剩下的文件列出来
wmic datafile where "drive='c:' and path='\\\\windows\\\\fonts\\\\' and extension<>'ttf' and extension<>'fon' and extension<>'ttc' " get Name
wmic datafile where "drive='c:' and path='\\\\windows\\\\fonts\\\\' and extension<>'ttf' and extension<>'fon' and extension<>'ttc' " get Name,Path,CreationDate,LastAccessed,LastModified
wmic datafile where "drive='c:' and path='\\\\windows\\\\fonts\\\\' and extension<>'ttf' and extension<>'fon' and extension<>'ttc' " get Name,Path,CreationDate,LastAccessed,LastModified /value
wmic datafile where "drive='c:' and path='\\\\windows\\\\fonts\\\\' and extension<>'ttf' and extension<>'fon' and extension<>'ttc' " get Name,Path,CreationDate,LastAccessed,LastModified /format:list
https://cloud.tencent.com/developer/article/1613296
8、dmp文件分析
①bluescreen view
http://www.nirsoft.net/utils/blue_screen_view.html
9、其他可能会用到的软件
①Sysinternals.com工具集
Sysinternals里有pstools等一大堆实用小工具,这里要重点强调下,newsid.exe已经被淘汰了,不要在云服务器上乱用newsid,这可能会导致服务器黑屏或陷入recovery模式而无法恢复,如果是修改sid,建议使用sysprep命令或使用sidchg这个第三方软件。值得一提的是,sysprep有2个缺点:特别耗费时间、会清理“家目录”里的数据。
②nirsoft.net里面有很多好软件,比如UninstallView、LastActivityView、TurnedOnTimesView、WinLogOnView、BlueScreenView、BrowsingHistoryView、CurrPorts、DevManView、DriverView 、EventLogSourcesView、HashMyFiles、InstalledCodec、InstalledDriversList、ProcessActivityView、ProduKey、RegScanner 、ShellMenuView、SmartSniff、SoundVolumeView、SpecialFoldersView、USBDeview、WebSiteSniffer、WhatInStartup、ServiWin
SpecialFolderView
AppReadWriteCounte
NTFSLinksView
HtmlDocEdit
SimpleWMIView
LoadedDllsView
UninstallView
FullEventLogView
RegScanne
RegistryChangesView
TaskSchedulerView
LastActivityView
ProcessThreadsView
ServiWin
SecuritySoftView
InstalledDrivesList
WhatInStartup
10、通用软件或能力
云平台安全组、系统防火墙、everything、notepad++、powershell、wireshark等
11、关于Windows方面的积累我还有很多,列举如下
https://cloud.tencent.com/developer/column/83952
Windows系统小工具之pstools:psservice、psinfo……
Exception Processing Message 0xc000007b Parameters
Windows网络小工具之pstools:psping、pslist……
基于tcp协议的windows trace工具:tracetcp
利用 WimBuilder2 最新稳定版 DIY Win10PE
最全Windows代系介绍,迎接Windows 2020,回顾Windows XP经典
curl --tlsv1.x和--tls-max 1.x 参数详解
Windows奇技淫巧:如何添加TrustedInstaller权限
win10 、server 2019、office 2019激活
Visual Studio 2019 惨痛 踩坑 经历 0x80070490 0x80040154
Linux和Windows下硬盘/分区对拷和硬盘/分区写0是怎么回事
推荐一款非常实用的Windows驱动备份、恢复、删除的专用工具
Windows SmartScreen阻止文件执行如何关闭?
sql server 2000、2005/2008/2008R2/2012/2014/2016/2017/2019 express全版本下载地址
sqlserver2008/2008R2/2012/2014/2016/2017/2019通用安装脚本
win10/server2016/server2019关闭系统自带安全保护
phpstudy8在windows2016上安装后在服务列表找不到服务
windows校验文件时计算md5、sha1、sha256值的若干种办法
Windows 邮箱服务器 WinWebMail Server 配置过程
解决explorer.exe被篡改加载NewOverlayIcon32(64).dll报错
FileZilla 错误:Server unexpectedly closed network connection 无法连接到服务器
Windows服务器在Mac上远程后看起来字体和图标都特别小,如何解决?
安装Windows Performance Toolkit进行0.1微秒级CPU监控
任务管理器里所有进程的内存占用加起来怎么远小于总的内存×内存占用率?
利用process explorer和autoruns找蓝屏、死机的异常点
Windows上利用powershell安装dotnet和iis
……