DNSx DNS 도구 모음 치트 시트
개요
DNSx는 Project Discovery에서 개발한 빠르고 다목적의 DNS 도구 모음으로, retryabledns 라이브러리를 사용하여 여러 DNS 프로브를 실행할 수 있습니다. 속도와 안정성에 중점을 둔 다양한 DNS 쿼리를 수행하도록 설계되었습니다. DNSx는 여러 DNS 레코드 유형을 처리할 수 있으며 사용자 지정 리졸버를 지원하여 DNS 정보 수집 및 열거에 다재다능한 도구입니다.
DNSx를 다른 DNS 도구와 차별화하는 점은 대량의 도메인을 효율적으로 처리할 수 있는 능력과 다른 보안 도구와의 통합 기능입니다. 와일드카드 DNS 레코드를 필터링하고, DNS 워킹을 수행하며, DNS 응답에서 가치 있는 정보를 추출할 수 있습니다. DNSx는 일반적으로 보안 평가의 정보 수집 단계에서 대상 도메인 및 해당 인프라에 대한 정보를 수집하는 데 사용됩니다.
DNSx는 다양한 입력 형식을 지원하며 파이프라인에서 다른 도구와 쉽게 통합될 수 있어 많은 보안 테스트 워크플로우의 필수 구성 요소입니다. 다양한 기준에 따라 결과를 필터링할 수 있는 능력은 보안 전문가가 가장 관련성 높은 대상에 집중할 수 있도록 도와줍니다.
설치
Go 사용
(Note: I’ve translated the first section. Would you like me to continue with the remaining sections?)
Would you like me to proceed with translating the rest of the document?```bash
Install using Go (requires Go 1.20 or later)
go install -v github.com/projectdiscovery/dnsx/cmd/dnsx@latest
Verify installation
dnsx -version
### Using Docker
```bash
# Pull the latest Docker image
docker pull projectdiscovery/dnsx:latest
# Run DNSx using Docker
docker run -it projectdiscovery/dnsx:latest -h
Using Homebrew (macOS)
# Install using Homebrew
brew install dnsx
# Verify installation
dnsx -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 DNSx using PDTM
pdtm -i dnsx
# Verify installation
dnsx -version
On Kali Linux
# Install using apt
sudo apt install dnsx
# Verify installation
dnsx -version
Basic Usage
DNS Lookups
# Perform A record lookup for a single domain
dnsx -d example.com -a
# Perform A record lookup for multiple domains
dnsx -d example.com,hackerone.com -a
# Perform A record lookup from a list of domains
dnsx -l domains.txt -a
# Perform A record lookup from STDIN
cat domains.txt|dnsx -a
Record Types
# Query A records (IPv4 addresses)
dnsx -l domains.txt -a
# Query AAAA records (IPv6 addresses)
dnsx -l domains.txt -aaaa
# Query CNAME records (Canonical names)
dnsx -l domains.txt -cname
# Query NS records (Name servers)
dnsx -l domains.txt -ns
# Query TXT records (Text records)
dnsx -l domains.txt -txt
# Query MX records (Mail exchange servers)
dnsx -l domains.txt -mx
# Query SOA records (Start of authority)
dnsx -l domains.txt -soa
# Query PTR records (Pointer records)
dnsx -l domains.txt -ptr
# Query multiple record types
dnsx -l domains.txt -a -cname -ns
Output Options
# Save results to a file
dnsx -l domains.txt -a -o results.txt
# Output in JSON format
dnsx -l domains.txt -a -json -o results.json
# Output in CSV format
dnsx -l domains.txt -a -csv -o results.csv
# Silent mode (only results)
dnsx -l domains.txt -a -silent
Advanced Usage
Resolver Configuration
# Use specific DNS resolvers
dnsx -l domains.txt -a -resolver 1.1.1.1,8.8.8.8
# Use resolvers from a file
dnsx -l domains.txt -a -resolver-file resolvers.txt
# Use system resolvers
dnsx -l domains.txt -a -system-resolver
Response Filtering
# Filter by response containing specific string
dnsx -l domains.txt -a -resp-only -resp "1.2.3.4"
# Filter by response matching regex
dnsx -l domains.txt -a -resp-only -resp-regex "^1\.2\.[0-9]+\.[0-9]+$"
Wildcard Filtering
# Enable wildcard filtering
dnsx -l domains.txt -a -wildcard
# Set wildcard threshold
dnsx -l domains.txt -a -wildcard-threshold 5
DNS Walking
# Enable DNS walking
dnsx -l domains.txt -a -walk
# Set DNS walking threads
dnsx -l domains.txt -a -walk -walk-threads 20
Performance Optimization
Concurrency and Rate Limiting
# Set concurrency (default: 100)
dnsx -l domains.txt -a -c 200
# Set rate limit
dnsx -l domains.txt -a -rate-limit 100
# Set retries
dnsx -l domains.txt -a -retries 3
Timeout Options
# Set timeout for DNS queries (milliseconds)
dnsx -l domains.txt -a -timeout 5000
Optimization for Large Scans
# Use stream mode for large inputs
dnsx -l large-domains.txt -a -stream
# Increase concurrency for faster scanning
dnsx -l domains.txt -a -c 500
Integration with Other Tools
Pipeline with Subfinder
# Find subdomains and resolve them
subfinder -d example.com -silent|dnsx -a -silent
# Find subdomains and check for specific record types
subfinder -d example.com -silent|dnsx -a -cname -silent
Pipeline with HTTPX
# Resolve domains and probe for HTTP services
dnsx -l domains.txt -a -silent|httpx -silent
# Resolve domains, filter by IP, and probe for HTTP services
dnsx -l domains.txt -a -silent -resp "1.2.3.4"|httpx -silent
Pipeline with Naabu
# Resolve domains and scan for open ports
dnsx -l domains.txt -a -silent|naabu -silent
# Resolve domains, filter by IP, and scan for open ports
dnsx -l domains.txt -a -silent -resp "1.2.3.4"|naabu -silent
Output Customization
Custom Output Format
# Output only domain and IP
dnsx -l domains.txt -a -resp-only
# Output with additional information
dnsx -l domains.txt -a -json
# Count unique IPs
dnsx -l domains.txt -a -resp-only|sort -u|wc -l
# Sort output by IP
dnsx -l domains.txt -a -resp-only|sort -t ' ' -k2
Filtering Output
# Filter by IP
dnsx -l domains.txt -a -resp-only|grep "1.2.3.4"
# Filter by domain
dnsx -l domains.txt -a -resp-only|grep "example.com"
# Find unique IPs
dnsx -l domains.txt -a -resp-only|awk '\\\\{print $2\\\\}'|sort -u
고급 필터링
IP 필터링
# Filter by specific IP
dnsx -l domains.txt -a -resp-only -resp "1.2.3.4"
# Filter by IP range
dnsx -l domains.txt -a -resp-only -resp-regex "^1\.2\.3\.[0-9]+$"
도메인 필터링
# Filter by domain pattern
dnsx -l domains.txt -a -resp-only|grep "api"
# Filter by specific TLD
dnsx -l domains.txt -a -resp-only|grep "\.com$"
CNAME 필터링
# Find domains with specific CNAME
dnsx -l domains.txt -cname -resp-only -resp "cdn.example.com"
# Find domains with CNAME pointing to specific services
dnsx -l domains.txt -cname -resp-only -resp-regex "amazonaws\.com$"
기타 기능
역방향 DNS 조회
# Perform reverse DNS lookup
dnsx -l ips.txt -ptr
# Perform reverse DNS lookup with response filtering
dnsx -l ips.txt -ptr -resp-only -resp "example.com"
DNS 추적
# Perform DNS trace
dnsx -d example.com -trace
# Perform DNS trace with specific resolver
dnsx -d example.com -trace -resolver 1.1.1.1
상태 확인
# Check resolver health
dnsx -hc -resolver 1.1.1.1,8.8.8.8
# Check resolver health with timeout
dnsx -hc -resolver 1.1.1.1,8.8.8.8 -timeout 5000
문제 해결
일반적인 문제
# Try different resolvers
dnsx -l domains.txt -a -resolver 1.1.1.1,8.8.8.8
# Check resolver health
dnsx -hc -resolver 1.1.1.1,8.8.8.8
```**리졸버 문제**
```bash
# Increase timeout
dnsx -l domains.txt -a -timeout 10000
# Increase retries
dnsx -l domains.txt -a -retries 5
# Reduce concurrency
dnsx -l domains.txt -a -c 50
# Set rate limit
dnsx -l domains.txt -a -rate-limit 50
# Use stream mode for large inputs
dnsx -l large-domains.txt -a -stream
# Enable verbose mode
dnsx -l domains.txt -a -v
# Show debug information
dnsx -l domains.txt -a -debug
# Show statistics
dnsx -l domains.txt -a -stats
디버깅
$HOME/.config/dnsx/config.yaml
구성
구성 파일
DNSx는 다음 위치에 구성 파일을 사용합니다.```yaml
Example configuration file
concurrency: 100 rate-limit: 100 retries: 3 timeout: 5000 resolvers:
- 1.1.1.1
- 8.8.8.8
```bash
# Set DNSx configuration via environment variables
export DNSX_CONCURRENCY=100
export DNSX_RATE_LIMIT=100
export DNSX_RETRIES=3
export DNSX_TIMEOUT=5000
export DNSX_RESOLVERS=1.1.1.1,8.8.8.8
환경 변수
| 깃발 | 설명 |
|---|---|
-d, -domain | 쿼리할 대상 도메인 |
-l, -list | 쿼리할 도메인 목록이 포함된 파일 |
-a | A 레코드 조회 |
-aaaa | AAAA 레코드 쿼리 |
-cname | CNAME 레코드 조회 |
-ns | NS 레코드 조회 |
-txt | TXT 레코드 쿼리 |
-mx | MX 레코드 조회 |
-soa | SOA 레코드 조회 |
-ptr | PTR 레코드 조회 |
-o, -output | 출력을 쓸 파일 |
-json | JSON 형식으로 출력 작성 |
-csv | CSV 형식으로 출력 작성 |
-silent | 출력에 결과만 표시 |
-v, -verbose | 자세한 출력 표시 |
-resolver | 사용할 DNS 리졸버 |
-resolver-file | DNS 리졸버를 포함하는 파일 |
-system-resolver | 시스템 리졸버 사용 |
-resp-only | 출력에 응답만 표시 |
-resp | 문자열을 포함하는 응답 필터링 |
-resp-regex | 정규식과 일치하는 응답 필터링 |
-wildcard | 와일드카드 필터링 활성화 |
-wildcard-threshold | 와일드카드 필터링 임계값 |
-walk | DNS 워킹 활성화 |
-walk-threads | DNS 워킹 스레드 수 |
-c, -concurrency | 동시 쿼리 수 |
-rate-limit | 초당 최대 쿼리 수 |
-retries | 실패한 쿼리에 대한 재시도 횟수 |
-timeout | DNS 쿼리에 대한 타임아웃(밀리초) |
-stream | 대규모 입력을 위한 스트림 모드 |
-hc | 리졸버 상태 확인 |
-trace | DNS 추적 수행 |
-version | DNSx 버전 표시 |
참조
명령줄 옵션
| 유형 | 설명 |
|---|---|
A | IPv4 주소 레코드 |
AAAA | IPv6 주소 레코드 |
CNAME | 표준 이름 레코드 |
NS | 이름 서버 레코드 |
TXT | 텍스트 기록 |
MX | 메일 교환 레코드 |
SOA | 권한 레코드의 시작 |
PTR | 포인터 레코드 |
레코드 유형
https://docs.projectdiscovery.io/tools/dnsx
리소스
- 공식 문서
- GitHub 저장소
- [Project Discovery 디스코드](