viewdns
CLI and Python library for every ViewDNS.info API endpoint
Overview
viewdns is a Python toolkit that covers every endpoint of the ViewDNS.info API — reverse IP, WHOIS, DNS records, port scanning, IP geolocation, spam-database lookups, and more. It works both as a command-line tool and as an importable library, prints readable tables by default, and also speaks JSON, TOON, and raw XML. The HTTP layer uses only the Python standard library.
Key Features
| Feature | Description |
|---|---|
| All 23 endpoints | Complete coverage of the ViewDNS.info API from a single interface |
| Table by default | Human-readable output rendered with prettytable |
| Multi-format | table, json, toon (Token-Oriented Object Notation), and raw xml |
| CLI + Library | Use as a command-line tool or a typed Python package |
| File downloads | Streams the gzip-compressed Newly Registered Domains feed as raw bytes |
| Typed & tested | Fully type-checked (mypy --strict), 100% test coverage, no mocks |
| Zero-dependency HTTP | Transport built on http.client from the standard library |
Supported Outputs
Structured data table (prettytable), json, toon
Passthrough xml (raw API payload)
File feeds newly-registered -> gzip bytes (redirect to a file)
Errors API errors rendered as a key/value table
Installation
From PyPI (Recommended)
pip install viewdns
Set your API key once (get one from your ViewDNS.info account):
export VIEWDNS=your_api_key
From Source
git clone https://github.com/seifreed/viewdns.git
cd viewdns
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e ".[dev]"
Quick Start
# Reverse IP lookup (table by default)
viewdns reverse-ip --host google.com
# WHOIS for a domain
viewdns whois --domain example.com
# DNS records of a given type
viewdns dns-record --domain example.com --recordtype MX
# Your account balance
viewdns account --action balance
Usage
Command Line Interface
# JSON output
viewdns ip-location --ip 8.8.8.8 --format json
# TOON output
viewdns dns-record --domain google.com --recordtype A --format toon
# Raw XML from the API
viewdns whois --domain example.com --format xml
# Download the gzip Newly Registered Domains feed
viewdns newly-registered --date 2026-08-14 > nrd.txt.gz
--format selects the output (table default, json, toon, xml);
--apikey overrides $VIEWDNS; --timeout sets the request timeout in
seconds. Global options work before or after the subcommand. Run
viewdns --help for the full command list.
Endpoints
| Command | API path | Required | Optional |
|---|---|---|---|
abuse-contact |
abuselookup |
domain |
|
account |
account |
action |
|
chinese-firewall |
chinesefirewall |
domain |
|
dns-propagation |
propagation |
domain |
|
dns-record |
dnsrecord |
domain |
recordtype |
free-email |
freeemail |
domain |
|
http-headers |
httpheaders |
domain |
|
ip-history |
iphistory |
domain |
|
ip-location |
iplocation |
ip |
|
iran-firewall |
iranfirewall |
siteurl |
|
mac-lookup |
maclookup |
mac |
|
newly-registered |
nrd |
date |
type |
ping |
ping/v2 |
host |
|
port-scan |
portscan |
host |
|
reverse-dns |
reversedns |
ip |
|
reverse-ip |
reverseip |
host |
page |
reverse-mx |
reversemx |
mx |
page |
reverse-ns |
reversens |
ns |
page |
reverse-whois |
reversewhois |
q |
page |
spam-db |
spamdblookup |
ip |
|
subdomains |
subdomains |
domain |
|
traceroute |
traceroute |
domain |
|
whois |
whois/v2 |
domain |
Format Flags
| Option | Description |
|---|---|
--format table |
Human-readable tables (default) |
--format json |
Pretty-printed JSON |
--format toon |
Token-Oriented Object Notation |
--format xml |
Raw XML payload from the API |
--apikey <key> |
API key (defaults to $VIEWDNS) |
--timeout <seconds> |
Request timeout |
Python Library
Basic Usage
from viewdns import ViewDNSClient
client = ViewDNSClient("your_api_key")
data = client.request("reverse-ip", host="google.com")
whois = client.request("whois", domain="example.com")
xml = client.request("ip-location", ip="9.9.9.9", output="xml")
request returns parsed JSON (a dict) by default, the decoded text for
output="xml", and raw bytes for endpoints that serve a downloadable file.
Transport failures and unparseable responses raise ViewDNSError; invalid
arguments raise ValueError. API-level problems (bad key, exhausted quota,
missing subscription) come back inside the response payload.
Downloading a File Feed
gz = client.request("newly-registered", date="2026-08-14") # bytes
with open("nrd.txt.gz", "wb") as f:
f.write(gz)
Rendering Responses
from viewdns import render
print(render(data, "table")) # or "json" / "toon"
Requirements
- Python 3.14+
- Runtime dependencies:
prettytable,python-toon - See pyproject.toml for the full list and dev extras
Development
pip install -e ".[dev]"
black --check . && ruff check . && mypy .
bandit -r viewdns && pip-audit
pytest
Tests run real code against the live API (no mocks) and require $VIEWDNS.
Contributing
Contributions are welcome.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support the Project
If this project is useful in your workflows, you can support development:
License
This project is licensed under the MIT license. See LICENSE.
Attribution
- Author: Marc Rivero López | @seifreed
- Repository: github.com/seifreed/viewdns
Built for practical DNS/OSINT research and security automation
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file viewdns-1.0.0.tar.gz.
File metadata
- Download URL: viewdns-1.0.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38c8de0bd13428faee6f0904bfdf836c46923aa64d19d3ecf433931454428f29
|
|
| MD5 |
b7a091b79340e936ec840e780137a036
|
|
| BLAKE2b-256 |
21e82bbf7716ad22971479f55f57986ef0c880f68b821cff4e31883c4274b3bd
|
Provenance
The following attestation bundles were made for viewdns-1.0.0.tar.gz:
Publisher:
release.yml on seifreed/viewdns
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
viewdns-1.0.0.tar.gz -
Subject digest:
38c8de0bd13428faee6f0904bfdf836c46923aa64d19d3ecf433931454428f29 - Sigstore transparency entry: 2490491121
- Sigstore integration time:
-
Permalink:
seifreed/viewdns@a4ab686aebb63225337d83e654370ae9c16bf00b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/seifreed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4ab686aebb63225337d83e654370ae9c16bf00b -
Trigger Event:
push
-
Statement type:
File details
Details for the file viewdns-1.0.0-py3-none-any.whl.
File metadata
- Download URL: viewdns-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60131f02181348e7bf274c204db55d15216767fdb6dcc3eb528cf8ece589c5a0
|
|
| MD5 |
0155c9c4f56f2c3e25901334863d29c2
|
|
| BLAKE2b-256 |
8b7aad4797ccf8b589aaef97024ce154c8828536cee48132ea678865d47676df
|
Provenance
The following attestation bundles were made for viewdns-1.0.0-py3-none-any.whl:
Publisher:
release.yml on seifreed/viewdns
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
viewdns-1.0.0-py3-none-any.whl -
Subject digest:
60131f02181348e7bf274c204db55d15216767fdb6dcc3eb528cf8ece589c5a0 - Sigstore transparency entry: 2490491321
- Sigstore integration time:
-
Permalink:
seifreed/viewdns@a4ab686aebb63225337d83e654370ae9c16bf00b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/seifreed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4ab686aebb63225337d83e654370ae9c16bf00b -
Trigger Event:
push
-
Statement type: