Skip to main content

DNS Lookup Tool

Professional DNS lookup CLI with beautiful Rich terminal output. Query DNS records, perform reverse lookups, trace resolution paths, and retrieve WHOIS information.

Features

  • Multi-Record Queries: Query A, AAAA, MX, NS, TXT, CNAME, SOA records
  • Reverse DNS: IP to hostname resolution
  • DNS Trace: Visualize the resolution path from root to authoritative servers
  • Batch Lookups: Query multiple domains concurrently
  • WHOIS Integration: Domain registration information
  • JSON Export: Machine-readable output for scripting
  • Beautiful Output: Color-coded tables, spinners, and tree visualizations

Installation

# Clone the repository
git clone https://github.com/CarterPerez-dev/Cybersecurity-Projects.git
cd PROJECTS/dns-lookup

# Install with uv
uv sync

# Or install with pip

python -m venv .venv

source .venv/bin/activate

pip install -e .

Usage

Basic DNS Query

# Query all record types
dnslookup query example.com

# Query specific record types
dnslookup query example.com --type A,MX,TXT

# Use custom DNS server
dnslookup query example.com --server 8.8.8.8

# Output as JSON
dnslookup query example.com --json

Reverse DNS Lookup

# IPv4
dnslookup reverse 8.8.8.8

# IPv6
dnslookup reverse 2606:4700:4700::1111

DNS Trace

Trace the resolution path from root servers to authoritative nameservers:

dnslookup trace example.com
dnslookup trace example.com --type MX

Batch Lookups

Query multiple domains from a file:

# Create a file with domains (one per line)
echo -e "google.com\ngithub.com\ncloudflare.com" > domains.txt

# Run batch lookup
dnslookup batch domains.txt

# Save results to JSON
dnslookup batch domains.txt --output results.json

WHOIS Lookup

dnslookup whois example.com
dnslookup whois google.com --json

Example Output

DNS Query

🌐 DNS Lookup: example.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

┌──────────────────────────────────────────┐
│ DNS Records                              │
├──────┬───────────────────────┬───────────┤
│ Type │ Value                 │ TTL       │
├──────┼───────────────────────┼───────────┤
│ A    │ 93.184.216.34         │ 1h        │
│ AAAA │ 2606:2800:220:1:...   │ 1h        │
│ MX   │ mail.example.com (10) │ 1d        │
│ NS   │ ns1.example.com       │ 2d        │
└──────┴───────────────────────┴───────────┘

✓ Found 8 records in 45ms

DNS Trace

🔍 DNS Trace: example.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🌍 DNS Resolution Path
├── [.] Root
│   └── → a.root-servers.net (198.41.0.4)
│       └── Referred to com. servers
├── [com.] TLD
│   └── → a.gtld-servers.net (192.5.6.30)
│       └── Referred to example.com NS
└── [example.com.] Authoritative
    └── → ns1.example.com (93.184.216.34)
        └── A: 93.184.216.34

✓ Resolution complete: 93.184.216.34

Development

# Install dev dependencies
just install-dev

# Run the tool
just run query example.com

# Run tests
just test

# Lint code
just lint

# Format code
just ruff-fix

# Run all checks
just ci

Available Commands

Command Description
just run *ARGS Run the CLI tool
just test Run test suite
just lint Run ruff linter
just ruff-fix Auto-fix and format
just mypy Type checking
just ci Run all checks
just clean Remove cache files

Few Examples

Screenshot_20251209_104948 Screenshot_20251209_105052

License

MIT License - See LICENSE for details.

Author

CarterPerez-dev

Metadata

Release files for dnslookup-cli 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dnslookup-cli 0.1.1
File Size Uploaded Provenance
dnslookup_cli-0.1.1.tar.gz 31.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dnslookup-cli 0.1.1
File Interpreter ABI Platform
dnslookup_cli-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 45.0 kB

Release files / dnslookup_cli-0.1.1.tar.gz

Download URL dnslookup_cli-0.1.1.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
62e1622c8cc44258cad06239ac440b2e08c19641426190520c6bc9e62896c472
BLAKE2b-256 checksum
How to use checksums
53a455b8c4706b7bb295d2dc12486c8c0adfac82f05d560c87d704c1986f810a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 9, 2025.

Transparency log

Release files / dnslookup_cli-0.1.1-py3-none-any.whl

Download URL dnslookup_cli-0.1.1-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60b405b014ace73d6d369102938ac1ca7fa1551691437b2b1d43b90073f27207
BLAKE2b-256 checksum
How to use checksums
8e8f8d072e85d4ce3acf7d57458adda6affb5cab13bbe87834780c659700b0c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 9, 2025.

Transparency log

Security for dnslookup-cli 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dnslookup_cli-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 9, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page