Skip to main content

IP Whois Resolution and Parsing

Project description

ipwhois is a simple package for retrieving and parsing whois data for IPv4 and IPv6 addresses. This code was quickly thrown together to demonstrate functionality, and is by no means optimized or fully featured.

This version requires Python 3.3 (for the ipaddress library) and dnspython3. Other Python version support is planned.

Typical usage:

>>>> import ipwhois
>>>> from pprint import pprint

>>>> obj = ipwhois.IPWhois("74.125.225.229")
>>>> results = obj.lookup(False)
>>>> pprint(results)

{
'asn': '15169',
    'asn_cidr': '74.125.225.0/24',
    'asn_country_code': 'US',
    'asn_date': '2007-03-13',
    'asn_registry': 'arin',
    'nets': [{'cidr': '74.125.0.0/16',
              'city': 'Mountain View',
              'country': 'US',
              'description': 'Google Inc.',
              'name': 'GOOGLE',
              'state': 'CA'}],
    'query': '74.125.225.229',
    'raw': None
    }

Parsing

Parsing is currently limited to CIDR, country, description, name, and state fields. This is assuming that those fields are present.

Some IPs have parent networks listed. The parser attempts to recognize this, and break the networks into individual dictionaries.

Sometimes, you will see whois information with multiple consecutive same name fields, e.g., Description: some textnDescription: more text. The parser will recognize this and the returned result will have these separated by ‘n’.

Future Plans

IPWhois.httplookup() - Allow parsing of Whois data via RWS feeds from the various NICs. This feature is useful when outbound port 43 is not available. Only ARIN and RIPE have Whois-RWS services at the time of this writing. Although RIPE does have a feature that integrates the other NICs, they are limited on the types of information that is allowed to be displayed. Additionally, as part of this feature, proxy support will also be added.

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

ipwhois-0.1.0.zip (12.5 kB view details)

Uploaded Source

File details

Details for the file ipwhois-0.1.0.zip.

File metadata

  • Download URL: ipwhois-0.1.0.zip
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ipwhois-0.1.0.zip
Algorithm Hash digest
SHA256 1b41f83bb1212952b1821378dbd9891f3f6ade34e90a4913dae2948741285ab3
MD5 aac4d8da01ff7b71020c0640e7290d38
BLAKE2b-256 24c1a0f8bde968c6de7d80029cb89b7eea8c36a7381ef22da514b088727eb7a3

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