内网渗透信息收集总结
字数 1749 2025-08-11 08:35:47
内网渗透信息收集全面指南
一、内网信息收集概述
1.1 我是谁?——当前机器角色判断
- 判断依据:主机名、文件、网络连接情况
- 常见角色:
- WEB服务器
- 开发测试服务器
- 公共服务器
- 文件服务器
- 代理服务器
- DNS服务器
1.2 这是哪?——网络环境拓扑分析
- 绘制内网拓扑图
- 分析网络结构
1.3 我在哪?——所处区域判断
- DMZ区
- 办公区
- 核心区
二、本机信息收集
2.1 手动信息收集
2.1.1 网络配置信息
ipconfig /all
2.1.2 操作系统及软件信息
systeminfo
systeminfo | findstr /B /C:"OS 名称" /C:"OS 版本"
echo %PROCESSOR_ARCHITECTURE%
wmic product get name,version
powershell "GET-WmiObject -class Win32_Product | Select-Object -Property name,version"
2.1.3 本机服务信息
wmic service list brief
2.1.4 进程列表
tasklist
wmic process list brief
2.1.5 启动程序信息
wmic startup get command,caption
2.1.6 计划任务
schtasks /query /fo LIST /v
2.1.7 用户列表
net user
net localgroup administrators
query user || qwinsta
2.1.8 主机开机时间
net statistics workstation
2.1.9 会话信息
net session
2.1.10 端口列表
netstat -ano
2.1.11 补丁列表
systeminfo
wmic qfe get Caption,Descript,HotFixID,InstalledOn
2.1.12 本地共享列表
net share
wmic share get name,path,status
2.1.13 路由和ARP表
route print
arp -a
2.1.14 防火墙配置
WMIC /Node:localhost /Namespace:\\root\SecurityCenter2 Path AntiVirusProduct Get displayName /Format:List
netsh firewall set opmode disable (Windows Server 2003及之前)
netsh advfirewall set allprofiles state off (Windows Server 2003及之后)
netsh firewall show config
2.2 自动收集信息
- 使用wmic_info.bat脚本
- 下载地址:http://www.fuzzysecurity.com/scripts/files/wmic_info.rar
三、查看当前权限
3.1 权限类型
- 本地普通用户
- 本地管理员用户
- 本地域内用户
3.2 获取域SID
whoami /all
3.3 查询指定用户详细信息
net user win7 /domain
四、判断是否存在域
4.1 ipconfig
ipconfig /all
nslookup security.com
4.2 查看系统详细信息
systeminfo
4.3 查看当前登录域及域用户
net config workstation
4.4 判断主域
net time /domain
五、搜集域内基本信息
5.1 查询域
net view /domain
5.2 查询域内所有计算机
net view /domain:SECURITY
5.3 查询域内所有用户组列表
net group /domain
5.4 查询所有域成员计算机列表
net group "domain computers" /domain
5.5 获取域用户密码信息
net accounts /domain
5.6 获取域信任信息
nltest /domain_trusts
六、查看域控制器
6.1 查看域控制器的机器名
nltest /DCLIST:security
6.2 查看域控制器的主机名
nslookup -type=SRV _ldap._tcp
6.3 查看当前时间
net time /domain
6.4 查看域控制器组
net group "domain controllers" /domain
七、获取域内用户和管理员信息
7.1 查询所有域用户列表
net user /domain
7.2 获取域内用户详细信息
wmic useraccount get /all
7.3 查看存在的用户
dsquery user
dsquery computer
dsquery contact
dsquery subnet
dsquery group
dsquery ou
dsquery site
dsquery server
dsquery quota
dsquery partition
dsquery *
7.4 查询本地管理员组用户
net localgroup administrators
八、查询域管理员用户组
8.1 查询域管理员用户
net group "domain admins" /domain
8.2 查询管理员用户组
net group "enterprise admins" /domain
九、定位域管理员
9.1 域管理员定位概述
- 通过日志分析
- 通过会话信息
9.2 常用域管理员定位工具
9.2.1 psloggedon.exe
PsLoggedon.exe \\DC
9.2.2 PVEFindADUser.exe
PVEFindADUser.exe -current
9.2.3 netview.exe
netview.exe -d DE1AY
9.2.4 Nmap的NSE脚本
nmap --script=smb-os-discovery.nse -p 445 192.168.7.107
9.2.5 powerview脚本
Import-Module .\PowerView.ps1;Invoke-UserHunter
9.2.6 Empire的user_hunter模块
十、查找与管理进程
10.1 本机检查
net group "domain admins" /domain
tasklist /v
十一、探测域内存活主机
11.1 利用NetBIOS
nbtscan.exe 10.1.1.1/24
11.2 利用ICMP协议
for /L %i in (1,1,254) DO @ping -w 1 -n 1 10.1.1.%i | findstr "TTL="
11.3 通过Arp协议探测
arp -a
11.4 其他工具
- Empire
- Nishang
11.5 端口探测
11.5.1 telnet
telnet DC 22
11.5.2 MSF
search scanner/portscan/tcp
use 0
set port 1-1000
set rhosts 192.168.1.1
set threads 10
run
十二、域内主机存活检测方法
12.1 ping扫描
Windows:
for /l %i in (1,1,255) do @ping 192.168.7.%i -w 1 -n 1|find /i "ttl="
Linux:
for k in $( seq 1 255);do ping -c 1 192.168.7.$k|grep "ttl"|awk -F: '{print $4}'; done
12.2 PowerShell工具
TSPingSweep
Import-Module ./Invoke-TSPingSweep.ps1; Invoke-TSPingSweep -StartAddress 10.10.10.1 -EndAddress 10.10.10.254 -ResolveHost -ScanPort -Port 445,135
ARPScan
Import-Module ./Invoke-ARPScan.ps1; Invoke-ARPScan -CIDR 10.10.10.0/24
12.3 arp-scan
arp-scan.exe -t 10.10.10.0/24
12.4 arp-ping
for /l %i in (1,1,255) do @arp-ping.exe 10.10.10.%i -w 1 -n 1|find /i "Reply"
12.5 Empire
usemodule powershell/situational_awareness/network/arpscan
set Agent APDGSW9X
set CIDR 192.168.7.0/24
execute
12.6 nbtscan
nbtscan-1.0.35.exe 10.10.10.0/24
12.7 scanline
ScanLine.exe -h -t 22,80,445,3389,1099,1433,3306,3389 -u 53,161,137,139 -O log.txt -p 10.10.10.1-254 /b
12.8 tcping
tcping64.exe -n 1 10.10.10.10 445
12.9 cping
cping35.exe scan osver 10.10.10.1 10.10.10.255
12.10 fscan
fscan64.exe -h 10.10.10.1-255 -p 22,445
12.11 nmap
nmap -sS -sn -sV -T4 192.168.7.0/24
nmap -PR -sn 192.168.7.0/24
nmap --sP --PI 192.168.7.0/24 --T4
nmap --sn --PE --T4 192.168.7.0/24
nmap -sU --script snmp-brute 192.168.7.0/24 -T4
nmap -sU -T5 -sV --max-retries 1 192.168.7.7 -p 500
nmap --script nbstat.nse -sU -p137 192.168.7.0/24 -T4
nmap --sU --sS --script smb-enum-shares.nse --p 445 192.168.7.0/24
12.12 MSF
auxiliary/scanner/discovery/udp_probe
auxiliary/scanner/discovery/udp_sweep
auxiliary/scanner/discovery/arp_sweep
auxiliary/scanner/netbios/nbname
auxiliary/scanner/snmp/snmp_enum
auxiliary/scanner/smb/smb_version
12.13 netdiscover
netdiscover -r 192.168.5.0/24
十三、域内端口扫描方法
13.1 Telnet
telnet 10.10.10.80 80
13.2 NC
nc.exe -vv 192.168.7.7 3389
nc.exe -rz -w 2 -vv 192.168.7.7 0-65535
13.3 fscan
fscan.exe -h 10.10.10.10
13.4 ScanLine
scanline.exe -h -t 22,80,445,3389 -p 10.10.10.10
13.5 S扫描器
s.exe tcp 10.10.10.10 22,80,3389,445 7
13.6 PowerShell工具
PowerSploit的Invoke-Portscan
Import-Module ./Invoke-Portscan.ps1;Invoke-Portscan -Hosts 10.10.10.10 -T 4 -ports '445,1433,80,8080,3389'
Nishang的Invoke-PortScan
Import-Module .\nishang.ps1
Invoke-PortScan -StartAddress 10.10.10.10 -EndAddress 10.10.10.10 -ScanPort -Port 80,443,445
13.7 MSF
auxiliary/scanner/portscan/ack
auxiliary/scanner/portscan/ftpbounce
auxiliary/scanner/portscan/syn
auxiliary/scanner/portscan/tcp
auxiliary/scanner/portscan/xmas
13.8 nmap
nmap -sS -p 1-65535 10.10.10.10
十四、防火墙操作
14.1 开启/关闭防火墙
netsh firewall show state
netsh firewall show config
netsh firewall set opmode disable (Windows Server 2003及以前)
netsh advfirewall set allprofiles state off (Windows Server 2003以后)
14.2 修改防火墙配置
netsh firewall add allowedprogram c:\\xxx\\xx.exe "allow xx" enable (Windows Server 2003及以前)
netsh advfirewall firewall add rule name="pass xx" dir=in action=allow program="C:\xxx\xx.exe"
netsh advfirewall firewall add rule name="pass xx" dir=out action=allow program="C:\xxx\xx.exe"
netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow
14.3 开启远程桌面连接
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f
十五、PowerShell信息收集
15.1 PowerView
Import-Module .\PowerView.ps1
Get-NetDomain
Get-NetUser
Get-NetDomainController
Get-NetComputer
Get-NetOU
Get-NetGroup
Get-NetFileServer
Get-NetShare
Get-NetSession
Get-NetRDPSession
Get-NetProcess
Get-UserProcess
Get-ADObject
Get-NetGPO
Get-DomainPolicy
Invoke-UserHunter
Invoke-ProcessHunter
Invoke-UserEventHunter
十六、Linux信息收集
16.1 操作系统&内核版本-环境变量
cat /etc/issue
cat /etc/*-release
cat /etc/lsb-release
cat /etc/redhat-release
cat /proc/version
uname -a
uname -mrs
rpm -q kernel
dmesg | grep Linux
ls /boot | grep vmlinuz-
cat /etc/profile
cat /etc/bashrc
cat ~/.bash_profile
cat ~/.bashrc
cat ~/.bash_logout
env
set
16.2 Root权限进程
ps aux | grep root
ps -ef | grep root
16.3 计划任务
crontab -l
ls -alh /var/spool/cron
ls -al /etc/ | grep cron
ls -al /etc/cron*
cat /etc/cron*
cat /etc/at.allow
cat /etc/at.deny
cat /etc/cron.allow
cat /etc/cron.deny
cat /etc/crontab
cat /etc/anacrontab
cat /var/spool/cron/crontabs/root
16.4 IP信息
/sbin/ifconfig -a
cat /etc/network/interfaces
cat /etc/sysconfig/network
16.5 连接信息
grep 80 /etc/services
netstat -antup
netstat -antpx
netstat -tulpn
chkconfig --list
chkconfig --list | grep 3:on
last
w
16.6 用户信息
id
whomi
w
last
cat /etc/passwd
cat /etc/group
cat /etc/shadow
ls -alh /var/mail/
grep -v -E "^#" /etc/passwd | awk -F: '$3 == 0 { print $1}'
awk -F: '($3 == "0") {print}' /etc/passwd
cat /etc/sudoers
sudo –l
16.7 操作记录
cat ~/.bash_history
cat ~/.nano_history
cat ~/.atftp_history
cat ~/.mysql_history
cat ~/.php_history
16.8 可写目录
find / -writable -type d 2>/dev/null
find / -perm -222 -type d 2>/dev/null
find / -perm -o w -type d 2>/dev/null
find / -perm -o x -type d 2>/dev/null
find / $ -perm -o w -perm -o x $ -type d 2>/dev/null
16.9 临时HTTP搭建
python2 -m SimpleHTTPServer
python3 -m http.server 8080
php -S 0.0.0.0:8888
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes
openssl s_server -key key.pem -cert cert.pem -accept 443 –WWW
ruby -rwebrick -e "WEBrick::HTTPServer.new(:Port => 8888,:DocumentRoot => Dir.pwd).start"
ruby -run -e httpd . -p 8888