Subfinder
Subfinder (ProjectDiscovery) เป็นเครื่องมือ passive subdomain enumeration ที่เร็วและครอบคลุม — รวม source จำนวนมาก, config API key ง่าย, ออกแบบให้ทำงานกับ pipeline และ tool อื่นใน ecosystem บทนี้ลงลึกการใช้, การ config API, source, การต่อ pipeline, และ workflow (เนื้อหาเพื่อ recon ที่ได้รับอนุญาต)
1. Subfinder คืออะไร
Subfinder (ProjectDiscovery) เป็นเครื่องมือ passive subdomain enumeration — ดึง subdomain จาก source หลายสิบแหล่ง (CT logs, DNS aggregator, search engine, API) จุดเด่น: เร็ว, source เยอะ, config API key ง่าย, และทำงานเข้าขากับ ecosystem ของ ProjectDiscovery (dnsx, httpx, nuclei) เป็นตัวเลือกแรกสำหรับ passive enum ที่เร็วและครบ
2. การใช้
# ติดตั้ง
go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
# พื้นฐาน
subfinder -d example.com
# ใช้ทุก source (ครบสุด — ต้องมี API key สำหรับบาง source)
subfinder -d example.com -all
# silent (เฉพาะ subdomain — เหมาะ pipeline)
subfinder -d example.com -silent -o subs.txt
# หลาย domain
subfinder -dL domains.txt -o subs.txt
# แสดง source ที่เจอแต่ละ subdomain
subfinder -d example.com -cs3. Config API keys (สำคัญ)
# ~/.config/subfinder/provider-config.yaml
shodan:
- YOUR_SHODAN_KEY
censys:
- YOUR_CENSYS_ID:YOUR_CENSYS_SECRET
securitytrails:
- YOUR_KEY
virustotal:
- YOUR_KEY
github:
- YOUR_GITHUB_TOKEN
# source ฟรีบางตัวจำกัด — API key เปิด source เพิ่มและ rate สูงขึ้น
# ยิ่งใส่มาก ผล -all ยิ่งครบ4. Pipeline (ProjectDiscovery ecosystem)
# subfinder → resolve → probe → scan (one-liner ครบ)
subfinder -d example.com -silent | dnsx -silent | httpx -silent
# + nuclei (หาช่องโหว่บน subdomain ที่ alive)
subfinder -d example.com -silent | dnsx -silent | httpx -silent | nuclei -t cves/
# + takeover check
subfinder -d example.com -silent | httpx -silent | nuclei -t takeovers/
# รวมกับ amass + assetfinder (เพิ่ม coverage)
(subfinder -d example.com -silent; assetfinder --subs-only example.com; amass enum -passive -d example.com) | sort -u > all.txt5. Workflow + Quick Reference
- 1config API keys ใน provider-config.yaml (ครั้งเดียว)
- 2subfinder -d target -all -silent -o subs.txt
- 3รวมกับ amass -passive + assetfinder → sort -u
- 4resolve: dnsx -silent
- 5probe alive: httpx -silent -title -tech-detect
- 6scan: nuclei (cves/takeovers)
- passive subdomain enum เร็ว+ครบ (ProjectDiscovery)
- subfinder -d X -all -silent -o subs.txt
- config API: ~/.config/subfinder/provider-config.yaml (เพิ่ม coverage)
- pipeline: subfinder|dnsx|httpx|nuclei
- รวม amass+assetfinder → sort -u (ครบสุด)
- เร็วกว่า amass; เป็นตัวเลือกแรกของ passive enum
🧭 จับมือทำทีละขั้น (มีแค่ Kali) + ถ้าติดไปไหนต่อ
สมมติอยากได้รายชื่อ subdomain แบบเร็วและครบในก้าวเดียว มีแค่ Kali เปล่าๆ ไม่มี API key ทำตามนี้ทีละขั้น
- 1เช็คว่ามี Go แล้วติดตั้ง subfinder:
go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest - 2รันแบบพื้นฐานก่อน:
subfinder -d target.com -silent -o subs.txt - 3เช็คจำนวน:
wc -l subs.txt— ถ้าน้อยเกินคาด ลอง -all เพื่อใช้ทุก source:subfinder -d target.com -all -silent -o subs.txt - 4ถ้ามีเวลา ตั้ง API key เพิ่ม coverage ที่
~/.config/subfinder/provider-config.yaml(Shodan/VirusTotal สมัครฟรีได้) - 5รันใหม่หลังตั้ง key แล้วเทียบจำนวนว่าเพิ่มขึ้นไหม
- 6ต่อ pipeline ทันทีเพื่อกรองเฉพาะที่ยังใช้งาน:
subfinder -d target.com -silent | dnsx -silent | httpx -silent -title -status-code - 7รวมกับ tool อื่นเพิ่ม coverage ถ้าจำเป็น:
(subfinder -d target.com -silent; assetfinder --subs-only target.com) | sort -u > all.txt - 8เช็ค subdomain takeover จากรายชื่อที่ resolve ได้:
cat all.txt | httpx -silent | nuclei -t takeovers/ - 9จดรายชื่อ host ที่น่าสนใจ (dev/staging/admin/api) ไว้ก่อนไป enum ต่อ
- 10ถ้า subfinder ให้ผลน้อยมากแม้ -all แล้ว ลองสลับไป amass (ช้ากว่าแต่ครอบคลุมกว่า) หรือ crt.sh ตรงๆ
| ขั้นตอน/งาน | เครื่องมือใน Kali | ติดตั้งเพิ่ม (ถ้าไม่มี) | เครื่องมือออนไลน์ |
|---|---|---|---|
| passive subdomain enum เร็ว | subfinder (ถ้ามี Go) | go install .../subfinder/v2/cmd/subfinder@latest | crt.sh |
| resolve subdomain | dnsx | go install .../dnsx@latest | dnsdumpster.com |
| probe web alive | httpx | go install .../httpx@latest | hackertarget.com |
| scan/ตรวจ takeover | nuclei | go install .../nuclei@latest | - |
| ขอ API key เพิ่ม coverage | nano/vim | - | shodan.io, securitytrails.com, virustotal.com |
| เทียบผลกับ tool อื่น | amass, assetfinder | sudo apt install amass | - |
หัวข้อที่เชื่อมโยง
โน้ตของฉัน
ยังไม่มีโน้ตสำหรับหัวข้อนี้