Skip to main content

A CLI tool for DNS lookups, SSL inspection, and HTTP pinging

Project description

DNS Checker CLI

A powerful command-line tool for DNS lookups, SSL certificate inspection, and HTTP pinging.

Features

  • 🔍 DNS Record Lookup: Query A, AAAA, CNAME, MX, TXT records
  • 🔒 SSL Certificate Inspection: Detailed certificate information and expiration warnings
  • 📡 HTTP Ping: Real-time HTTP/HTTPS request monitoring with server IP change detection
  • 🎨 Rich Output: Visually rich terminal output
  • ⚙️ Custom Nameserver: Specify custom DNS servers for queries

Installation

Requirements

  • Python 3.7 or higher

Installation Steps

# Clone the repository
git clone <repository-url>
cd dns-checker-cli

# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # macOS/Linux
# or
venv\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

# Install in development mode
pip install -e .

Usage

DNS Record Lookup

Query DNS records for a domain.

# Basic usage
dns-checker dns example.com

# Use custom nameserver
dns-checker dns example.com --nameserver 8.8.8.8
dns-checker dns example.com -n 1.1.1.1

SSL Certificate Inspection

Query both DNS information and SSL certificate for a domain.

# Basic usage
dns-checker inspect example.com

# Use custom nameserver
dns-checker inspect example.com --nameserver 8.8.8.8

Output Information:

  • DNS records (A, AAAA, CNAME, MX, TXT)
  • SSL certificate issuer and subject
  • Certificate validity period
  • SAN (Subject Alternative Names)
  • Signature algorithm
  • Expiration warning (within 30 days)

HTTP Ping

Periodically send HTTP/HTTPS requests to monitor server status.

# Basic usage (1 second interval, infinite loop)
dns-checker httping https://example.com

# Specify interval (2 seconds)
dns-checker httping https://example.com --interval 2
dns-checker httping https://example.com -i 2

# Specify count (10 times)
dns-checker httping https://example.com --count 10
dns-checker httping https://example.com -c 10

# Use custom nameserver
dns-checker httping https://example.com --nameserver 8.8.8.8

# Force connection to specific IP (keep domain but change IP)
dns-checker httping https://naver.com --server 223.130.200.219
dns-checker httping https://example.com -s 93.184.216.34

# Combined usage
dns-checker httping https://example.com -i 2 -c 20 -n 8.8.8.8 -s 93.184.216.34

Output Information:

  • Response time (milliseconds)
  • HTTP status code
  • Server IP address
  • Content-Length (response size)
  • Content-Type (response type)
  • IP change detection (migration monitoring)
  • Forced IP connection indicator
  • Statistics (average/min/max response time, success rate)

Stop: Press Ctrl+C to stop and display statistics.

Usage Examples

Domain Migration Monitoring

# Monitor domain during migration to new server
dns-checker httping https://mysite.com -i 5

# Server IP changes will be highlighted

Test with Specific IP

# Request to specific IP while keeping domain as naver.com
# Host header remains naver.com, works with virtual host environments
dns-checker httping https://naver.com --server 223.130.200.219 -c 5

# Test new server before migration
dns-checker httping https://mysite.com --server 192.168.1.100 -c 10

DNS Propagation Check

# Check DNS records with multiple nameservers
dns-checker dns example.com -n 8.8.8.8
dns-checker dns example.com -n 1.1.1.1
dns-checker dns example.com -n 208.67.222.222

SSL Certificate Expiration Check

# Check certificate expiration date
dns-checker inspect example.com

# Warning displayed if expiring within 30 days

Options

Common Options

  • --help: Show help message
  • --version: Show version information

DNS Command Options

  • --nameserver, -n: Custom nameserver IP address

Inspect Command Options

  • --nameserver, -n: Custom nameserver IP address

HTTPing Command Options

  • --interval, -i: Request interval in seconds (default: 1)
  • --count, -c: Number of requests (infinite if not specified)
  • --nameserver, -n: Custom nameserver IP address
  • --server, -s: Force connection to specific server IP (keep domain but use specific IP)

Development

Development Environment Setup

# Install development dependencies
make dev

# Or manually
pip install -r requirements.txt
pip install pytest pytest-cov pytest-mock flake8 black
pip install -e .

Running Tests

# Using Makefile (recommended)
make test           # Run all tests
make test-cov       # Run tests with coverage

# Or run directly
pytest
pytest tests/test_dns_service.py
pytest --cov=dns_checker

Code Quality

make lint           # Run code linting
make format         # Format code
make verify         # Full verification (lint + tests)

Build and Deploy

make build          # Build package
make upload-test    # Upload to TestPyPI
make upload         # Upload to PyPI
make release        # Full release (test → build → upload)

For more details, see PYPI_UPLOAD_GUIDE.md.

Code Style

This project follows the PEP 8 style guide.

Dependencies

  • click>=8.0.0: CLI framework
  • dnspython>=2.0.0: DNS queries
  • cryptography>=3.4.0: SSL certificate parsing
  • requests>=2.25.0: HTTP requests
  • rich>=10.0.0: Terminal output formatting

License

MIT License

Contributing

Issues and pull requests are welcome!

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

dns_checker_cli-0.1.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

dns_checker_cli-0.1.1-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dns_checker_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for dns_checker_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7826a52248e0a8533504a026e5e9e267fefceedc054bb47fd6ae5be346833253
MD5 cb72b50a1a831eeefeda9fa6f2da38fd
BLAKE2b-256 682296b1a926b5ec3d291438afbc96d768c75745197b1c01408d523bd4952ba0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dns_checker_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b275c3b49ca36012cc257cca9a386175d1ae4fc9f547a128678472d37ddeae07
MD5 db1d930cf45693093470ae3daaf7bf39
BLAKE2b-256 3ff00828c87c93af54f329b9024427fa50f1033cfbbff9a8e143b88b4fe20a9b

See more details on using hashes here.

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