ProjectDiscovery 生态中核心工具 Subfinder、Httpx、Katana 和 Nuclei 的基础使用教程
- 一、Subfinder:子域名发现工具
- 安装
- 基础使用
- 二、Httpx:HTTP 探测与指纹识别
- 安装
- 基础使用
- 三、Katana:网络爬虫工具
- 安装
- 基础使用
- 四、Nuclei:漏洞扫描引擎
- 安装
- 基础使用
- 组合使用示例
- 注意事项
以下是 ProjectDiscovery 生态中核心工具 Subfinder、Httpx、Katana 和 Nuclei 的基础使用教程,结合安装、配置与实战场景进行说明:
一、Subfinder:子域名发现工具
安装
- Go 环境安装(Windows/Linux):
# 设置 Go 代理 go env -w GOPROXY=https://goproxy.cn,direct # 安装 Subfinder go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
- Docker 安装:
docker pull projectdiscovery/subfinder docker run -it projectdiscovery/subfinder -d example.com
基础使用
- 单域名扫描:
subfinder -d example.com -o subdomains.txt
- 多域名扫描(文件输入):
subfinder -dL domains.txt -o results.txt
- 高级配置:
- 使用配置文件
~/.config/subfinder/config.yaml
添加 API Key(如 VirusTotal、PassiveTotal),提升扫描深度。 - 排除特定数据源:
-exclude-sources "source1,source2"
。
- 使用配置文件
二、Httpx:HTTP 探测与指纹识别
安装
go install -v github.com/projectdiscovery/httpx>httpx/cmd/httpx>httpx@latest
基础使用
-
存活检测与指纹识别:
cat subdomains.txt | httpx>httpx -title -status-code -tech-detect -o live_hosts.json
-title
:显示页面标题。-tech-detect
:基于 Wappalyzer 识别技术栈。-json
:输出 JSON 格式。
-
指定端口与协议:
echo "example.com" | httpx>httpx -ports 80,443,8080 -path "/admin" -status-code
-
C 段存活探测:
echo 192.168.1.0/24 | httpx>httpx -silent
三、Katana:网络爬虫工具
安装
go install github.com/projectdiscovery/katana/cmd/katana@latest
基础使用
- 标准爬取模式(快速但无 JS 渲染):
katana -u https://example.com -o crawled_urls.txt
- 无头浏览器模式(支持 JS 渲染):
katana -u https://example.com -headless -system-chrome
- 批量爬取与输出:
cat urls.txt | katana -jc -depth 3 -output katana_results.json
-depth
:控制爬取深度。-jc
:提取 JavaScript 文件中的链接。
四、Nuclei:漏洞扫描引擎
安装
# 通过 pdtm 工具管理器安装
pdtm -ia nuclei
# 或手动安装
go install -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest
基础使用
- 更新模板库:
nuclei -update-templates
- 基础漏洞扫描:
nuclei -u https://example.com -t nuclei-templates/
- 批量扫描与结果输出:
cat live_hosts.txt | nuclei -t cves/ -severity critical,high -o vulnerabilities.txt
-severity
:按漏洞严重性过滤。-t
:指定模板目录(如cves/
、misconfigurations/
)。
组合使用示例
- 资产发现与漏洞扫描全流程:
# 1. 子域名发现 subfinder -d example.com -o subdomains.txt # 2. 存活探测 cat subdomains.txt | httpx>httpx -silent -o live_hosts.txt # 3. 爬取路径 cat live_hosts.txt | katana -jc -depth 2 -output crawled_urls.txt # 4. 漏洞扫描 nuclei -l crawled_urls.txt -t nuclei-templates/ -severity high -o results.txt
注意事项
- API 密钥配置:Subfinder 和 Nuclei 需配置 API Key(如 Shodan、GitHub)以增强功能,配置文件路径为
~/.config/subfinder/config.yaml
和~/.config/nuclei/provider-config.yaml
。 - 性能优化:调整并发参数(如
-t
线程数)避免触发 WAF 拦截。 - 合规性:确保扫描行为符合法律法规和授权范围。
如需更详细的参数说明或高级用法,可参考各工具的官方文档或上述搜索来源中的教程链接。