performing-subdomain-enumeration-with-subfinder
使用 ProjectDiscovery 的 Subfinder 被动侦察工具枚举目标域名的子域名,在安全评估期间绘制攻击面图谱。
Best use case
performing-subdomain-enumeration-with-subfinder is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
使用 ProjectDiscovery 的 Subfinder 被动侦察工具枚举目标域名的子域名,在安全评估期间绘制攻击面图谱。
Teams using performing-subdomain-enumeration-with-subfinder should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/performing-subdomain-enumeration-with-subfinder/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How performing-subdomain-enumeration-with-subfinder Compares
| Feature / Agent | performing-subdomain-enumeration-with-subfinder | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
使用 ProjectDiscovery 的 Subfinder 被动侦察工具枚举目标域名的子域名,在安全评估期间绘制攻击面图谱。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 使用 Subfinder 执行子域名枚举(Performing Subdomain Enumeration with Subfinder) ## 适用场景 - 在渗透测试或漏洞赏金猎人的侦察阶段 - 绘制目标组织的外部攻击面时 - 在对发现的子域名执行漏洞扫描之前 - 为持续安全监控构建资产清单时 - 在需要被动信息收集的红队演习期间 ## 前置条件 - 安装 Go 1.21+(从源码构建) - 安装 Subfinder v2(`go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest`) - 为被动源配置 API 密钥(Shodan、Censys、VirusTotal、SecurityTrails、Chaos) - `$HOME/.config/subfinder/provider-config.yaml` 中的提供商配置文件 - 网络访问被动 DNS 和证书透明度数据源 - httpx 或 httprobe,用于验证发现的子域名 ## 工作流程 ### 步骤 1 — 安装和配置 Subfinder ```bash # 安装 subfinder go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest # 验证安装 subfinder -version # 配置 API 密钥以获得更好的结果 mkdir -p $HOME/.config/subfinder cat > $HOME/.config/subfinder/provider-config.yaml << 'EOF' shodan: - YOUR_SHODAN_API_KEY censys: - YOUR_CENSYS_API_ID:YOUR_CENSYS_API_SECRET virustotal: - YOUR_VT_API_KEY securitytrails: - YOUR_ST_API_KEY chaos: - YOUR_CHAOS_API_KEY EOF ``` ### 步骤 2 — 运行基本子域名枚举 ```bash # 单域名枚举 subfinder -d example.com -o subdomains.txt # 从文件枚举多个域名 subfinder -dL domains.txt -o all_subdomains.txt # 使用所有被动源(较慢但更彻底) subfinder -d example.com -all -o subdomains_all.txt # 静默模式,用于管道传输到其他工具 subfinder -d example.com -silent | httpx -silent -status-code ``` ### 步骤 3 — 过滤和自定义源选择 ```bash # 仅使用特定源 subfinder -d example.com -s crtsh,virustotal,shodan -o filtered.txt # 排除特定源 subfinder -d example.com -es github -o results.txt # 启用递归子域名枚举 subfinder -d example.com -recursive -o recursive_subs.txt # 匹配特定模式 subfinder -d example.com -m "api,dev,staging" -o matched.txt ``` ### 步骤 4 — 控制速率限制和输出格式 ```bash # 速率限制以避免 API 节流 subfinder -d example.com -rate-limit 10 -t 5 -o rate_limited.txt # JSON 输出用于程序化处理 subfinder -d example.com -oJ -o subdomains.json # 带来源信息输出 subfinder -d example.com -cs -o subdomains_with_sources.txt # 按域名收集结果到目录 subfinder -dL domains.txt -oD ./results/ ``` ### 步骤 5 — 使用 httpx 验证发现的子域名 ```bash # 将 subfinder 输出管道传输到 httpx 进行实时验证 subfinder -d example.com -silent | httpx -silent -status-code -title -tech-detect -o live_hosts.txt # 检查特定端口 subfinder -d example.com -silent | httpx -ports 80,443,8080,8443 -o web_services.txt # 解析 IP 地址 subfinder -d example.com -silent | dnsx -a -resp -o resolved.txt ``` ### 步骤 6 — 集成到更广泛的侦察管道 ```bash # 与 nuclei 链接进行漏洞扫描 subfinder -d example.com -silent | httpx -silent | nuclei -t cves/ -o vulns.txt # 与 amass 结合进行综合枚举 subfinder -d example.com -o subfinder_results.txt amass enum -passive -d example.com -o amass_results.txt cat subfinder_results.txt amass_results.txt | sort -u > combined_subdomains.txt # 对发现的主机截图 subfinder -d example.com -silent | httpx -silent | gowitness file -f - -P screenshots/ ``` ## 核心概念 | 概念 | 定义 | |---------|-------------| | 被动枚举(Passive Enumeration) | 在不直接查询目标 DNS 服务器的情况下发现子域名 | | 证书透明度(Certificate Transparency) | 揭示子域名名称的 SSL/TLS 证书公共日志 | | DNS 聚合(DNS Aggregation) | 从多个被动 DNS 数据库收集子域名数据 | | 递归枚举(Recursive Enumeration) | 发现子域名的子域名以实现更深层覆盖 | | 源提供商(Source Providers) | 为子域名情报查询的外部 API 和数据库 | | CNAME 记录 | 可能揭示额外基础设施的规范名称记录 | | 通配符 DNS(Wildcard DNS) | 为任何子域名查询返回结果的 DNS 配置 | ## 工具与系统 | 工具 | 用途 | |------|---------| | Subfinder | 主要的被动子域名枚举引擎 | | httpx | 用于验证活跃子域名的 HTTP 探测工具 | | dnsx | DNS 解析和验证工具包 | | Nuclei | 用于发现主机的基于模板的漏洞扫描器 | | Amass | 具有主动/被动模式的互补子域名枚举工具 | | gowitness | 用于视觉侦察的 Web 截图工具 | | Shodan | 用于子域名情报的全网扫描数据库 | | crt.sh | 证书透明度日志搜索引擎 | ## 常见场景 1. **漏洞赏金侦察** — 枚举目标项目范围内的所有子域名,识别可能包含漏洞的被遗忘或配置错误的资产 2. **攻击面映射** — 构建外部可访问子域名的综合清单,用于持续安全监控和风险评估 3. **云资产发现** — 识别指向云服务(AWS、Azure、GCP)的子域名,这些可能容易受到子域名接管 4. **CI/CD 集成** — 在管道中自动化子域名监控,检测新子域名并在攻击面变化时发出警报 5. **并购尽职调查** — 在安全评估期间映射收购目标的完整外部足迹 ## 输出格式 ``` ## 子域名枚举报告 - **目标域名**:example.com - **发现子域名总数**:247 - **活跃主机**:183 - **唯一 IP 地址**:42 - **使用的源**:crt.sh、VirusTotal、Shodan、SecurityTrails、Censys ### 发现的子域名 | 子域名 | IP 地址 | 状态码 | 技术 | |-----------|-----------|-------------|------------| | api.example.com | 10.0.1.5 | 200 | Nginx, Node.js | | staging.example.com | 10.0.2.10 | 403 | Apache | | dev.example.com | 10.0.3.15 | 200 | Express | ### 修复建议 - 删除已停用子域名的 DNS 记录 - 调查 CNAME 指向未认领服务的子域名 - 限制对开发和演示环境的访问 ```
Related Skills
performing-yara-rule-development-for-detection
通过识别可执行文件中的唯一字节模式、字符串和行为指标,开发精准的 YARA 恶意软件检测规则,同时将误报率降至最低。
performing-wireless-security-assessment-with-kismet
使用 Kismet 通过被动射频监控进行无线网络安全评估,检测流氓接入点(Rogue AP)、隐藏 SSID、弱加密和未授权客户端。
performing-wireless-network-penetration-test
执行无线网络渗透测试,通过捕获握手包、破解 WPA2/WPA3 密钥、检测流氓接入点以及使用 Aircrack-ng 和相关工具测试无线网络分段,评估 WiFi 安全性。
performing-windows-artifact-analysis-with-eric-zimmerman-tools
使用 Eric Zimmerman 的开源 EZ Tools 套件(包括 KAPE、MFTECmd、PECmd、LECmd、JLECmd 和 Timeline Explorer)执行全面的 Windows 取证制品分析,解析注册表 hive、预取文件、事件日志和文件系统元数据。
performing-wifi-password-cracking-with-aircrack
在授权无线安全评估中捕获 WPA/WPA2 握手包,并使用 aircrack-ng、hashcat 和字典攻击进行离线密码破解, 以评估密码短语强度和无线网络安全状况。
performing-web-cache-poisoning-attack
在授权安全测试期间,通过未纳入缓存键的头部和参数毒化缓存响应,利用 Web 缓存机制向其他用户投递恶意内容。
performing-web-cache-deception-attack
通过利用 CDN 缓存层与源服务器之间的路径规范化差异,执行 Web 缓存欺骗攻击,从而缓存并获取敏感的已认证内容。
performing-web-application-vulnerability-triage
使用 OWASP 风险评级方法论对 DAST/SAST 扫描器的 Web 应用程序漏洞发现进行分类,区分真阳性和假阳性,并确定修复优先级。
performing-web-application-scanning-with-nikto
Nikto 是一款开源 Web 服务器和 Web 应用程序扫描器,可针对超过 7,000 个潜在危险文件/程序进行测试,检查超过 1,250 个服务器的过期版本,并识别超过 270 个服务器的版本特定问题。
performing-web-application-penetration-test
遵循 OWASP Web 安全测试指南(WSTG)方法论,对 Web 应用程序执行系统化安全测试,识别认证、授权、 输入验证、会话管理和业务逻辑中的漏洞。测试人员以 Burp Suite 作为主要拦截代理,结合手动测试技术 发现自动化扫描器遗漏的缺陷。适用于 Web 应用渗透测试、OWASP 测试、应用安全评估或 Web 漏洞测试等请求场景。
performing-web-application-firewall-bypass
使用编码技术、HTTP 方法操控、参数污染和载荷混淆绕过 Web 应用防火墙保护,将 SQL 注入、XSS 及其他攻击载荷穿透 WAF 检测规则。
performing-vulnerability-scanning-with-nessus
使用 Tenable Nessus 执行认证和未认证漏洞扫描,识别网络基础设施、服务器和应用程序中的已知漏洞、 错误配置、默认凭据和缺失补丁。扫描器将发现与 CVE 数据库和 CVSS 评分关联,生成优先级修复指导。 适用于漏洞扫描、Nessus 评估、补丁合规检查或自动化漏洞检测等请求场景。