Skip to content

prenansantana/extract-zone-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dzone

Extract DNS zone files from any domain.

dzone queries authoritative nameservers and reconstructs a BIND-compatible zone file from public DNS records.

Install

Homebrew (macOS / Linux)

brew tap prenansantana/tap
brew install dzone

npx (no install)

npx dzone-cli example.com

npm (global)

npm install -g dzone-cli

Go

go install github.com/prenansantana/extract-zone-file@latest

Binary

Download from Releases — single binary, no dependencies.

Usage

# Extract all DNS records
dzone example.com

# Save to file
dzone example.com -o example.com.zone

# Filter specific record types
dzone example.com -t A,MX,TXT

# Use a specific DNS server
dzone example.com -s 1.1.1.1

Output

Standard BIND zone file format:

; Zone file for example.com
; Generated by dzone on 2026-03-04T15:30:00Z
; Queried server: a.iana-servers.net.:53 (authoritative)
; NOTE: Best-effort reconstruction via individual queries.

$ORIGIN example.com.
$TTL 300

; SOA Records
example.com.  86400  IN  SOA  ns1.example.com. admin.example.com. 2024010101 7200 3600 1209600 3600

; NS Records
example.com.  86400  IN  NS  ns1.example.com.
example.com.  86400  IN  NS  ns2.example.com.

; A Records
example.com.  300  IN  A  93.184.216.34

; MX Records
example.com.  300  IN  MX  10  mail.example.com.

; TXT Records
example.com.  300  IN  TXT  "v=spf1 -all"

Flags

Flag Description Default
-s DNS server to query auto-detect authoritative
-o Output file stdout
-t Record types (comma-separated) all
-try-axfr Attempt zone transfer first true
-v Show version

Supported Record Types

A, AAAA, CNAME, MX, NS, SOA, TXT, SRV, CAA, PTR

How It Works

  1. Discovers authoritative nameservers for the domain
  2. Attempts a zone transfer (AXFR) — works when allowed
  3. Falls back to querying each record type individually (concurrent)
  4. Discovers subdomains via Certificate Transparency (crt.sh) and queries each for CNAME records
  5. Formats results as a standard BIND zone file

Build

make build          # local binary
make build-all      # cross-compile (linux, darwin, windows)

Release

Releases are fully automated via GitHub Actions. To publish a new version:

git tag v0.3.0
git push origin v0.3.0

This automatically:

  1. Cross-compiles binaries for Linux, macOS, and Windows
  2. Creates a GitHub Release with all binaries
  3. Updates the Homebrew formula with new checksums
  4. Publishes the new version to npm

About

Extract DNS zone files from any domain.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors