Skip to main content

BulkWhois provides a simple interface to several bulk whois servers. This allows you to look up the ASNs, AS names, country codes, and other assorted information very efficiently for a large number of IP addresses.

Currently implemented bulk whois servers are:

Cymru: BulkWhoisCymru Shadowserver: BulkWhoisShadowserver

Note that these whois servers generally only accept IPv4 IP addresses, not hostnames. IPv6 support is not widely supported by bulk whois servers at present, but will add in support once this becomes available.

So, it’s up to the caller to convert hostnames to IP addresses first. Anything which isn’t an IPv4 address generates a warning and is dropped before sending to the whois server.

Usage:

#!/usr/bin/env python

from bulkwhois.shadowserver import BulkWhoisShadowserver

bulk_whois = BulkWhoisShadowserver()
records = bulk_whois.lookup_ips(["212.58.246.91", "203.2.218.214"])

for record in records:
    print "\t".join([records[record]["ip"], records[record]["asn"],
                    records[record]["as_name"], records[record]["cc"]])

Installation

python setup.py install

Implementation

Current implementation assumes accessing a bulk whois server with a telnet-like interface. Generally, input takes the form of:

begin 192.168.0.1 192.168.0.2 end

Note that different bulk whois servers return different data, so better to choose one you’re happy with first and stick with it to keep things consistent.

For example, using different modules the sample code returns this:

BulkWhoisShadowServer

203.2.218.214 9342 ABCNET-AS AU 212.58.246.91 2818 BBC UK

BulkWhoisCymru

203.2.218.214 9342 ABCNET-AS-AP Australian Broadcasting Commission AU 212.58.246.91 2818 BBC BBC Internet Services, UK GB

Further information:

http://www.shadowserver.org/wiki/pmwiki.php/Services/IP-BGP http://www.team-cymru.org/Services/ip-to-asn.html

Metadata

Release files for BulkWhois 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BulkWhois 0.2.1
File Size Uploaded Provenance Actions
BulkWhois-0.2.1.tar.gz 5.2 kB Without provenance Details for BulkWhois-0.2.1.tar.gz

Release files / BulkWhois-0.2.1.tar.gz

Download URL BulkWhois-0.2.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f1e96ba9d08f4225ad691e16921e7c05aae05cf27eb6681d2fc09a9172d9453a
BLAKE2b-256 checksum
How to use checksums
54c7eae57374f68090f755406d49d25774c45dd41a5435ad176cd87ab6452f4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for BulkWhois 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

0.2.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page