Subfinder 서브도메인 열거 치트 시트
개요
Subfinder는 Project Discovery에서 개발한 강력한 서브도메인 발견 도구로, 온라인 수동 소스를 사용하여 웹사이트의 유효한 서브도메인을 발견합니다. 간단한 모듈식 아키텍처를 가지고 있으며 속도와 효율성에 최적화되어 있습니다. Subfinder는 검색 엔진, DNS 집계기, 인증서 투명성 로그를 포함한 다양한 공개 및 비공개 소스를 사용하여 서브도메인을 찾습니다.
Subfinder를 다른 서브도메인 열거 도구와 차별화하는 점은 광범위한 소스 커버리지와 향상된 결과를 위해 API 키를 사용할 수 있는 능력입니다. 여러 데이터 소스를 동시에 활용함으로써, Subfinder는 다른 도구들이 놓칠 수 있는 서브도메인을 발견할 수 있습니다. 보안 워크플로우에 쉽게 통합될 수 있도록 설계되었으며, 포괄적인 정찰을 위해 다른 도구들과 함께 사용될 수 있습니다.
Subfinder는 보안 연구자, 버그 바운티 헌터, 침투 테스터들이 대상 조직의 공격 표면을 매핑하기 위한 첫 번째 단계로 널리 사용됩니다. 수동적인 접근 방식은 대상에 의심스러운 트래픽을 생성하지 않기 때문에 은밀한 정찰에 적합합니다.
Would you like me to continue with the remaining sections?```bash
Install using Go (requires Go 1.20 or later)
go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
Verify installation
subfinder -version
### Using Docker
```bash
# Pull the latest Docker image
docker pull projectdiscovery/subfinder:latest
# Run Subfinder using Docker
docker run -it projectdiscovery/subfinder:latest -h
Using Homebrew (macOS)
# Install using Homebrew
brew install subfinder
# Verify installation
subfinder -version
Using PDTM (Project Discovery Tools Manager)
# Install PDTM first if not already installed
go install -v github.com/projectdiscovery/pdtm/cmd/pdtm@latest
# Install Subfinder using PDTM
pdtm -i subfinder
# Verify installation
subfinder -version
On Kali Linux
# Install using apt
sudo apt install subfinder
# Verify installation
subfinder -version
Basic Usage
Enumerating Subdomains
# Enumerate subdomains for a single domain
subfinder -d example.com
# Enumerate subdomains for multiple domains
subfinder -d example.com,hackerone.com
# Enumerate subdomains from a list of domains
subfinder -dL domains.txt
Output Options
# Save results to a file
subfinder -d example.com -o results.txt
# Output in JSON format
subfinder -d example.com -oJ -o results.json
# Output in JSONL format
subfinder -d example.com -oJ -nW -o results.jsonl
# Output in CSV format
subfinder -d example.com -oC -o results.csv
# Silent mode (only subdomains)
subfinder -d example.com -silent
Basic Filtering
# Remove wildcard subdomains
subfinder -d example.com -nW
# Exclude specific subdomains
subfinder -d example.com -exclude-domains dev.example.com,stage.example.com
# Match specific subdomains
subfinder -d example.com -match-domain api.example.com
Advanced Usage
Source Selection
# List all available sources
subfinder -ls
# Use specific sources
subfinder -d example.com -sources censys,shodan,virustotal
# Exclude specific sources
subfinder -d example.com -exclude-sources alienvault,threatcrowd
API Configuration
# Set API keys interactively
subfinder -set-config
# Set specific API key
subfinder -set-config VirusTotal=APIKEY
# Use a custom configuration file
subfinder -d example.com -config config.yaml
Recursive Enumeration
# Enable recursive subdomain discovery
subfinder -d example.com -recursive
# Set maximum recursion depth
subfinder -d example.com -recursive -max-depth 2
DNS Resolution
# Resolve discovered subdomains
subfinder -d example.com -resolve
# Use custom resolvers
subfinder -d example.com -resolve -r resolvers.txt
Active Enumeration
# Enable active enumeration
subfinder -d example.com -active
# Set timeout for active enumeration
subfinder -d example.com -active -timeout 10
Performance Optimization
Concurrency and Rate Limiting
# Set source concurrency (default: 10)
subfinder -d example.com -sc 20
# Set host concurrency (default: 10)
subfinder -d example.com -hc 20
# Set rate limit
subfinder -d example.com -rate-limit 100
Timeout Options
# Set timeout for passive sources
subfinder -d example.com -timeout 30
# Set timeout for active resolution
subfinder -d example.com -resolve -timeout-resolve 5
Optimization for Large Scans
# Use all sources for comprehensive results
subfinder -d example.com -all
# Increase concurrency for faster scanning
subfinder -d example.com -sc 50 -hc 50
Integration with Other Tools
Pipeline with HTTPX
# Find subdomains and probe for HTTP services
subfinder -d example.com -silent|httpx -silent
# Find subdomains, resolve them, and probe for HTTP services
subfinder -d example.com -silent -resolve|httpx -silent
Pipeline with Nuclei
# Find subdomains and scan for vulnerabilities
subfinder -d example.com -silent|httpx -silent|nuclei -t cves/
# Find subdomains with specific patterns and scan for vulnerabilities
subfinder -d example.com -silent|grep api|httpx -silent|nuclei -t apis/
Pipeline with Naabu
# Find subdomains and scan for open ports
subfinder -d example.com -silent|naabu -silent
# Find subdomains, scan for open ports, and probe for HTTP services
subfinder -d example.com -silent|naabu -silent|httpx -silent
Output Customization
Custom Output Format
# Output only specific fields in JSON format
subfinder -d example.com -oJ|jq '.host'
# Count total subdomains
subfinder -d example.com -silent|wc -l
# Sort output alphabetically
subfinder -d example.com -silent|sort
출력 필터링
# Filter subdomains by pattern
subfinder -d example.com -silent|grep api
# Filter out specific patterns
subfinder -d example.com -silent|grep -v dev
# Find unique root subdomains
subfinder -d example.com -silent|awk -F. '\\\\{print $(NF-1)"."$NF\\\\}'|sort -u
고급 필터링
# Filter by subdomain level
subfinder -d example.com -silent|awk -F. 'NF==3' # 2nd level subdomains
subfinder -d example.com -silent|awk -F. 'NF==4' # 3rd level subdomains
subfinder -d example.com -silent|awk -F. 'NF>=5' # Deep level subdomains
# Filter by specific patterns
subfinder -d example.com -silent|grep -E '(api|dev|stage|test)'
# Exclude common development subdomains
subfinder -d example.com -silent|grep -v -E '(dev|stage|test|uat)'
API 키 구성
API 키 구성하기
Subfinder는 다양한 API 제공자를 지원합니다. 다음은 구성 방법입니다:
# Create a configuration file
mkdir -p $HOME/.config/subfinder
cat > $HOME/.config/subfinder/config.yaml << EOF
resolvers:
- 1.1.1.1
- 8.8.8.8
sources:
- alienvault
- censys
- shodan
- virustotal
binaryedge:
- 0bf8919b-aab9-42e4-9574-d3b639324597
censys:
- ac244e2f-b635-4581-878a-33f4e79a2c13:dd510d6e-1b6e-4655-83f6-f347b363def9
certspotter:
- 0412e8d1-5a86-47b4-a1a6-2a3b4a104a1a
github:
- ghp_16C7e42F292c6912E7710c838347Ae178B4a
passivetotal:
- sample-email@user.com:sample-password
securitytrails:
- 9e56ef28-540b-4e0c-a51e-aba1f0d2d4d3
shodan:
- AAAAClP1bJJSRMEYJazgwhJKrggRwKA
virustotal:
- 6f5e5b82a6b5a61951c6a659d4a4522b34b3950d1e35e93131a7f63a3c352553
EOF
지원되는 API 제공자
| 제공자 | 설명 |
|---|---|
| BinaryEdge | 인터넷에 노출된 장치 검색 |
| Censys | 인터넷 연결 기기를 위한 검색 엔진 |
| Certspotter | 인증서 투명성 모니터링 |
| GitHub | 코드 호스팅 플랫폼 |
| PassiveTotal | 위협 인텔리전스 플랫폼 |
| SecurityTrails | DNS 및 도메인 데이터 제공자 |
| Shodan | 인터넷 연결 기기를 위한 검색 엔진 |
| VirusTotal | 파일 및 URL 분석 서비스 |
문제 해결
일반적인 문제들
# Reduce concurrency
subfinder -d example.com -sc 5
# Add delay between requests
subfinder -d example.com -delay 2
```**소스의 속도 제한**
```bash
# Verify API key configuration
cat $HOME/.config/subfinder/config.yaml
# Test specific source
subfinder -d example.com -sources censys
``````bash
# Use custom resolvers
subfinder -d example.com -resolve -r resolvers.txt
# Increase resolution timeout
subfinder -d example.com -resolve -timeout-resolve 10
```**API 키 문제**
```bash
# Process domains one by one
for domain in $(cat domains.txt); do subfinder -d $domain -o "$domain-subs.txt"; done
``````bash
# Enable verbose mode
subfinder -d example.com -v
# Show debug information
subfinder -d example.com -debug
# Check source statistics
subfinder -d example.com -stats
```**DNS 해결 문제**
`$HOME/.config/subfinder/config.yaml````yaml
# Example configuration file
resolvers:
- 1.1.1.1
- 8.8.8.8
sources:
- alienvault
- censys
- shodan
- virustotal
# API keys for different providers
binaryedge:
- API_KEY
censys:
- API_ID:API_SECRET
```**메모리 문제**
```bash
# Set Subfinder configuration via environment variables
export SUBFINDER_CONFIG_PATH=/path/to/config.yaml
export SUBFINDER_SOURCES=censys,shodan,virustotal
export SUBFINDER_RESOLVERS=1.1.1.1,8.8.8.8
디버깅
| 깃발 | 설명 |
|---|---|
-d, -domain | 하위 도메인을 찾기 위한 도메인 |
-dL, -domain-list | 도메인 목록이 포함된 파일 |
-o, -output | 출력을 쓸 파일 |
-oJ | JSON 형식으로 출력 작성 |
-oC | CSV 형식으로 출력 작성 |
-silent | 출력에 하위 도메인만 표시 |
-v, -verbose | 자세한 출력 표시 |
-ls, -list-sources | 모든 사용 가능한 소스 나열하기 |
-s, -sources | 열거에 사용할 소스 |
-es, -exclude-sources | 열거에서 제외할 소스 |
-recursive | 재귀적 서브도메인 검색 |
-max-depth | 최대 재귀 깊이 |
-nW, -no-wildcards | 와일드카드 하위 도메인 제거 |
-exclude-domains | 열거에서 제외할 서브도메인 |
-match-domain | 열거에서 일치시킬 하위 도메인 |
-r, -resolvers | 확인자 목록을 포함하는 파일 |
-resolve | 발견된 하위 도메인 해결 |
-active | 활성 하위 도메인 열거 활성화 |
-timeout | 수동 소스의 타임아웃(초) |
-timeout-resolve | 리졸버 요청에 대한 타임아웃(초 단위) |
-sc, -source-concurrency | 동시 소스의 수 |
-hc, -host-concurrency | 동시 호스트 수 |
-rate-limit | 초당 최대 HTTP 요청 수 |
-all | 열거를 위해 모든 소스 사용 |
-config | 구성 파일 경로 |
-set-config | 구성 값 설정 |
-version | Subfinder 버전 표시 |
| 소스 | 설명 | API 키 필요 |
|---|---|---|
| Alienvault | Open Threat Exchange | 아니오 |
| Anubis | Anubis의 서브도메인 데이터 | 아니오 |
| Archiveis | Archive.is URL 아카이브 | 아니오 |
| Binaryedge | 인터넷 스캐닝 데이터 | 네 |
| BufferOver | DNS 데이터 | 아니오 |
| Censys | 인터넷 스캐닝 데이터 | 네 |
| CertSpotter | 인증서 투명성 로그 | 네 (더 나은 결과를 위해) |
| Chaos | Project Discovery의 Chaos 데이터셋 | 네 |
| Commoncrawl | 웹 크롤링 데이터 | 아니오 |
| DNSDB | 패시브 DNS 데이터베이스 | 네 |
| DNSRepo | DNS 레코드 저장소 | 아니오 |
| Entrust | 인증서 투명성 로그 | 아니오 |
| FacebookCT | Facebook의 인증서 투명성 로그 | 아니오 |
| GitHub | 코드 검색 | 네 (더 나은 결과를 위해) |
| Intelx | Intelligence X 데이터 | 네 |
| PassiveTotal | RiskIQ의 패시브 DNS 데이터 | 네 |
| Rapiddns | DNS 레코드 데이터베이스 | 아니오 |
| Riddler | DNS 레코드 검색 | 아니오 |
| SecurityTrails | DNS 레코드 데이터베이스 | 네 |
| Shodan | 인터넷 스캐닝 데이터 | 네 |
| ThreatBook | 위협 인텔리전스 데이터 | 네 |
| ThreatMiner | 위협 인텔리전스 데이터 | 아니오 |
| URLScan | URL 스캐닝 서비스 | 아니오 |
| VirusTotal | 파일 및 URL에 대한 보안 서비스 | 네 |
| Waybackarchive | 인터넷 아카이브의 웨이백 머신 | 아니오 |
| ZoomEye | 사이버스페이스 검색 엔진 | 네 |
구성
구성 파일
Subfinder는 다음 위치에 있는 구성 파일을 사용합니다: https://docs.projectdiscovery.io/tools/subfinder 이 파일에서 다양한 설정을 사용자 지정할 수 있습니다: https://github.com/projectdiscovery/subfinder
환경 변수
https://discord.gg/projectdiscovery