端口扫描 — 工具配置

端口扫描是信息收集的第一步——知道目标开放了哪些端口和什么服务,才能决定下一步怎么打。

核心工具

工具特点典型场景
nmap功能最全、扫描精确、结果可解析所有场景首选
masscan极高速、互联网级扫描大规模资产测绘
RustScan极速端口扫描 + nmap 服务识别联动CTF 快扫

nmap 常用命令(终端)

# 基础全端口扫描
nmap -p- target.com
 
# 扫描前 1000 个常用端口
nmap target.com
 
# 指定端口范围
nmap -p 80,443,8000-9000 target.com
 
# 服务版本检测 + OS 指纹
nmap -sV -O target.com
 
# 用脚本扫描
nmap --script http-enum target.com
 
# 导出结果到文件
nmap -p- -oN scan_result.txt target.com
 
# 存活主机发现(ping 扫)
nmap -sn 192.168.1.0/24

CTF Web 题的端口信息收集

# 第一步:快扫所有端口
nmap -p- --min-rate 1000 target.com
 
# 第二步:对开放的 Web 端口做服务识别
nmap -p 80,443,8080,8000,8888 -sV --script http-title target.com
 
# 也可以用 curl 直接探测
curl -s -o /dev/null -w "%{http_code}" http://target.com:8080/

curl 快速端口探测

# 小范围端口快速探测(无需 nmap)
for port in 80 443 8000 8080 8888 9090 3000 5000; do
 code=$(curl -s -o /dev/null -w "%{http_code}" -m 2 http://target.com:$port/ 2>/dev/null)
 [ "$code" != "000" ] && echo "Port $port: HTTP $code"
done

关联教程

此文件夹下有0条笔记。