
DNS 열거 스크립트
DNSRecon은 2007년 초에 언어와 DNS에 대해 배우기 위해 작성한 Ruby 스크립트의 Python 포트입니다. 이번에는 Python을 배우고 원래 도구의 기능을 확장하는 동시에 DNS가 어떻게 작동하는지, 그리고 보안 평가 및 네트워크 문제 해결 과정에서 어떻게 사용될 수 있는지 다시 배우고 싶었습니다.
이 스크립트는 다음 기능을 제공합니다:
DNSRecon은 Python 3.12 이상이 필요합니다.
아직 설치하지 않았다면 uv를 설치하세요:
curl -LsSf https://astral.sh/uv/install.sh | sh
리포지토리 클론:
git clone https://github.com/darkoperator/dnsrecon.git
cd dnsrecon
의존성 설치 및 가상 환경 생성:
uv sync
DNSRecon 실행:
uv run dnsrecon
개발 의존성 설치:
uv sync --extra dev
테스트 실행:
uv run pytest
린트 및 포맷팅 실행:
uv run ruff check
uv run ruff format
DNSRecon은 SPF (-s) 및/또는 WHOIS (-w) 데이터에서 표준 열거 중 발견된 넷블록을 확장하기 위해 Shodan을 사용할 수 있습니다.
수동적 Shodan 보강 (SPF + WHOIS 넷블록 사용):
uv run dnsrecon -d example.com -t std -s -w --shodan --shodan-key "$SHODAN_API_KEY"
Shodan 결과의 능동적 검증 (호스트를 다시 리졸브하여 쿼리된 넷블록과 여전히 일치하는지 확인):
uv run dnsrecon -d example.com -t std -s -w --shodan --shodan-active --shodan-key "$SHODAN_API_KEY"
--shodan-key 대신 환경 변수를 통해 API 키를 설정할 수도 있습니다:
export SHODAN_API_KEY="your-shodan-api-key"
uv run dnsrecon -d example.com -t std -s -w --shodan
REST API 시작:
uv run restdnsrecon
Shodan 확장을 활성화하여 /general_enum 호출:
curl -s \
-H "X-Shodan-Api-Key: $SHODAN_API_KEY" \
"http://127.0.0.1:5000/general_enum?domain=example.com&do_spf=true&do_whois=true&do_shodan=true"
API에서 능동적 검증 활성화:
curl -s \
-H "X-Shodan-Api-Key: $SHODAN_API_KEY" \
"http://127.0.0.1:5000/general_enum?domain=example.com&do_spf=true&do_whois=true&do_shodan=true&shodan_active=true"
REST API thread_num 값은 1..100으로 제한됩니다. API wordlist 매개변수는 dnsrecon/data에 번들된 파일이나 플랫폼 경로 구분자를 사용하여 DNSRECON_WORDLIST_DIRS에 나열된 디렉토리 아래의 파일을 참조할 수 있습니다. 전용 단어 목록 디렉토리만 구성하십시오. DNSRECON_WORDLIST_DIRS를 /, 홈 디렉토리 또는 민감한 파일이 포함된 다른 위치와 같은 광범위한 경로로 설정하지 마십시오.
export DNSRECON_WORDLIST_DIRS="/opt/dnsrecon-wordlists:/srv/shared-wordlists"