Modular subdomain enumeration · C++ DNS resolver · AI-powered analysis · HTML reports
SubHunter aggregates subdomains from 5 OSINT sources, resolves them in parallel with a compiled C++ binary, optionally runs Nuclei for vulnerability scanning, and delivers both a rich terminal report and a self-contained HTML report - all powered by an optional AI security analysis via Claude or GPT-4o.
____ _ _ _ _
/ ___| _ _| |__ | | | |_ _ _ __ | |_ ___ _ __
\___ \| | | | '_ \| |_| | | | | '_ \| __/ _ \ '__|
___) | |_| | |_) | _ | |_| | | | | || __/ |
|____/ \__,_|_.__/|_| |_|\__,_|_| |_|\__\___|_|
[*] Loaded 3 domain(s).
Source Status
─────────────────────────
VirusTotal ENABLED
crt.sh ENABLED
GitHub ENABLED
Sublist3r ENABLED
Shodan DISABLED
[*] Starting parallel subdomain enumeration...
Enumerating ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:18
[+] Discovered 247 unique subdomains.
[*] Resolving 247 subdomains via C++ DNS resolver...
[+] DNS resolution complete: 193 alive / 54 dead.
Hostname IP Address Alive Latency
─────────────────────────────────────────────────────────────
api.example.com 1.2.3.4 YES 8 ms
dev.example.com 1.2.3.5 YES 11 ms
staging.example.com - NO -
...
[+] Nuclei scan completed.
[+] HTML report written to: Reports/report.html
╭─────────────────── Scan Complete ──────────────────────╮
│ Total subdomains: 247 │
│ Alive (DNS): 193 │
│ Nuclei findings: 12 │
│ HTML report: Reports/report.html │
╰──────────────────────────────────────────────────────────╯
SubHunter is intentionally split across Python + C++ to use each language where it excels:
┌─────────────────────────────────────────────────────────┐
│ subhunter.py (entry point) │
└───────────────────────┬─────────────────────────────────┘
│
┌───────────────────────▼─────────────────────────────────┐
│ subhunter/cli.py │
│ (argument parsing + pipeline orchestration) │
└──┬────────────┬──────────────┬──────────────┬───────────┘
│ │ │ │
▼ ▼ ▼ ▼
Enumerators Resolvers Output AI
(Python) (C++ / Py) (Python) (Python)
│ │ │ │
│ ┌──────┴───────┐ ┌───┴────────┐ │
│ │ C++ binary │ │ terminal │ │
│ │ dns_resolver │ │ html_report│ │
│ └──────────────┘ └────────────┘ │
│ │
▼ ▼
5 OSINT sources Claude / GPT-4o
VT · crt.sh · GitHub via official SDKs
Sublist3r · Shodan
| Layer | Language | Why |
|---|---|---|
| OSINT queries | Python | Rich HTTP / parsing ecosystem |
| DNS resolution | C++17 | getaddrinfo + std::thread - thousands of hosts in seconds |
| Nuclei wrapper | Python | subprocess + CSV parsing |
| HTML / AI output | Python | Template generation, AI SDK calls |
| CLI orchestration | Python | argparse, concurrent.futures, rich |
SubHunter/
├── subhunter.py ← entry-point shim
├── pyproject.toml ← packaging + tool config (ruff, mypy, pytest)
├── requirements.txt ← pinned runtime deps
├── Makefile ← make build / test / lint / clean
├── build.sh ← one-command C++ build
├── LICENSE
├── CHANGELOG.md
├── CONTRIBUTING.md
├── SECURITY.md
│
├── resolver/ ← C++ DNS resolver
│ ├── dns_resolver.cpp ← multi-threaded resolver source
│ └── Makefile
│
├── subhunter/ ← Python package
│ ├── __init__.py
│ ├── __main__.py ← enables `python -m subhunter`
│ ├── py.typed ← PEP 561 marker
│ ├── cli.py ← pipeline orchestration + all CLI flags
│ ├── enumerators/ ← one file = one OSINT source
│ │ ├── virustotal.py
│ │ ├── crtsh.py
│ │ ├── github.py
│ │ ├── sublister.py
│ │ └── shodan.py
│ ├── resolvers/
│ │ └── dns_resolver.py ← wraps C++ binary; auto-builds; Python fallback
│ ├── scanners/
│ │ └── nuclei.py ← runner + CSV parser
│ ├── output/
│ │ ├── terminal.py ← Rich tables, panels, progress
│ │ └── html_report.py ← standalone HTML report generator
│ ├── ai/
│ │ └── analyzer.py ← Claude + OpenAI integrations
│ └── utils/
│ └── helpers.py ← shared I/O + normalisation
│
├── tests/ ← pytest suite (42 tests, no network required)
│ ├── conftest.py
│ ├── test_helpers.py
│ ├── test_nuclei_parser.py
│ ├── test_resolver.py
│ └── test_html_report.py
│
└── .github/
├── workflows/ci.yml ← CI: C++ build (Linux+macOS), Python 3.9–3.13, lint
├── ISSUE_TEMPLATE/
└── PULL_REQUEST_TEMPLATE.md
| Tool | Required | Notes |
|---|---|---|
| Python ≥ 3.9 | Yes | python3 --version |
| g++ (C++17) | Yes | sudo apt install g++ make on Debian/Kali |
| Nuclei | Optional | For vulnerability scanning |
| Sublist3r | Optional | For extra enumeration |
# 1. Clone git clone https://github.com/Keyur-Aghao/SubHunter.git cd SubHunter # 2. Install Python deps pip install -r requirements.txt # 3. Build the C++ DNS resolver bash build.sh # 4. (Optional) Install as a package with the `subhunter` CLI command pip install -e .
make dev-install # pip install -e ".[all]" + build.shpip install sublist3r # Sublist3r go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest # Nuclei
SubHunter reads API credentials from files or environment variables. Never commit secrets.
APIKEY,Remaining YOUR_VT_KEY_HERE,500
ghp_xxxxxxxxxxxxxxxxxxxx
ghp_yyyyyyyyyyyyyyyyyy
Or: export GITHUB_TOKEN=ghp_xxxxx (tokens rotate automatically on rate-limit)
export SHODAN_API_KEY=your_key # or: --shodan-key YOUR_KEY
export ANTHROPIC_API_KEY=sk-ant-xxxxx # Claude (default) export OPENAI_API_KEY=sk-xxxxx # OpenAI (alternative)
python subhunter.py -i domain_list.txt
python subhunter.py -i domain_list.txt --html -o Reports/
python subhunter.py \
-i domain_list.txt \
--html \
--nuclei \
--ai \
--ai-provider claude \
-o Reports/scan_$(date +%F)python subhunter.py -i domains.txt \ --disable-vt --disable-github --disable-sublister --disable-shodan
python subhunter.py -i domains.txt --format json | jq '.subdomains[]'
python subhunter.py -i domains.txt --ai --ai-provider openai --ai-model gpt-4o-mini
subhunter -i domains.txt --html --ai python -m subhunter -i domains.txt --html --ai
| Flag | Default | Description |
|---|---|---|
-i, --input-domains |
domain_list.txt |
Root domains file (one per line) |
-o, --output-dir |
Outputs |
All output files go here |
--format |
terminal |
terminal | json | both |
--html |
off | Generate standalone HTML report |
| Flag | Default | Description |
|---|---|---|
--vt-keys |
vt_keys.csv |
VirusTotal keys CSV |
--github-tokens-file |
.tokens |
GitHub tokens (one per line) |
--shodan-key |
env var | Shodan API key |
| Flag | Description |
|---|---|
--disable-vt |
Disable VirusTotal |
--disable-crtsh |
Disable crt.sh |
--disable-github |
Disable GitHub code search |
--disable-sublister |
Disable Sublist3r |
--disable-shodan |
Disable Shodan |
| Flag | Default | Description |
|---|---|---|
--no-resolve |
off | Skip DNS resolution |
--resolve-threads |
100 |
Parallel threads in C++ binary |
--resolve-timeout |
3 |
Per-hostname timeout (seconds) |
| Flag | Default | Description |
|---|---|---|
--nuclei |
off | Run Nuclei after enumeration |
--nuclei-templates |
built-in | Custom templates path |
--no-nuclei-csv |
off | Skip CSV parsing |
| Flag | Default | Description |
|---|---|---|
--ai |
off | Run AI security analysis |
--ai-provider |
claude |
claude or openai |
--ai-key |
env var | API key override |
--ai-model |
provider default | e.g. claude-opus-4-6, gpt-4o |
| Flag | Default | Description |
|---|---|---|
-w, --workers |
8 |
Enumeration worker threads |
--timeout |
15 |
HTTP timeout (seconds) |
-v, --verbose |
off | Debug logging |
All files are written to --output-dir (default Outputs/):
| File | Contents |
|---|---|
subdomains.txt |
Sorted list of all discovered subdomains |
dns_results.json |
DNS resolution results (hostname, IP, alive, latency) |
nuclei_raw.txt |
Raw Nuclei output |
nuclei_parsed.csv |
Nuclei findings sorted by severity |
ai_analysis.md |
AI analysis in Markdown |
report.html |
Self-contained HTML security report |
The resolver at resolver/dns_resolver.cpp uses:
- POSIX
getaddrinfofor DNS resolution (IPv4 + IPv6) std::threadfor parallelism (up to 500 threads)- JSON output to stdout - consumed by the Python wrapper
The Python wrapper in subhunter/resolvers/dns_resolver.py:
- Checks if the binary exists
- Auto-builds it via
makeif not found - Falls back to Python's
socket.getaddrinfoif compilation fails
# Direct usage echo -e "google.com\nexample.com" | ./resolver/dns_resolver -t 50 -timeout 3
[
{"hostname":"example.com","ip":"93.184.216.34","alive":true,"latency_ms":12.4},
{"hostname":"google.com","ip":"142.250.185.78","alive":true,"latency_ms":8.1}
]The AI module (subhunter/ai/analyzer.py) sends a structured security prompt to the chosen model, covering all discovered subdomains, DNS results, and Nuclei findings.
The AI returns a Markdown report with six sections:
- Attack Surface Summary - subdomain count, naming patterns, infrastructure inferences
- High-Priority Targets - most interesting alive hosts and why
- Vulnerability Analysis - per-finding risk, impact, and CVSS context
- Attack Chains - multi-step exploitation paths
- Recommended Next Steps - prioritised remediation checklist
- OSINT Notes - tech stack and operational inferences
| Provider | Default Model | Env Variable |
|---|---|---|
claude (default) |
claude-opus-4-6 |
ANTHROPIC_API_KEY |
openai |
gpt-4o |
OPENAI_API_KEY |
make test # full suite with coverage make test-fast # stop on first failure
The suite (42 tests) requires no network access and no API keys - all external calls are mocked.
tests/test_helpers.py 12 tests - normalize, write_list
tests/test_nuclei_parser.py 12 tests - parser, severity sorting, CSV output
tests/test_resolver.py 7 tests - Python DNS fallback (mocked socket)
tests/test_html_report.py 11 tests - HTML generation, content, no-CDN guarantee
- Create
subhunter/enumerators/mysource.pywith a singleenumerate(domain, ...) -> Set[str]function - Wire
--disable-mysourceflag andflags["mysource"]incli.py - Write tests in
tests/test_enumerators.py
See CONTRIBUTING.md for the full guide.
SubHunter is intended exclusively for authorized security testing, bug bounty programs, CTF competitions, and educational use. Only scan domains you own or have explicit written permission to test. Unauthorized scanning may violate computer fraud laws in your jurisdiction.