Skip to main content

Professional DNS lookup CLI with beautiful Rich output

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dnslookup_cli-0.1.1.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dnslookup_cli-0.1.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file dnslookup_cli-0.1.1.tar.gz.

File metadata

  • Download URL: dnslookup_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnslookup_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 62e1622c8cc44258cad06239ac440b2e08c19641426190520c6bc9e62896c472
MD5 4d8c1bbd14037e79036098933f7b9fb4
BLAKE2b-256 53a455b8c4706b7bb295d2dc12486c8c0adfac82f05d560c87d704c1986f810a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dnslookup_cli-0.1.1.tar.gz:

Publisher: publish-dns-lookup.yml on CarterPerez-dev/Cybersecurity-Projects

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dnslookup_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dnslookup_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnslookup_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60b405b014ace73d6d369102938ac1ca7fa1551691437b2b1d43b90073f27207
MD5 dabd5b27a38fcd0bc6011de14131d0ff
BLAKE2b-256 8e8f8d072e85d4ce3acf7d57458adda6affb5cab13bbe87834780c659700b0c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for dnslookup_cli-0.1.1-py3-none-any.whl:

Publisher: publish-dns-lookup.yml on CarterPerez-dev/Cybersecurity-Projects

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page