Skip to content

Commit

Permalink
Merge pull request #232 from secynic/dev
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
secynic authored Feb 2, 2019
2 parents ad6cbc6 + 52b97a9 commit b5d634d
Show file tree
Hide file tree
Showing 33 changed files with 247 additions and 261 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
language: python
sudo: required
dist: xenial
python:
- 2.6
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6
- 3.7
install:
- pip install --upgrade setuptools
- pip install --upgrade pip
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then pip install -r requirements/python2.txt; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.3* ]]; then pip install -r requirements/python3.txt; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.4* ]]; then pip install -r requirements/python3.txt; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.5* ]]; then pip install -r requirements/python3.txt; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.6* ]]; then pip install -r requirements/python3.txt; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install -r requirements/python3.txt; fi
- pip install coveralls
- pip install codeclimate-test-reporter
- pip install -e .
Expand Down
16 changes: 16 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Changelog
=========

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)
------------------

Expand Down
8 changes: 1 addition & 7 deletions CLI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Usage
ipwhois_cli.py [-h] [--whois] [--exclude_nir] [--json] [--hr]
[--show_name] [--colorize] [--timeout TIMEOUT]
[--proxy_http "PROXY_HTTP"]
[--proxy_https "PROXY_HTTPS"] [--disallow_permutations]
[--proxy_https "PROXY_HTTPS"]
[--inc_raw] [--retry_count RETRY_COUNT]
[--asn_alts "ASN_ALTS"] [--asn_methods "ASN_METHODS"]
[--extra_org_map "EXTRA_ORG_MAP"]
Expand Down Expand Up @@ -60,12 +60,6 @@ IPWhois settings:
The proxy HTTPS address passed to
request.ProxyHandler. User auth can be passed like
"https://user:pass@192.168.0.1:443"
--disallow_permutations
Disable additional methods if DNS lookups to Cymru
fail. This is the opposite of the ipwhois
allow_permutations, in order to enable
allow_permutations by default in the CLI. *WARNING*
deprecated in favor of new argument asn_methods.

Common settings (RDAP & Legacy Whois):
--inc_raw Include the raw whois results in the output.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Guidelines
- Follow the `Google docstring style guide
<https://google.github.io/styleguide/pyguide.html#Comments>`_ for
comments
- Must be compatible with Python 2.6, 2.7, and 3.3+
- Must be compatible with Python 2.7 and 3.4+
- Break out reusable code to functions
- Make your code easy to read and comment where necessary
- Reference the GitHub issue number in the description (e.g., Issue #01)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2017 Philip Hane
Copyright (c) 2013-2019 Philip Hane
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
26 changes: 15 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ipwhois
: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.6%2C%202.7%2C%203.3+-blue.svg
.. 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
Expand Down Expand Up @@ -45,11 +45,10 @@ Features
* 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.6+ and 3.3+ supported
* Python 2.7 and 3.4+ supported
* Useful set of utilities
* Experimental bulk query support
* BSD license
* 100% core code coverage (See '# pragma: no cover' for exclusions)
* Human readable field translations
* Full CLI for IPWhois with optional ANSI colored console output.

Expand Down Expand Up @@ -97,18 +96,12 @@ https://ipwhois.readthedocs.io/en/latest/UPGRADING.html
Dependencies
============

Python 2.6::

dnspython
ipaddr
argparse (required only for CLI)

Python 2.7::

dnspython
ipaddr

Python 3.3+::
Python 3.4+::

dnspython

Expand Down Expand Up @@ -180,7 +173,7 @@ Input
| allow_permutations | bool | Allow net.Net() to use additional methods if |
| | | DNS lookups to Cymru fail. *WARNING* |
| | | deprecated in favor of new argument |
| | | asn_methods. Defaults to True. |
| | | asn_methods. Defaults to False. |
+--------------------+--------+-----------------------------------------------+

RDAP (HTTP)
Expand All @@ -199,6 +192,17 @@ 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
Expand Down
10 changes: 10 additions & 0 deletions UPGRADING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ any changes that may affect user experience when upgrading to a new release.
This page is new as of version 1.0.0. Any information on older versions is
likely missing or incomplete.

******
v1.1.0
******

- Exceptions now inherit a new BaseIpwhoisException rather than Exception
- Removed support for Python 2.6/3.3, added support for 3.7
- Removed the disallow_permutations argument from ipwhois_cli.py. Use
ans_methods instead.
- Fixed deprecation warnings in core code

******
v1.0.0
******
Expand Down
4 changes: 2 additions & 2 deletions ipwhois/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2013-2017 Philip Hane
# Copyright (c) 2013-2019 Philip Hane
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -26,4 +26,4 @@
from .net import Net
from .ipwhois import IPWhois

__version__ = '1.0.0'
__version__ = '1.1.0'
29 changes: 15 additions & 14 deletions ipwhois/asn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2013-2017 Philip Hane
# Copyright (c) 2013-2019 Philip Hane
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -371,7 +371,7 @@ def parse_fields_http(self, response, extra_org_map=None):
log.debug('No networks found')
net_list = []

for n in net_list:
for n in reversed(net_list):

try:

Expand All @@ -383,10 +383,15 @@ def parse_fields_http(self, response, extra_org_map=None):

log.debug('Could not parse ASN registry via HTTP: '
'{0}'.format(str(e)))
raise ASNRegistryError('ASN registry lookup failed.')
continue

break

if not asn_data['asn_registry']:

log.debug('Could not parse ASN registry via HTTP')
raise ASNRegistryError('ASN registry lookup failed.')

except ASNRegistryError:

raise
Expand Down Expand Up @@ -475,9 +480,7 @@ def lookup(self, inc_raw=False, retry_count=3, asn_alts=None,

else:

# Python 2.6 doesn't support set literal expressions, use explicit
# set() instead.
if set(['dns', 'whois', 'http']).isdisjoint(asn_methods):
if {'dns', 'whois', 'http'}.isdisjoint(asn_methods):

raise ValueError('methods argument requires at least one of '
'dns, whois, http.')
Expand Down Expand Up @@ -508,7 +511,7 @@ def lookup(self, inc_raw=False, retry_count=3, asn_alts=None,
asn_data_list = []
for asn_entry in response:

asn_data_list.append(self._parse_fields_dns(
asn_data_list.append(self.parse_fields_dns(
str(asn_entry)))

# Iterate through the parsed ASN results to find the
Expand Down Expand Up @@ -541,7 +544,7 @@ def lookup(self, inc_raw=False, retry_count=3, asn_alts=None,
try:

response = self._net.get_asn_whois(retry_count)
asn_data = self._parse_fields_whois(
asn_data = self.parse_fields_whois(
response) # pragma: no cover
break

Expand All @@ -557,7 +560,7 @@ def lookup(self, inc_raw=False, retry_count=3, asn_alts=None,
response = self._net.get_asn_http(
retry_count=retry_count
)
asn_data = self._parse_fields_http(response,
asn_data = self.parse_fields_http(response,
extra_org_map)
break

Expand Down Expand Up @@ -839,9 +842,7 @@ def lookup(self, asn=None, inc_raw=False, retry_count=3, response=None,

else:

# Python 2.6 doesn't support set literal expressions, use explicit
# set() instead.
if set(['whois', 'http']).isdisjoint(asn_methods):
if {'whois', 'http'}.isdisjoint(asn_methods):

raise ValueError('methods argument requires at least one of '
'whois, http.')
Expand Down Expand Up @@ -915,7 +916,7 @@ def lookup(self, asn=None, inc_raw=False, retry_count=3, response=None,
results['raw'] = response

nets = []
nets_response = self._get_nets_radb(response, is_http)
nets_response = self.get_nets_radb(response, is_http)

nets.extend(nets_response)

Expand All @@ -935,7 +936,7 @@ def lookup(self, asn=None, inc_raw=False, retry_count=3, response=None,

section_end = nets[index + 1]['start']

temp_net = self._parse_fields(
temp_net = self.parse_fields(
response,
fields['radb']['fields'],
section_end,
Expand Down
6 changes: 3 additions & 3 deletions ipwhois/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@

# General information about the project.
project = 'ipwhois'
copyright = '2013-2017, Philip Hane'
copyright = '2013-2019, Philip Hane'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.0.0'
version = '1.1.0'
# The full version, including alpha/beta/rc tags.
release = '1.0.0'
release = '1.1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
18 changes: 8 additions & 10 deletions ipwhois/examples/elastic_search/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,20 @@ I do not re-distribute the GeoLite2 database. For geolite2 data, download the
GeoLite2 database GeoLite2-City.mmdb and place in the data directory:
https://dev.maxmind.com/geoip/geoip2/geolite2/

.. note::

I have not updated the kibana.json since the ES 5.5.1 example. --kimport
and --kexport will not work with it for ES 6.x.

Dependencies
============

Tested using::

ElasticSearch 5.5.1
Kibana 5.5.1

Python 2.6 (requirements26.txt - geopy is not supported)::

ipwhois
elasticsearch
geoip2
argparse
ElasticSearch 6.6.0
Kibana 6.6.0

Python 2.7, 3.3+ (requirements.txt)::
Python 2.7, 3.4+ (requirements.txt)::

ipwhois
elasticsearch
Expand Down
Loading

0 comments on commit b5d634d

Please sign in to comment.