Skip to content

Commit

Permalink
Merge pull request #5 from secynic/rws
Browse files Browse the repository at this point in the history
Whois RWS support
  • Loading branch information
secynic committed Sep 13, 2013
2 parents cd1e681 + a2c4b25 commit f2b7258
Show file tree
Hide file tree
Showing 4 changed files with 397 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

0.1.5 (2013-09-13)
------------------

- Added set_proxy() function for proxy support in Whois-RWS queries.
- Added IPWhois.lookup_rws() function for Whois-RWS queries.

0.1.4 (2013-09-12)
------------------

Expand Down
71 changes: 59 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Usage Examples

Typical usage::

>>>> import ipwhois
>>>> from pprint import pprint
>>>> obj = ipwhois.IPWhois("74.125.225.229")
>>>> results = obj.lookup(False)
>>>> pprint(results)
{
'asn': '15169',
>>>> 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',
Expand All @@ -34,6 +34,42 @@ Typical usage::
'raw': None
}
REST (HTTP)::

>>>> import ipwhois
>>>> from pprint import pprint
>>>> obj = ipwhois.IPWhois("74.125.225.229")
>>>> results = obj.lookup_rws(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.0.0.0/8',
'city': 'Chantilly',
'country': 'US',
'description': 'American Registry for Internet Numbers',
'name': 'NET74',
'state': 'VA'},
{'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
}

Proxy (Optional before ipwhois.IPWhois.lookup_rws())::

>>>> import ipwhois
>>>> ipwhois.set_proxy("192.168.0.1", "80", "some_username", "some_password")
Countries::

>>>> import ipwhois
Expand All @@ -44,6 +80,17 @@ Countries::
>>>> print(countries[results['nets'][0]['country']])

United States

Installing
==========

Latest version from PyPi::

pip install ipwhois

Latest version from GitHub::

pip install -e git+https://github.com/secynic/ipwhois@master#egg=ipwhois
Parsing
=======
Expand All @@ -54,7 +101,7 @@ Some IPs have parent networks listed. The parser attempts to recognize this, and

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

Future Plans
============
REST (HTTP)
===========

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.
IPWhois.lookup_rws() should be faster than IPWhois.lookup(), but may not be as reliable. APNIC, LACNIC, and AFRINIC do not have a Whois-RWS service yet. We have to rely on the Ripe RWS service, which does not contain all of the data we need.
Loading

0 comments on commit f2b7258

Please sign in to comment.