端口扫描 — 工具配置
端口扫描是信息收集的第一步——知道目标开放了哪些端口和什么服务,才能决定下一步怎么打。
核心工具
| 工具 | 特点 | 典型场景 |
|---|---|---|
| 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/24CTF 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关联教程
- HTTP 协议总览 — HTTP 请求/响应基础
- 01-高级子域名与资产发现 — 大规模资产测绘
- 02-高级DNS侦察技术 — DNS 信息收集
- 目录爆破 — 端口后的路径发现
- Web 方向总览 — Web CTF 方向入口