A simple Python CLI + library for looking up ASNs by IP or AS number. Uses BBOT.IO API.
Actively maintained. Last release 3 weeks ago. A safe choice.
pip install asndbREADME as published on PyPI with version 1.1.1.
ASNDB
A simple Python CLI + library for instant lookup of ASN data by IP address, AS number, or organization. Uses BBOT.IO API (asndb.api.bbot.io).
ASNs are automatically cached for instant lookups and minimal network traffic.
Installation
uv tool install asndb
# or quick run with uvx
uvx asndb
# or using pip
pip install asndb
Usage (CLI)
Note: anonymous queries are limited to 10/minute. If you need more, you can purchase an API key at the BBOT.IO Developer Portal. Export the key as an environment variable:
export BBOT_IO_API_KEY=<your_api_key>
IP Lookup
asndb ip 1.1.1.1
Output:
{
"ip": "1.1.1.1",
"asn": 13335,
"asn_name": "CLOUDFLARENET",
"org": "Cloudflare, Inc.",
"org_id": "CLOUD14-ARIN",
"country": "US",
"rir": "ARIN",
"subnets": null
}
To include subnets in the response, use the --include-subnets / -s flag:
asndb ip -s 1.1.1.1
Output:
{
"ip": "1.1.1.1",
"asn": 13335,
"asn_name": "CLOUDFLARENET",
"org": "Cloudflare, Inc.",
"org_id": "CLOUD14-ARIN",
"country": "US",
"rir": "ARIN",
"subnets": [
"1.0.0.0/24",
"1.1.1.0/24",
"..."
]
}