A simple Python toolkit to check DNS records (NS, MX, TXT), DNSSEC status, WHOIS info, and SSL certificate details (including expiry date and days to expiry) for a list of domains or URLs.
This project provides scripts to analyze DNS, WHOIS, and SSL certificate information for domains and websites, supporting multiple output formats and batch processing.
- Checks if a domain exists
- Retrieves:
- NS (Name Server)
- MX (Mail Exchange)
- TXT (Text Records) — e.g., SPF, DKIM
- DNSSEC status (enabled or not)
- WHOIS info (registrar, registrant, creation/expiration dates, status, days to expiry)
- SSL certificate info (issuer, subject, not before, not after, days to expiry, serial number, version)
- Exports results as:
- Standard output (
stdout) - CSV file
- JSON file
- Standard output (
Install with:
pip install dnspython tqdm whoisAlternatively, to install all dependencies from the requirements.txt file:
pip install -r requirements.txtOr, using pipenv:
pipenv installpython check_dns.py --input domains.txt [OPTIONS]| Option | Description |
|---|---|
--input, -i |
Input file containing a list of domains |
--ns |
Retrieve NS records |
--mx |
Retrieve MX records |
--txt |
Retrieve TXT records |
--dnssec |
Check whether DNSSEC is enabled |
--format, -f |
Output format: stdout, csv, json (default: stdout) |
--output, -o |
Output filename (required if format is csv or json) |
The input file must contain one domain per line, for example:
example.com
google.com
invalid-domain.xyz
Print NS and DNSSEC to stdout:
python check_dns.py -i domains.txt --ns --dnssecExport MX and TXT records to JSON:
python check_dns.py -i domains.txt --mx --txt -f json -o output.jsonExport all to CSV:
python check_dns.py -i domains.txt --ns --mx --txt --dnssec -f csv -o results.csvpython check_whois.py -i domains_whois.txtOppure, senza file di input, passando i domini direttamente:
python check_whois.py example.com google.com| Option | Description |
|---|---|
--input, -i |
Input file containing a list of domains |
--format, -f |
Output format: stdout, csv, json (default: stdout) |
--output, -o |
Output filename (required if format is csv or json) |
domains |
List of domains to check if no input file is provided |
- domain
- registrar
- registrant
- creation_date
- expiration_date
- last_updated
- days_to_expiry
- status
Domain: example.com
Registrar: Example Registrar
Registrant: Example Org
Creation Date: 2000-01-01T00:00:00
Expiration Date: 2030-01-01T00:00:00
Days to Expiry: 1800
Status: active
Last Updated: 2024-01-01T00:00:00
python check_ssl.py -i urls.txtOppure, senza file di input, passando le URL direttamente:
python check_ssl.py https://example.com google.com| Option | Description |
|---|---|
--input, -i |
Input file containing a list of URLs |
--format, -f |
Output format: stdout, csv, json (default: stdout) |
--output, -o |
Output filename (required if format is csv or json) |
urls |
List of URLs to check if no input file is provided |
- hostname
- issuer
- subject
- not_before
- not_after
- days_to_expiry
- serial_number
- version
Host: example.com
Issuer: {'C': 'US', 'O': 'Let's Encrypt', 'CN': 'R3'}
Subject: {'C': 'US', 'ST': 'California', 'L': 'San Francisco', 'O': 'Example Inc', 'CN': 'example.com'}
Not Before: May 1 00:00:00 2025 GMT
Not After: Jul 30 23:59:59 2025 GMT
Days to Expiry: 55
Serial Number: 04A1B2C3D4E5F6
Version: 3
- If no records are found or the domain does not exist, the script marks it as:
NON-EXISTENT(domain does not resolve)ERROR(temporary or unknown DNS/WHOIS error)
- DNSSEC is checked by verifying the presence of
DSrecords in the parent zone. - WHOIS output fields may vary depending on the TLD and registry.
MIT License – feel free to use and adapt.