=======
ipwhois
=======
.. image:: https://coveralls.io/repos/github/secynic/ipwhois/badge.svg?branch=
master
:target: https://coveralls.io/github/secynic/ipwhois?branch=master
.. image:: https://img.shields.io/github/issues-raw/secynic/ipwhois
:target: https://github.com/secynic/ipwhois/issues
.. image:: https://codeclimate.com/github/secynic/ipwhois/badges/issue_count.svg
:target: https://codeclimate.com/github/secynic/ipwhois
.. image:: https://img.shields.io/badge/license-BSD%202--Clause-blue.svg
:target: https://github.com/secynic/ipwhois/tree/master/LICENSE.txt
.. image:: https://img.shields.io/badge/python-2.7%2C%203.4+-blue.svg
:target: https://docs.python.org
.. image:: https://img.shields.io/badge/docs-latest-green.svg?style=flat
:target: https://ipwhois.readthedocs.io/en/latest
.. image:: https://img.shields.io/badge/docs-dev-yellow.svg?style=flat
:target: https://ipwhois.readthedocs.io/en/dev
Summary
=======
ipwhois is a Python package focused on retrieving and parsing whois data
for IPv4 and IPv6 addresses.
.. note::
If you are experiencing latency issues, it is likely related to rate
limiting. Rate limiting is based on your source IP, which may be a problem
with multiple users behind the same proxy. Additionally, LACNIC implements
aggressive rate limiting. Experimental bulk query support is new as of
v1.0.0.
Features
========
* Parses a majority of whois fields in to a standard dictionary
* IPv4 and IPv6 support
* Supports RDAP queries (recommended method, see:
https://tools.ietf.org/html/rfc7483)
* Proxy support for RDAP queries
* Supports legacy whois protocol queries
* Referral whois support for legacy whois protocol
* Recursive network parsing for IPs with parent/children networks listed
* National Internet Registry support for JPNIC and KRNIC
* Supports IP to ASN and ASN origin queries
* Python 2.7 and 3.4+ supported
* Useful set of utilities
* Experimental bulk query support
* BSD license
* Human readable field translations
* Full CLI for IPWhois with optional ANSI colored console output.
Links
=====
Documentation
-------------
GitHub latest
^^^^^^^^^^^^^
https://ipwhois.readthedocs.io/en/latest
GitHub dev
^^^^^^^^^^
https://ipwhois.readthedocs.io/en/dev
Examples
--------
https://github.com/secynic/ipwhois/tree/master/ipwhois/examples
Github
------
https://github.com/secynic/ipwhois
Pypi
----
https://pypi.org/project/ipwhois
Changes
-------
https://ipwhois.readthedocs.io/en/latest/CHANGES.html
Upgrade Notes
-------------
https://ipwhois.readthedocs.io/en/latest/UPGRADING.html
Dependencies
============
Python 2.7::
dnspython
ipaddr
defusedxml
Python 3.4+::
dnspython
defusedxml
Installing
==========
Latest release from PyPi::
pip install --upgrade ipwhois
GitHub - Stable::
pip install -e git+https://github.com/secynic/ipwhois@master#egg=ipwhois
GitHub - Dev::
pip install -e git+https://github.com/secynic/ipwhois@dev#egg=ipwhois
Firewall Ports
==============
ipwhois needs some outbound firewall ports opened from your host/server.
:ASN (DNS): 53/tcp
:ASN (Whois): 43/tcp
:ASN (HTTP):
80/tcp
443/tcp (Pending)
:RDAP (HTTP):
80/tcp
443/tcp (Pending)
:NIR (HTTP):
80/tcp
443/tcp (KRNIC)
:Legacy Whois: 43/tcp
:Get Host: 43/tcp
API
===
IPWhois (main class)
--------------------
ipwhois.IPWhois is the base class for wrapping RDAP and Legacy Whois lookups.
Instantiate this object, then call one of the lookup functions:
`RDAP (HTTP) - IPWhois.lookup_rdap() <#rdap-http>`_
OR
`Legacy Whois - IPWhois.lookup_whois() <#legacy-whois>`_
Input
^^^^^
+--------------------+--------+-----------------------------------------------+
| **Key** |**Type**| **Description** |
+--------------------+--------+-----------------------------------------------+
| address | str | An IPv4 or IPv6 address as a string, integer, |
| | | IPv4Address, or IPv6Address. |
+--------------------+--------+-----------------------------------------------+
| timeout | int | The default timeout for socket connections |
| | | in seconds. Defaults to 5. |
+--------------------+--------+-----------------------------------------------+
| proxy_opener | object | The urllib.request.OpenerDirector request for |
| | | proxy support or None. |
+--------------------+--------+-----------------------------------------------+
RDAP (HTTP)
-----------
IPWhois.lookup_rdap() is the recommended lookup method. RDAP provides a
far better data structure than legacy whois and REST lookups (previous
implementation). RDAP queries allow for parsing of contact information and
details for users, organizations, and groups. RDAP also provides more detailed
network information.
RDAP documentation:
https://ipwhois.readthedocs.io/en/latest/RDAP.html
Legacy Whois
------------
.. note::
Legacy Whois output is different from RDAP. See the below JSON outputs for
a comparison:
Legacy Whois:
https://ipwhois.readthedocs.io/en/latest/WHOIS.html#basic-usage
RDAP:
https://ipwhois.readthedocs.io/en/latest/RDAP.html#basic-usage
Legacy Whois documentation:
https://ipwhois.readthedocs.io/en/latest/WHOIS.html
National Internet Registries
----------------------------
This library now supports NIR lookups for JPNIC and KRNIC. Previously, Whois
and RDAP data for Japan and South Korea was restricted. NIR lookups scrape
these national registries directly for the data restricted from regional
internet registries. NIR queries are enabled by default via the inc_nir
argument in the IPWhois.lookup_*() functions.
https://ipwhois.readthedocs.io/en/latest/NIR.html
Autonomous System Numbers
-------------------------
This library now supports ASN origin lookups via Whois and HTTP.
IP ASN functionality was moved to its own parser API (IPASN).
There is no CLI for these yet.
https://ipwhois.readthedocs.io/en/latest/ASN.html
Utilities
---------
Utilities documentation:
https://ipwhois.readthedocs.io/en/latest/UTILS.html
Scripts
-------
CLI documentation:
https://ipwhois.readthedocs.io/en/latest/CLI.html
Experimental Functions
----------------------
.. caution::
Functions in experimental.py contain new functionality that has not yet
been widely tested. Bulk lookup support contained here can result in
significant system/network resource utilization. Additionally, abuse of
this functionality may get you banned by the various services queried by
this library. Use at your own discretion.
Experimental functions documentation:
https://ipwhois.readthedocs.io/en/latest/EXPERIMENTAL.html
Contributing
============
https://ipwhois.readthedocs.io/en/latest/CONTRIBUTING.html
IP Reputation Support
=====================
This feature is under consideration. Take a look at TekDefense's Automater:
`TekDefense-Automater <https://github.com/1aN0rmus/TekDefense-Automater>`_
Domain Support
==============
There are no plans for domain whois support in this project.
Look at Sven Slootweg's
`python-whois <https://github.com/joepie91/python-whois>`_ for a library with
domain support.
Special Thanks
==============
Thank you JetBrains for the `PyCharm <https://www.jetbrains.com/pycharm/>`_
open source support!
Thank you Chris Wells (`@cdubz <https://github.com/cdubz>`_) for your
extensive testing on the experimental functions!
Last but not least, thank you to all the issue submitters and contributors.
Changelog
=========
1.3.0 (2024-10-15)
------------------
- Fixed deprecated query method of dnspython (#294 - monoidic)
- Upgrade dnspython (#303)
- Added requirement for defusedxml for security (#306)
- Added support for Python up to 3.12
- Remove reserved IANA 198.97.38.0/24 (#315)
- Fix for ASN queries against RADB for RIPE source (#317)
- Temporary (move to config later) hardcoding of user agent for ASN origin
lookup to avoid 403
- Updated to HTTPS where applicable (#307)
- Updated ARIN bootstrap URL (#300)
- Close sockets on exception to avoid warnings
- Move tests from assertEquals to assertEqual
- Fix for local domain searches with ASN (#324)
- Added get_recursive argument (-r) for IPWhois.lookup_whois() and
ipwhois.net.Net.get_whois() (#295)
1.2.0 (2020-09-17)
------------------
- Removed deprecated functions: asn.IPASN._parse_fields_http,
asn.IPASN._parse_fields_dns, asn.IPASN._parse_fields_whois,
asn.ASNOrigin._parse_fields, asn.ASNOrigin._get_nets_radb,
net.Net.lookup_asn, whois.Whois._parse_fields, whois.Whois._get_nets_arin
whois.Whois._get_nets_lacnic, whois.Whois._get_nets_other,
nir.NIRWhois._parse_fields, nir.NIRWhois._get_nets_jpnic
nir.NIRWhois._get_nets_krnic, nir.NIRWhois._get_contact (#230)
- Removed deprecated asn_alts parameter (#230)
- Removed deprecated allow_permutations parameter (#230)
- Fixed ASNOrigin lookups (#216)
- Fixed bug in ASNOrigin lookups when multiple asn_methods provided (#216)
- Fixed bug in KRNIC queries due to a change in their service (#243)
- Fixed bug in experimental.bulk_lookup_rdap where only the last
result was returned (#262 - ameidatou)
- Fixed deprecation warnings due to invalid escape sequences
(#272 - tirkarthi)
- Fixed bug in root and sub-entities not getting queried/data (#247)
- Fixed NIR datetime parsing issue if only date is returned (#284)
- Added new argument root_ent_check to IPWhois.lookup_rdap and
RDAP.lookup. Set this to False to revert to old functionality - missing data,
but less queries (#247)
- Added support for Python 3.8 (#267)
- Fixed travis build warnings (#268)
- Pinned requirements (#274)
- Added ip_failed_total key to stats dictionary in
experimental.bulk_lookup_rdap (#235)
- Added ipv4_generate_random and ipv6_generate_random to utils CLI (#236)
- Added documentation note for ASN data (#278)
1.1.0 (2019-02-01)
------------------
- Exceptions now inherit a new BaseIpwhoisException rather than Exception
(#205 - Darkheir)
- Fixed list output for generate_examples.py (#196)
- Fixed bug in ASN HTTP lookup where the ARIN results were reversed, and
parsing would fail on the first item (#220)
- Removed support for Python 2.6/3.3, added support for 3.7 (#221)
- Fixed deprecation warnings in core code (#203 - cstranex)
- Fixed bug in host argument for elastic_search.py example (#202)
- Set user agent in elastic_search.py example to avoid default user agent
- Updated elastic_search.py example for ES 6.6.0
- Readme update for RDAP vs Legacy Whois output (#204)
- Removed the disallow_permutations argument from ipwhois_cli.py (#226)
1.0.0 (2017-07-30)
------------------
- Deprecated asn_alts, allow_permutations in favor of new asn_methods (#158)
- Added new exception ASNOriginLookupError (#158)
- KRNIC lookups changed to HTTPS (#166)
- Added experimental functions - get_bulk_asn_whois, bulk_lookup_rdap (#134)
- Fixed bug in NIR lookups that caused addresses with multi-line contacts to
error (#172 - kwheeles)
- Added IANA Reserved CIDR 198.97.38.0/24 to ipv4_is_defined (#174)
- Fixed bug in RDAP notices/remarks parsing that would omit partial entries
missing one or more of title, description, links (#176)
- Added new return key asn_description via verbose ASN DNS lookup support and
modified ASN whois lookups. New argument get_asn_description (#176)
- Fixed some test function naming errors
- Added new generators to utils.py: ipv4_generate_random and
ipv6_generate_random (#183)
- Moved upgrade notes to new UPGRADING.rst
- Deprecated unnecessary protected class functions, changed to public in
asn.py, nir.py, and whois.py (#184)
- net.Net.get_host(), utils.ipv4_is_defined(), and utils.ipv6_is_defined now
return namedtuple instead of tuple.
- Changed docstrings to Google standard for better napoleon parsing (#185)
- Removed deprecated IPWhois.lookup() - This was moved to
IPWhois.lookup_whois()
- Fixed 'nets'->'range' bug for legacy whois CIDR net_range values (#188)
- Fixed a bug in IPASN/Net that caused the ASN result to vary if Cymru has
more than one ASN listed for an IP (#190)
- Updated ElasticSearch example for ES v5.5.1 (#138)
0.15.1 (2017-02-16)
-------------------
- Fixed IPv6 parsing for ASN origin lookups and added tests (#162 - ti-mo)
- Fixed recursive role parsing at depths greater than 0 (#161 - cdubz)
0.15.0 (2017-02-02)
-------------------
- Python 3.3+ dnspython3 requirement changed to dnspython (#155)
- Added ASN origin lookup support (#149)
- Moved ASN parsing from net.Net.get_asn_*() to new class asn.IPASN.
The original functions now return the raw query (#157)
- net.Net.lookup_asn() is deprecated in favor of asn.IPASN.lookup() (#157)
- Added new exception ASNParseError (#157)
- Fixed rate-limiting exception handling for when HTTP errors are returned
rather than JSON errors (rikonor - #144)
- Fixed rate-limit infinite recursion bug for legacy whois (rikonor - #144)
- Fixed bug in net.Net.get_http_raw() that would pass the encoded form_data on
retry rather than the original argument.
- Removed nose requirements and fixed travis.yml for updated pip
- Documentation updates
- Code style tweaks
- Updated tests and version info for Python 3.6
- Added basic stress tests (#144)
- Minor tweaks to existing tests
0.14.0 (2016-08-29)
-------------------
- Changed legacy whois emails output type to list (#133)
- Fixed retry count non-decrementing infinite loop in
ipwhois.net.Net.get_whois() (issue #125 - krader1961)
- Added new function ipwhois.net.Net.get_http_raw() and tests (#67)
- Added National Internet Registry (JPNIC, KRNIC) support (#67). Enabled by
default in IPWhois.lookup_*(). Disable by passing inc_nir=False. Optionally,
lower level code can call nir.NIRWhois(). This enhancement results in extra
network queries, but more detailed information for NIRs.
- Added utils CLI (ipwhois_utils_cli.py) - #121. Installed to your environments
Scripts dir. This is a wrapper for utils.py.
- Documentation improvements (#123)
- kw arg readability (#115)
- Replaced usage of args with script_args in ipwhois_cli.py
- Minor optimization in whois.py and online/test_whois.py
- Added coveralls integration and re-enabled online tests with Travis CI
- Added Read the Docs support (#132)
- Added documentation (Sphinx) requirements.txt (#132)
- Fixed test imports
- Added --json argument (output in JSON format) to ipwhois_cli.py (#135)
0.13.0 (2016-04-18)
-------------------
- Added events_actor parsing for RDAP results.
- Added example for caching data via Redis (#81)
- Added normalization (human-readable field information) in hr.py (#47)
- README word wrap fix (#102)
- Fixed bug in exception handling for ASN HTTP lookups.
- Fixed bug in IPWhois.lookup_rdap() that caused ASN HTTP lookup responses to
be used in place of RDAP responses.
- Added new function Net.get_asn_http() and migrated code from
Net.lookup_asn() + new tests.
- Fixed bug in ASN HTTP fallback lookups for DNIC (#108).
- Added new parameter extra_org_map in Net.get_asn_http(), Net.lookup_asn(),
and IPWhois.lookup*() (#108).
- Fixed _RDAPCommon.summarize_notices() None check - changed len() to all().
- Added CLI (ipwhois_cli.py) - #46. Installed to your environments Scripts dir.
This is a wrapper for ipwhois.py (IPWhois). Utils CLI will be in a future
release (#121).
- Documentation split up and added more detail (#81).
0.12.0 (2016-03-28)
-------------------
- Added headers parameter to ipwhois.Net.get_http_json() (issue #98).
- Fixed ASN HTTP lookup (fallback) Accept headers (issue #98).
- Fixed HTTP decoding, set to utf-8 (italomaia - issue #97)
- IPWhois.lookup() deprecated (issue #96), and will be removed in a future
release (TBD). Use IPWhois.lookup_whois() instead.
- Added rate_limit_timeout parameter (issue #99) to Net.get_http_json(),
IPWhois.lookup_rdap(), and RDAP.lookup(). New exception HTTPRateLimitError.
- Added new parameter asn_alts to Net.lookup_asn(), IPWhois.lookup_rdap() and
IPWhois.lookup(). Takes a list of lookup types to attempt if the
ASN dns lookup fails. Allow permutations must be enabled. Defaults to all
['whois', 'http'] (issue #93).
- Fixed socket exception handling in Net.get_http_json() for Python 2.6.
- Fixed assertIsInstance for Python 2.6 tests (issue #100). Implemented
unittest._formatMessage and unittest.util.safe_repr for Python 2.6.
- Moved TestCommon to tests\\__init__.py to avoid duplicate code.
- Replaced remaining % with str.format (issue #95).
0.11.2 (2016-02-25)
-------------------
- Added allow_permutations parameter (bool) to net.Net() and ipwhois.IPWhois()
to allow alternate ASN lookups if DNS lookups fail. (FirefighterBlu3)
- Fixed ASN DNS resolver timeout/retry_count support. Retry count is used as a
multiplier of timeout, to determine a limetime interval. (FirefighterBlu3)
- Fixed bug where remarks would return None if missing a title.
- Added CONTRIBUTING.rst
- Added tests
0.11.1 (2015-12-17)
-------------------
- Re-added CIDR calculation for RDAP lookups.
- Improved tests - core code coverage now 100%. See '# pragma: no cover' for
exclusions. A few bugs were identified in the process, detailed below.
- Moved IP zero stripping from rdap._RDAPNetwork.parse() to new helper function
utils.ipv4_lstrip_zeros().
- Moved CIDR calculation from rdap._RDAPNetwork.parse() to new helper function
utils.calculate_cidr().
- Fixed utils.ipv4_is_defined() if statement ordering for RFC 1918 conflict.
- Fixed utils.ipv6_is_defined() if statement ordering for Unspecified and
Loopback (conflict with Reserved).
- Added is_offline parameter to whois.Whois.lookup() primarily for testing.
- Fixed bug in whois.Whois._parse_fields() that attempted to parse 'val2' of
regex, which is no longer used. Also fixed the expected Exception to be
IndexError.
- Fixed bug in ipwhois.IPWhois.lookup() where the argument order was mixed up,
causing referral lookups to be skipped when get_referral=True.
- Fixed bug in rdap._RDAPCommon.summarize_notices() output for links.
- Fixed bug in root entity iteration exception handling in rdap.RDAP.lookup().
0.11.0 (2015-11-02)
-------------------
- Support for REST lookups replaced with RDAP.
- Split code for a more structured system (net, whois, rdap, exceptions).
- Tests match the data new structure.
- Split tests for online and offline testing.
- Performance enhancements for parsing.
- Added an optional bootstrap parameter for RDAP lookups, in order to replace
ASN lookups or use both. Will default to False. Afrinic is currently not
supported, so I would not use this for now. ARIN acknowledged my issue
for this, and will be adding support back in for Afrinic bootstrap.
- Added field_list parameter (inclusion list) for WHOIS lookups.
- Added logging.
- Added examples directory.
0.10.3 (2015-08-14)
-------------------
- Fixed LACNIC lookup_rws() queries, since they switched to RDAP. This is
temporary to get it working until the major library transition to RDAP and
new parsed formatting is complete.
0.10.2 (2015-05-19)
-------------------
- Fixed APNIC parsing for updated field.
- Fixed datetime parsing and validation when Zulu (Z) is appended.
- Added RIPE parsing for created and updated fields (whois and RWS).
- Removed unnecessary parentheses in IPWhois class declaration.
- Some documentation and comment tweaking to work with Sphinx.
- Minor PEP 8 tweaks.
0.10.1 (2015-02-09)
-------------------
- Fixed setup.py bug.
0.10.0 (2015-02-09)
-------------------
- Added .csv support for country code source. You can no longer download
country code information from iso.org.
- Added support for IPv4Address or IPv6Address as the address arg in IPWhois.
- Fixed file open encoding bug. Moved from open to io.open.
- Fixed parameter in IPWhois ip defined checks.
- Fixed TestIPWhois.test_ip_invalid() assertions.
Raw data
{
"_id": null,
"home_page": "https://github.com/secynic/ipwhois",
"name": "ipwhois",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Python, WHOIS, RWhois, Referral Whois, ASN, IP Address, IP, IPv4, IPv6, , IETF, REST, Arin, Ripe, Apnic, Lacnic, Afrinic, NIC, National Information, Center, RDAP, RIR, Regional Internet Registry, NIR, National Internet, Registry, ASN origin, Origin",
"author": "Philip Hane",
"author_email": "secynic@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ed/e9/f1dd533366b5809494d0ee0d39db2e0806388c52c25b1dcff2e0794a51d8/ipwhois-1.3.0.tar.gz",
"platform": null,
"description": "=======\nipwhois\n=======\n\n.. image:: https://coveralls.io/repos/github/secynic/ipwhois/badge.svg?branch=\n master\n :target: https://coveralls.io/github/secynic/ipwhois?branch=master\n.. image:: https://img.shields.io/github/issues-raw/secynic/ipwhois\n :target: https://github.com/secynic/ipwhois/issues\n.. image:: https://codeclimate.com/github/secynic/ipwhois/badges/issue_count.svg\n :target: https://codeclimate.com/github/secynic/ipwhois\n.. image:: https://img.shields.io/badge/license-BSD%202--Clause-blue.svg\n :target: https://github.com/secynic/ipwhois/tree/master/LICENSE.txt\n.. image:: https://img.shields.io/badge/python-2.7%2C%203.4+-blue.svg\n :target: https://docs.python.org\n.. image:: https://img.shields.io/badge/docs-latest-green.svg?style=flat\n :target: https://ipwhois.readthedocs.io/en/latest\n.. image:: https://img.shields.io/badge/docs-dev-yellow.svg?style=flat\n :target: https://ipwhois.readthedocs.io/en/dev\n\nSummary\n=======\n\nipwhois is a Python package focused on retrieving and parsing whois data\nfor IPv4 and IPv6 addresses.\n\n.. note::\n\n If you are experiencing latency issues, it is likely related to rate\n limiting. Rate limiting is based on your source IP, which may be a problem\n with multiple users behind the same proxy. Additionally, LACNIC implements\n aggressive rate limiting. Experimental bulk query support is new as of\n v1.0.0.\n\nFeatures\n========\n\n* Parses a majority of whois fields in to a standard dictionary\n* IPv4 and IPv6 support\n* Supports RDAP queries (recommended method, see:\n https://tools.ietf.org/html/rfc7483)\n* Proxy support for RDAP queries\n* Supports legacy whois protocol queries\n* Referral whois support for legacy whois protocol\n* Recursive network parsing for IPs with parent/children networks listed\n* National Internet Registry support for JPNIC and KRNIC\n* Supports IP to ASN and ASN origin queries\n* Python 2.7 and 3.4+ supported\n* Useful set of utilities\n* Experimental bulk query support\n* BSD license\n* Human readable field translations\n* Full CLI for IPWhois with optional ANSI colored console output.\n\nLinks\n=====\n\nDocumentation\n-------------\n\nGitHub latest\n^^^^^^^^^^^^^\n\nhttps://ipwhois.readthedocs.io/en/latest\n\nGitHub dev\n^^^^^^^^^^\n\nhttps://ipwhois.readthedocs.io/en/dev\n\nExamples\n--------\n\nhttps://github.com/secynic/ipwhois/tree/master/ipwhois/examples\n\nGithub\n------\n\nhttps://github.com/secynic/ipwhois\n\nPypi\n----\n\nhttps://pypi.org/project/ipwhois\n\nChanges\n-------\n\nhttps://ipwhois.readthedocs.io/en/latest/CHANGES.html\n\nUpgrade Notes\n-------------\n\nhttps://ipwhois.readthedocs.io/en/latest/UPGRADING.html\n\nDependencies\n============\n\nPython 2.7::\n\n dnspython\n ipaddr\n defusedxml\n\nPython 3.4+::\n\n dnspython\n defusedxml\n\nInstalling\n==========\n\nLatest release from PyPi::\n\n pip install --upgrade ipwhois\n\nGitHub - Stable::\n\n pip install -e git+https://github.com/secynic/ipwhois@master#egg=ipwhois\n\nGitHub - Dev::\n\n pip install -e git+https://github.com/secynic/ipwhois@dev#egg=ipwhois\n\nFirewall Ports\n==============\n\nipwhois needs some outbound firewall ports opened from your host/server.\n\n:ASN (DNS): 53/tcp\n:ASN (Whois): 43/tcp\n:ASN (HTTP):\n 80/tcp\n\n 443/tcp (Pending)\n:RDAP (HTTP):\n 80/tcp\n\n 443/tcp (Pending)\n:NIR (HTTP):\n 80/tcp\n\n 443/tcp (KRNIC)\n:Legacy Whois: 43/tcp\n:Get Host: 43/tcp\n\nAPI\n===\n\nIPWhois (main class)\n--------------------\n\nipwhois.IPWhois is the base class for wrapping RDAP and Legacy Whois lookups.\nInstantiate this object, then call one of the lookup functions:\n\n`RDAP (HTTP) - IPWhois.lookup_rdap() <#rdap-http>`_\nOR\n`Legacy Whois - IPWhois.lookup_whois() <#legacy-whois>`_\n\nInput\n^^^^^\n\n+--------------------+--------+-----------------------------------------------+\n| **Key** |**Type**| **Description** |\n+--------------------+--------+-----------------------------------------------+\n| address | str | An IPv4 or IPv6 address as a string, integer, |\n| | | IPv4Address, or IPv6Address. |\n+--------------------+--------+-----------------------------------------------+\n| timeout | int | The default timeout for socket connections |\n| | | in seconds. Defaults to 5. |\n+--------------------+--------+-----------------------------------------------+\n| proxy_opener | object | The urllib.request.OpenerDirector request for |\n| | | proxy support or None. |\n+--------------------+--------+-----------------------------------------------+\n\nRDAP (HTTP)\n-----------\n\nIPWhois.lookup_rdap() is the recommended lookup method. RDAP provides a\nfar better data structure than legacy whois and REST lookups (previous\nimplementation). RDAP queries allow for parsing of contact information and\ndetails for users, organizations, and groups. RDAP also provides more detailed\nnetwork information.\n\nRDAP documentation:\n\nhttps://ipwhois.readthedocs.io/en/latest/RDAP.html\n\nLegacy Whois\n------------\n\n.. note::\n\n Legacy Whois output is different from RDAP. See the below JSON outputs for\n a comparison:\n\n Legacy Whois:\n https://ipwhois.readthedocs.io/en/latest/WHOIS.html#basic-usage\n\n RDAP:\n https://ipwhois.readthedocs.io/en/latest/RDAP.html#basic-usage\n\nLegacy Whois documentation:\n\nhttps://ipwhois.readthedocs.io/en/latest/WHOIS.html\n\nNational Internet Registries\n----------------------------\n\nThis library now supports NIR lookups for JPNIC and KRNIC. Previously, Whois\nand RDAP data for Japan and South Korea was restricted. NIR lookups scrape\nthese national registries directly for the data restricted from regional\ninternet registries. NIR queries are enabled by default via the inc_nir\nargument in the IPWhois.lookup_*() functions.\n\nhttps://ipwhois.readthedocs.io/en/latest/NIR.html\n\nAutonomous System Numbers\n-------------------------\n\nThis library now supports ASN origin lookups via Whois and HTTP.\n\nIP ASN functionality was moved to its own parser API (IPASN).\n\nThere is no CLI for these yet.\n\nhttps://ipwhois.readthedocs.io/en/latest/ASN.html\n\nUtilities\n---------\n\nUtilities documentation:\n\nhttps://ipwhois.readthedocs.io/en/latest/UTILS.html\n\nScripts\n-------\n\nCLI documentation:\n\nhttps://ipwhois.readthedocs.io/en/latest/CLI.html\n\nExperimental Functions\n----------------------\n\n.. caution::\n\n Functions in experimental.py contain new functionality that has not yet\n been widely tested. Bulk lookup support contained here can result in\n significant system/network resource utilization. Additionally, abuse of\n this functionality may get you banned by the various services queried by\n this library. Use at your own discretion.\n\nExperimental functions documentation:\n\nhttps://ipwhois.readthedocs.io/en/latest/EXPERIMENTAL.html\n\nContributing\n============\n\nhttps://ipwhois.readthedocs.io/en/latest/CONTRIBUTING.html\n\nIP Reputation Support\n=====================\n\nThis feature is under consideration. Take a look at TekDefense's Automater:\n\n`TekDefense-Automater <https://github.com/1aN0rmus/TekDefense-Automater>`_\n\nDomain Support\n==============\n\nThere are no plans for domain whois support in this project.\n\nLook at Sven Slootweg's\n`python-whois <https://github.com/joepie91/python-whois>`_ for a library with\ndomain support.\n\nSpecial Thanks\n==============\n\nThank you JetBrains for the `PyCharm <https://www.jetbrains.com/pycharm/>`_\nopen source support!\n\nThank you Chris Wells (`@cdubz <https://github.com/cdubz>`_) for your\nextensive testing on the experimental functions!\n\nLast but not least, thank you to all the issue submitters and contributors.\n\nChangelog\n=========\n\n1.3.0 (2024-10-15)\n------------------\n\n- Fixed deprecated query method of dnspython (#294 - monoidic)\n- Upgrade dnspython (#303)\n- Added requirement for defusedxml for security (#306)\n- Added support for Python up to 3.12\n- Remove reserved IANA 198.97.38.0/24 (#315)\n- Fix for ASN queries against RADB for RIPE source (#317)\n- Temporary (move to config later) hardcoding of user agent for ASN origin\n lookup to avoid 403\n- Updated to HTTPS where applicable (#307)\n- Updated ARIN bootstrap URL (#300)\n- Close sockets on exception to avoid warnings\n- Move tests from assertEquals to assertEqual\n- Fix for local domain searches with ASN (#324)\n- Added get_recursive argument (-r) for IPWhois.lookup_whois() and\n ipwhois.net.Net.get_whois() (#295)\n\n1.2.0 (2020-09-17)\n------------------\n\n- Removed deprecated functions: asn.IPASN._parse_fields_http,\n asn.IPASN._parse_fields_dns, asn.IPASN._parse_fields_whois,\n asn.ASNOrigin._parse_fields, asn.ASNOrigin._get_nets_radb,\n net.Net.lookup_asn, whois.Whois._parse_fields, whois.Whois._get_nets_arin\n whois.Whois._get_nets_lacnic, whois.Whois._get_nets_other,\n nir.NIRWhois._parse_fields, nir.NIRWhois._get_nets_jpnic\n nir.NIRWhois._get_nets_krnic, nir.NIRWhois._get_contact (#230)\n- Removed deprecated asn_alts parameter (#230)\n- Removed deprecated allow_permutations parameter (#230)\n- Fixed ASNOrigin lookups (#216)\n- Fixed bug in ASNOrigin lookups when multiple asn_methods provided (#216)\n- Fixed bug in KRNIC queries due to a change in their service (#243)\n- Fixed bug in experimental.bulk_lookup_rdap where only the last \n result was returned (#262 - ameidatou)\n- Fixed deprecation warnings due to invalid escape sequences \n (#272 - tirkarthi)\n- Fixed bug in root and sub-entities not getting queried/data (#247)\n- Fixed NIR datetime parsing issue if only date is returned (#284)\n- Added new argument root_ent_check to IPWhois.lookup_rdap and\n RDAP.lookup. Set this to False to revert to old functionality - missing data,\n but less queries (#247)\n- Added support for Python 3.8 (#267)\n- Fixed travis build warnings (#268)\n- Pinned requirements (#274)\n- Added ip_failed_total key to stats dictionary in\n experimental.bulk_lookup_rdap (#235)\n- Added ipv4_generate_random and ipv6_generate_random to utils CLI (#236)\n- Added documentation note for ASN data (#278)\n\n1.1.0 (2019-02-01)\n------------------\n\n- Exceptions now inherit a new BaseIpwhoisException rather than Exception\n (#205 - Darkheir)\n- Fixed list output for generate_examples.py (#196)\n- Fixed bug in ASN HTTP lookup where the ARIN results were reversed, and\n parsing would fail on the first item (#220)\n- Removed support for Python 2.6/3.3, added support for 3.7 (#221)\n- Fixed deprecation warnings in core code (#203 - cstranex)\n- Fixed bug in host argument for elastic_search.py example (#202)\n- Set user agent in elastic_search.py example to avoid default user agent\n- Updated elastic_search.py example for ES 6.6.0\n- Readme update for RDAP vs Legacy Whois output (#204)\n- Removed the disallow_permutations argument from ipwhois_cli.py (#226)\n\n1.0.0 (2017-07-30)\n------------------\n\n- Deprecated asn_alts, allow_permutations in favor of new asn_methods (#158)\n- Added new exception ASNOriginLookupError (#158)\n- KRNIC lookups changed to HTTPS (#166)\n- Added experimental functions - get_bulk_asn_whois, bulk_lookup_rdap (#134)\n- Fixed bug in NIR lookups that caused addresses with multi-line contacts to\n error (#172 - kwheeles)\n- Added IANA Reserved CIDR 198.97.38.0/24 to ipv4_is_defined (#174)\n- Fixed bug in RDAP notices/remarks parsing that would omit partial entries\n missing one or more of title, description, links (#176)\n- Added new return key asn_description via verbose ASN DNS lookup support and\n modified ASN whois lookups. New argument get_asn_description (#176)\n- Fixed some test function naming errors\n- Added new generators to utils.py: ipv4_generate_random and\n ipv6_generate_random (#183)\n- Moved upgrade notes to new UPGRADING.rst\n- Deprecated unnecessary protected class functions, changed to public in\n asn.py, nir.py, and whois.py (#184)\n- net.Net.get_host(), utils.ipv4_is_defined(), and utils.ipv6_is_defined now\n return namedtuple instead of tuple.\n- Changed docstrings to Google standard for better napoleon parsing (#185)\n- Removed deprecated IPWhois.lookup() - This was moved to\n IPWhois.lookup_whois()\n- Fixed 'nets'->'range' bug for legacy whois CIDR net_range values (#188)\n- Fixed a bug in IPASN/Net that caused the ASN result to vary if Cymru has\n more than one ASN listed for an IP (#190)\n- Updated ElasticSearch example for ES v5.5.1 (#138)\n\n0.15.1 (2017-02-16)\n-------------------\n\n- Fixed IPv6 parsing for ASN origin lookups and added tests (#162 - ti-mo)\n- Fixed recursive role parsing at depths greater than 0 (#161 - cdubz)\n\n0.15.0 (2017-02-02)\n-------------------\n\n- Python 3.3+ dnspython3 requirement changed to dnspython (#155)\n- Added ASN origin lookup support (#149)\n- Moved ASN parsing from net.Net.get_asn_*() to new class asn.IPASN.\n The original functions now return the raw query (#157)\n- net.Net.lookup_asn() is deprecated in favor of asn.IPASN.lookup() (#157)\n- Added new exception ASNParseError (#157)\n- Fixed rate-limiting exception handling for when HTTP errors are returned\n rather than JSON errors (rikonor - #144)\n- Fixed rate-limit infinite recursion bug for legacy whois (rikonor - #144)\n- Fixed bug in net.Net.get_http_raw() that would pass the encoded form_data on\n retry rather than the original argument.\n- Removed nose requirements and fixed travis.yml for updated pip\n- Documentation updates\n- Code style tweaks\n- Updated tests and version info for Python 3.6\n- Added basic stress tests (#144)\n- Minor tweaks to existing tests\n\n0.14.0 (2016-08-29)\n-------------------\n\n- Changed legacy whois emails output type to list (#133)\n- Fixed retry count non-decrementing infinite loop in\n ipwhois.net.Net.get_whois() (issue #125 - krader1961)\n- Added new function ipwhois.net.Net.get_http_raw() and tests (#67)\n- Added National Internet Registry (JPNIC, KRNIC) support (#67). Enabled by\n default in IPWhois.lookup_*(). Disable by passing inc_nir=False. Optionally,\n lower level code can call nir.NIRWhois(). This enhancement results in extra\n network queries, but more detailed information for NIRs.\n- Added utils CLI (ipwhois_utils_cli.py) - #121. Installed to your environments\n Scripts dir. This is a wrapper for utils.py.\n- Documentation improvements (#123)\n- kw arg readability (#115)\n- Replaced usage of args with script_args in ipwhois_cli.py\n- Minor optimization in whois.py and online/test_whois.py\n- Added coveralls integration and re-enabled online tests with Travis CI\n- Added Read the Docs support (#132)\n- Added documentation (Sphinx) requirements.txt (#132)\n- Fixed test imports\n- Added --json argument (output in JSON format) to ipwhois_cli.py (#135)\n\n0.13.0 (2016-04-18)\n-------------------\n\n- Added events_actor parsing for RDAP results.\n- Added example for caching data via Redis (#81)\n- Added normalization (human-readable field information) in hr.py (#47)\n- README word wrap fix (#102)\n- Fixed bug in exception handling for ASN HTTP lookups.\n- Fixed bug in IPWhois.lookup_rdap() that caused ASN HTTP lookup responses to\n be used in place of RDAP responses.\n- Added new function Net.get_asn_http() and migrated code from\n Net.lookup_asn() + new tests.\n- Fixed bug in ASN HTTP fallback lookups for DNIC (#108).\n- Added new parameter extra_org_map in Net.get_asn_http(), Net.lookup_asn(),\n and IPWhois.lookup*() (#108).\n- Fixed _RDAPCommon.summarize_notices() None check - changed len() to all().\n- Added CLI (ipwhois_cli.py) - #46. Installed to your environments Scripts dir.\n This is a wrapper for ipwhois.py (IPWhois). Utils CLI will be in a future\n release (#121).\n- Documentation split up and added more detail (#81).\n\n0.12.0 (2016-03-28)\n-------------------\n\n- Added headers parameter to ipwhois.Net.get_http_json() (issue #98).\n- Fixed ASN HTTP lookup (fallback) Accept headers (issue #98).\n- Fixed HTTP decoding, set to utf-8 (italomaia - issue #97)\n- IPWhois.lookup() deprecated (issue #96), and will be removed in a future\n release (TBD). Use IPWhois.lookup_whois() instead.\n- Added rate_limit_timeout parameter (issue #99) to Net.get_http_json(),\n IPWhois.lookup_rdap(), and RDAP.lookup(). New exception HTTPRateLimitError.\n- Added new parameter asn_alts to Net.lookup_asn(), IPWhois.lookup_rdap() and\n IPWhois.lookup(). Takes a list of lookup types to attempt if the\n ASN dns lookup fails. Allow permutations must be enabled. Defaults to all\n ['whois', 'http'] (issue #93).\n- Fixed socket exception handling in Net.get_http_json() for Python 2.6.\n- Fixed assertIsInstance for Python 2.6 tests (issue #100). Implemented\n unittest._formatMessage and unittest.util.safe_repr for Python 2.6.\n- Moved TestCommon to tests\\\\__init__.py to avoid duplicate code.\n- Replaced remaining % with str.format (issue #95).\n\n0.11.2 (2016-02-25)\n-------------------\n\n- Added allow_permutations parameter (bool) to net.Net() and ipwhois.IPWhois()\n to allow alternate ASN lookups if DNS lookups fail. (FirefighterBlu3)\n- Fixed ASN DNS resolver timeout/retry_count support. Retry count is used as a\n multiplier of timeout, to determine a limetime interval. (FirefighterBlu3)\n- Fixed bug where remarks would return None if missing a title.\n- Added CONTRIBUTING.rst\n- Added tests\n\n0.11.1 (2015-12-17)\n-------------------\n\n- Re-added CIDR calculation for RDAP lookups.\n- Improved tests - core code coverage now 100%. See '# pragma: no cover' for\n exclusions. A few bugs were identified in the process, detailed below.\n- Moved IP zero stripping from rdap._RDAPNetwork.parse() to new helper function\n utils.ipv4_lstrip_zeros().\n- Moved CIDR calculation from rdap._RDAPNetwork.parse() to new helper function\n utils.calculate_cidr().\n- Fixed utils.ipv4_is_defined() if statement ordering for RFC 1918 conflict.\n- Fixed utils.ipv6_is_defined() if statement ordering for Unspecified and\n Loopback (conflict with Reserved).\n- Added is_offline parameter to whois.Whois.lookup() primarily for testing.\n- Fixed bug in whois.Whois._parse_fields() that attempted to parse 'val2' of\n regex, which is no longer used. Also fixed the expected Exception to be\n IndexError.\n- Fixed bug in ipwhois.IPWhois.lookup() where the argument order was mixed up,\n causing referral lookups to be skipped when get_referral=True.\n- Fixed bug in rdap._RDAPCommon.summarize_notices() output for links.\n- Fixed bug in root entity iteration exception handling in rdap.RDAP.lookup().\n\n0.11.0 (2015-11-02)\n-------------------\n\n- Support for REST lookups replaced with RDAP.\n- Split code for a more structured system (net, whois, rdap, exceptions).\n- Tests match the data new structure.\n- Split tests for online and offline testing.\n- Performance enhancements for parsing.\n- Added an optional bootstrap parameter for RDAP lookups, in order to replace\n ASN lookups or use both. Will default to False. Afrinic is currently not\n supported, so I would not use this for now. ARIN acknowledged my issue\n for this, and will be adding support back in for Afrinic bootstrap.\n- Added field_list parameter (inclusion list) for WHOIS lookups.\n- Added logging.\n- Added examples directory.\n\n0.10.3 (2015-08-14)\n-------------------\n\n- Fixed LACNIC lookup_rws() queries, since they switched to RDAP. This is\n temporary to get it working until the major library transition to RDAP and\n new parsed formatting is complete.\n\n0.10.2 (2015-05-19)\n-------------------\n\n- Fixed APNIC parsing for updated field.\n- Fixed datetime parsing and validation when Zulu (Z) is appended.\n- Added RIPE parsing for created and updated fields (whois and RWS).\n- Removed unnecessary parentheses in IPWhois class declaration.\n- Some documentation and comment tweaking to work with Sphinx.\n- Minor PEP 8 tweaks.\n\n0.10.1 (2015-02-09)\n-------------------\n\n- Fixed setup.py bug.\n\n0.10.0 (2015-02-09)\n-------------------\n\n- Added .csv support for country code source. You can no longer download\n country code information from iso.org.\n- Added support for IPv4Address or IPv6Address as the address arg in IPWhois.\n- Fixed file open encoding bug. Moved from open to io.open.\n- Fixed parameter in IPWhois ip defined checks.\n- Fixed TestIPWhois.test_ip_invalid() assertions.\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Retrieve and parse whois data for IPv4 and IPv6 addresses.",
"version": "1.3.0",
"project_urls": {
"Download": "https://github.com/secynic/ipwhois/tarball/master",
"Homepage": "https://github.com/secynic/ipwhois"
},
"split_keywords": [
"python",
" whois",
" rwhois",
" referral whois",
" asn",
" ip address",
" ip",
" ipv4",
" ipv6",
" ",
" ietf",
" rest",
" arin",
" ripe",
" apnic",
" lacnic",
" afrinic",
" nic",
" national information",
" center",
" rdap",
" rir",
" regional internet registry",
" nir",
" national internet",
" registry",
" asn origin",
" origin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6e8644183c90cb0103c400f0fde3042b7566a936479dc00b6de139dc34198d58",
"md5": "a8702d96b30d3732ae913955c5f3f807",
"sha256": "ad2cd7e7b8c81044fc8829bb4357bce6088c654a20f51f5d234fe6a99e0fbf90"
},
"downloads": -1,
"filename": "ipwhois-1.3.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "a8702d96b30d3732ae913955c5f3f807",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 70676,
"upload_time": "2024-10-15T08:03:44",
"upload_time_iso_8601": "2024-10-15T08:03:44.004008Z",
"url": "https://files.pythonhosted.org/packages/6e/86/44183c90cb0103c400f0fde3042b7566a936479dc00b6de139dc34198d58/ipwhois-1.3.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ede9f1dd533366b5809494d0ee0d39db2e0806388c52c25b1dcff2e0794a51d8",
"md5": "a0cd9e1513ceee405857cf8120a697f0",
"sha256": "11d59784b6350210c33e12301cc50cd1ebfbb0b12a7b0f97916e11d6661c4d5d"
},
"downloads": -1,
"filename": "ipwhois-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "a0cd9e1513ceee405857cf8120a697f0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 103721,
"upload_time": "2024-10-15T08:03:46",
"upload_time_iso_8601": "2024-10-15T08:03:46.220067Z",
"url": "https://files.pythonhosted.org/packages/ed/e9/f1dd533366b5809494d0ee0d39db2e0806388c52c25b1dcff2e0794a51d8/ipwhois-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-15 08:03:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "secynic",
"github_project": "ipwhois",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "ipwhois"
}