subfinder is a passive subdomain discovery tool by ProjectDiscovery. Core advantages:Purely passive(generates no traffic to the target) + Multi-source aggregation(40+ sources) + Pipeline-friendly。
Project URL:https://github.com/projectdiscovery/subfinder
Phase 1: Basic Usage
# 单个域名
subfinder -d target.com
# 静默输出(只输出子域名)
subfinder -d target.com -silent
# 多个域名
subfinder -dL domains.txt -silent
Output to file
subfinder -d target.com -o subdomains.txt
## Phase 2: 数据源配置
```bash
# 使用全部数据源(更全面,较慢)
subfinder -d target.com -all
# 指定数据源
subfinder -d target.com -s crtsh,github,shodan
# 查看可用数据源
subfinder -ls
# 排除特定数据源
subfinder -d target.com -es github,rapiddns
API Key configuration: edit ~/.config/subfinder/provider-config.yaml Adding API Keys can greatly improve results.
Phase 3: Pipeline Integration
# 子域名 → HTTP 存活检测
subfinder -d target.com -silent | httpx -silent
# 子域名 → 端口扫描 → HTTP 存活
subfinder -d target.com -silent | naabu -p 80,443 -silent | httpx -silent
# 子域名 → 存活 → 漏洞扫描(完整链)
subfinder -d target.com -silent | httpx -silent | nuclei -severity critical,high
# 子域名 → DNS 解析
subfinder -d target.com -silent | dnsx -a -resp -silent
# 子域名 → IP 去重
subfinder -d target.com -silent | dnsx -a -resp-only -silent | sort -u
Phase 4: Advanced Options
# 递归子域名发现
subfinder -d target.com -recursive
# JSON 输出
subfinder -d target.com -json -o results.json
# 控制并发
subfinder -d target.com -t 50
# 设置超时
subfinder -d target.com -timeout 30
# 只显示特定数据源的结果
subfinder -d target.com -cs -silent
Common Scenarios Quick Reference
| Scenario | Command |
|---|---|
| Quick enumeration | subfinder -d target.com -silent |
| Comprehensive enumeration | subfinder -d target.com -all -silent |
| Batch domains | subfinder -dL domains.txt -silent -o all_subs.txt |
| Takeover detection chain | subfinder -d target.com -silent | httpx -silent | nuclei -t takeovers/ |