Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.2.0 #289

Merged
merged 67 commits into from
Sep 17, 2020
Merged

1.2.0 #289

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
d419823
:bug: Regex not parsing response in `asn.py`
Oct 19, 2018
4861968
:white_check_mark: Fixed unit test
Oct 19, 2018
600b4b0
remove deprecated (#230)
secynic Feb 2, 2019
e95ec11
Merge pull request #233 from secynic/230/remove_deprecated
secynic Feb 2, 2019
aa2de4a
100% Coverage
Feb 4, 2019
1f14c58
Merge branch 'dev' into feature/216
secynic Feb 4, 2019
e947df6
Changes from secynic
Feb 5, 2019
e20c06e
Code Review Changes
Feb 11, 2019
b27953c
Make use of builtin sphinx napoleon extension
stanislavlevin Feb 16, 2019
fef22c1
Merge pull request #238 from stanislavlevin/fix_sph_napoleon
secynic Mar 1, 2019
fb5a541
Updated from upstream
May 17, 2019
3b11faa
Updated gitignore
May 17, 2019
de8b8df
Update to latest version
May 17, 2019
ebdeb4b
Merge branch 'dev' into feature/216
secynic Jul 29, 2019
153c402
Fixed changes
Jul 30, 2019
0816a27
Merge pull request #234 from hmajid2301/feature/216
secynic Jul 31, 2019
566dc3e
Fixed ASNOrigin lookups (#216)
secynic Jul 31, 2019
8992461
Merge pull request #242 from secynic/216/asn_origin_bug
secynic Jul 31, 2019
ba1bebd
Fixed bug in KRNIC queries due to a change in their service (#243)
secynic Aug 6, 2019
282fb01
Merge pull request #244 from secynic/243/krnic_fix
secynic Aug 7, 2019
05708cd
Fix issue where bulk_lookup_rdap() returns only one item result
Aug 10, 2020
b258ebd
Add test
Aug 11, 2020
a3253af
Add asn data to rdap results
Aug 11, 2020
fa9330b
Add asn data at the parent level
Aug 11, 2020
fe7dd4f
merge asn and rdap data into the results
Aug 12, 2020
c0b7c33
Merge pull request #263 from ameidatou/issue_262_bugfix
secynic Sep 2, 2020
40c69cc
Update changes for #262
secynic Sep 2, 2020
1a91654
Merge pull request #269 from secynic/secynic-262-changes
secynic Sep 2, 2020
2947969
Fix deprecation warnings due to invalid escape sequences.
tirkarthi Sep 11, 2020
a35ac3b
Merge pull request #272 from tirkarthi/fix-warnings-dev
secynic Sep 14, 2020
0516872
Fixed deprecation warnings due to invalid escape sequences
secynic Sep 14, 2020
2c72e08
Merge pull request #273 from secynic/secynic-changes-272
secynic Sep 14, 2020
00879c9
Added support for Python 3.8 (#267)
secynic Sep 14, 2020
67b9c89
38 regex fix attempt (#267)
secynic Sep 14, 2020
5bdc0dc
38 fix tests (#267)
secynic Sep 14, 2020
e3d85e9
38 fix tests 2 (#267)
secynic Sep 14, 2020
17039b8
38 fix tests 3 (#267)
secynic Sep 14, 2020
478477a
Merge pull request #275 from secynic/267/py38
secynic Sep 14, 2020
512efd3
Fixed travis build warnings (#268)
secynic Sep 14, 2020
777d34c
Merge pull request #276 from secynic/268/fix_travis
secynic Sep 14, 2020
70981ae
Pinned requirements (#274)
secynic Sep 14, 2020
0a41057
Merge pull request #277 from secynic/274/pin_requirements
secynic Sep 14, 2020
1f5ddcf
Added ip_failed_total to bulk_lookup_rdap (#235)
secynic Sep 15, 2020
c4e71b6
Fixed test for ip_failed_total (#235)
secynic Sep 15, 2020
38ad6ea
Merge pull request #279 from secynic/235/exp_failed_total
secynic Sep 15, 2020
3ffcdaf
Fixed bug in root and sub-entities not getting queried/data (#247)
secynic Sep 15, 2020
a54f2ba
Removed old permutations check
secynic Sep 15, 2020
dc4324e
Merge pull request #280 from secynic/247/bug_entity_depth
secynic Sep 15, 2020
a042870
Added ipv4_generate_random and ipv6_generate_random to utils CLI (#236)
secynic Sep 15, 2020
e7b2013
Fix metavars (#236)
secynic Sep 15, 2020
64685da
Merge pull request #281 from secynic/236/ip_gen_utils
secynic Sep 15, 2020
ac71f35
ipv4_generate_random and ipv6_generate_random docs (#236)
secynic Sep 15, 2020
c905a92
Merge pull request #282 from secynic/236/ip_gen_utils
secynic Sep 16, 2020
f499cb1
Added GitHub issues badge
secynic Sep 16, 2020
429fb0c
Added documentation note for ASN data (#278)
secynic Sep 16, 2020
d324428
Merge pull request #283 from secynic/278/docs
secynic Sep 16, 2020
50df6ef
Fixed NIR datetime parsing issue if only date is returned (#284)
secynic Sep 17, 2020
6a97235
Merge pull request #285 from secynic/284/NIR_datetime_parse
secynic Sep 17, 2020
4df5d37
Create python-publish-test.yml
secynic Sep 17, 2020
ba8f4b6
Merge branch 'dev' into secynic-gh-action-testpypi
secynic Sep 17, 2020
9f0aaef
Create python-publish.yml
secynic Sep 17, 2020
b3d9c4f
Merge branch 'dev' into secynic-gh-action-pypi
secynic Sep 17, 2020
843dda8
Merge pull request #286 from secynic/secynic-gh-action-testpypi
secynic Sep 17, 2020
e688107
Merge branch 'dev' into secynic-gh-action-pypi
secynic Sep 17, 2020
cf48a0d
Merge pull request #287 from secynic/secynic-gh-action-pypi
secynic Sep 17, 2020
40cf38a
Increment version 1.2.0
secynic Sep 17, 2020
915a907
Merge pull request #288 from secynic/1.2.0
secynic Sep 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[report]
show_missing = True
omit =
*/python?.?/*
*/site-packages/nose/*
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/python-publish-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload Python Package to Test PyPi

on: workflow_dispatch

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: secynic
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/*
28 changes: 28 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Upload Python Package to PyPi

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: secynic
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ nosetests.xml
.pydevproject

MANIFEST
.idea
.idea
.history
.vscode
.venv
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
language: python
sudo: required
os: linux
dist: xenial
python:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7
- 3.8
install:
- pip install --upgrade setuptools
- pip install --upgrade pip
Expand Down
31 changes: 19 additions & 12 deletions ASN.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ IP ASN Lookups
This is new functionality as of v0.15.0. This functionality was migrated from
net.Net and is still used by IPWhois.lookup*().

.. note::

Cymru ASN data should not be considered a primary source for data points
like country code.

Message from the Cymru site::

The country code, registry, and allocation date are all based on data
obtained directly from the regional registries including: ARIN, RIPE,
AFRINIC, APNIC, LACNIC. The information returned relating to these
categories will only be as accurate as the data present in the RIR
databases.

IMPORTANT NOTE: Country codes are likely to vary significantly from
actual IP locations, and we must strongly advise that the IP to ASN
mapping tool not be used as an IP geolocation (GeoIP) service.

https://team-cymru.com/community-services/ip-asn-mapping/

.. _ip-asn-input:

IP ASN Input
Expand All @@ -24,12 +43,6 @@ Arguments supported by IPASN.lookup().
| | | resets, etc. are encountered. |
| | | Defaults to 3. |
+------------------------+--------+-------------------------------------------+
| asn_alts | list | Additional lookup types to attempt if the |
| | | ASN dns lookup fails. Allow permutations |
| | | must be enabled. If None, defaults to all |
| | | ['whois', 'http']. *WARNING* deprecated |
| | | in favor of new argument asn_methods. |
+------------------------+--------+-------------------------------------------+
| extra_org_map | dict | Dictionary mapping org handles to RIRs. |
| | | This is for limited cases where ARIN |
| | | REST (ASN fallback HTTP lookup) does not |
Expand Down Expand Up @@ -157,12 +170,6 @@ Arguments supported by ASNOrigin.lookup().
| | | ['description', 'maintainer', 'updated', |
| | | 'source']. If None, defaults to all. |
+------------------------+--------+-------------------------------------------+
| asn_alts | list | Additional lookup types to attempt if the |
| | | ASN dns lookup fails. Allow permutations |
| | | must be enabled. If None, defaults to all |
| | | ['http']. *WARNING* deprecated |
| | | in favor of new argument asn_methods. |
+------------------------+--------+-------------------------------------------+
| asn_methods | list | ASN lookup types to attempt, in order. If |
| | | None, defaults to all ['whois', 'http']. |
+------------------------+--------+-------------------------------------------+
Expand Down
34 changes: 33 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
Changelog
=========

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

Expand Down Expand Up @@ -217,4 +249,4 @@ Changelog
- 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.
- Fixed TestIPWhois.test_ip_invalid() assertions.
40 changes: 33 additions & 7 deletions CLI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ipwhois_cli.py [-h] [--whois] [--exclude_nir] [--json] [--hr]
[--proxy_http "PROXY_HTTP"]
[--proxy_https "PROXY_HTTPS"]
[--inc_raw] [--retry_count RETRY_COUNT]
[--asn_alts "ASN_ALTS"] [--asn_methods "ASN_METHODS"]
[--asn_methods "ASN_METHODS"]
[--extra_org_map "EXTRA_ORG_MAP"]
[--skip_asn_description] [--depth COLOR_DEPTH]
[--excluded_entities "EXCLUDED_ENTITIES"] [--bootstrap]
Expand Down Expand Up @@ -66,12 +66,6 @@ Common settings (RDAP & Legacy Whois):
--retry_count RETRY_COUNT
The number of times to retry in case socket errors,
timeouts, connection resets, etc. are encountered.
--asn_alts ASN_ALTS
A comma delimited list of additional lookup types to
attempt if the ASN dns lookup fails. Allow
permutations must be enabled. Defaults to all:
"whois,http". *WARNING* deprecated in favor of new
argument asn_methods.
--asn_methods ASN_METHODS
List of ASN lookup types to attempt, in order.
Defaults to all ['dns', 'whois', 'http'].
Expand Down Expand Up @@ -174,6 +168,12 @@ optional arguments:
--ipv6_is_defined IPADDRESS
Check if an IPv6 address is defined (in a reserved
address range).
--ipv4_generate_random TOTAL
Generate random, unique IPv4 addresses that are not
defined (can be looked up using ipwhois).
--ipv6_generate_random TOTAL
Generate random, unique IPv6 addresses that are not
defined (can be looked up using ipwhois).
--unique_everseen ITERABLE
List unique elements from input iterable, preserving
the order.
Expand Down Expand Up @@ -267,6 +267,32 @@ ipv6_is_defined
Name: Unique Local Unicast
RFC: RFC 4193

ipv4_generate_random
^^^^^^^^^^^^^^^^^^^^

::

>>>> ipwhois_utils_cli.py --ipv4_generate_random 5

119.224.47.74
128.106.183.195
54.97.0.158
52.206.105.37
126.180.201.81

ipv6_generate_random
^^^^^^^^^^^^^^^^^^^^

::

>>>> ipwhois_utils_cli.py --ipv6_generate_random 5

3e8c:dc93:49c8:57fd:31dd:2963:6332:426e
2e3d:fd84:b57b:9282:91e6:5d4d:18d5:34f1
21d4:9d25:7dd6:e28b:77d7:7ce9:f85f:b34f
3659:2b9:12ed:1eac:fd40:5756:3753:6d2d
2e05:6d47:83fd:5de8:c6cb:85cb:912:fdb1

unique_everseen
^^^^^^^^^^^^^^^

Expand Down
26 changes: 14 additions & 12 deletions EXPERIMENTAL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ Basic usage
>>>> pprint(results.split('\n'))

[
"Bulk mode; whois.cymru.com [2017-07-30 23:02:21 +0000]",
"15169 | 74.125.225.229 | 74.125.225.0/24 | US | arin | 2007-03-13 | GOOGLE - Google Inc., US",
"15169 | 2001:4860:4860::8888 | 2001:4860::/32 | US | arin | 2005-03-14 | GOOGLE - Google Inc., US",
"Bulk mode; whois.cymru.com [2020-09-15 16:42:29 +0000]",
"15169 | 74.125.225.229 | 74.125.225.0/24 | US | arin | 2007-03-13 | GOOGLE, US",
"15169 | 2001:4860:4860::8888 | 2001:4860::/32 | US | arin | 2005-03-14 | GOOGLE, US",
"2856 | 62.239.237.1 | 62.239.0.0/16 | GB | ripencc | 2001-01-02 | BT-UK-AS BTnet UK Regional network, GB",
"2856 | 2a00:2381:ffff::1 | 2a00:2380::/25 | GB | ripencc | 2007-08-29 | BT-UK-AS BTnet UK Regional network, GB",
"3786 | 210.107.73.73 | 210.107.0.0/17 | KR | apnic | | LGDACOM LG DACOM Corporation, KR",
"3786 | 210.107.73.73 | 210.107.0.0/17 | KR | apnic | 1997-08-29 | LGDACOM LG DACOM Corporation, KR",
"2497 | 2001:240:10c:1::ca20:9d1d | 2001:240::/32 | JP | apnic | 2000-03-08 | IIJ Internet Initiative Japan Inc., JP",
"19373 | 200.57.141.161 | 200.57.128.0/20 | MX | lacnic | 2000-12-04 | Triara.com, S.A. de C.V., MX",
"NA | 2801:10:c000:: | NA | CO | lacnic | 2013-10-29 | NA",
"12091 | 196.11.240.215 | 196.11.240.0/24 | ZA | afrinic | | MTNNS-1, ZA",
"12091 | 196.11.240.215 | 196.11.240.0/24 | ZA | afrinic | 1994-07-21 | MTNNS-1, ZA",
"37578 | 2001:43f8:7b0:: | 2001:43f8:7b0::/48 | KE | afrinic | 2013-03-22 | Tespok, KE",
"4730 | 133.1.2.5 | 133.1.0.0/16 | JP | apnic | | ODINS Osaka University, JP",
"4134 | 115.1.2.3 | 115.0.0.0/14 | KR | apnic | 2008-07-01 | CHINANET-BACKBONE No.31,Jin-rong Street, CN",
"4730 | 133.1.2.5 | 133.1.0.0/16 | JP | apnic | 1997-03-01 | ODINS Osaka University, JP",
"4766 | 115.1.2.3 | 115.0.0.0/12 | KR | apnic | 2008-07-01 | KIXS-AS-KR Korea Telecom, KR",
""
}
]

.. GET_BULK_ASN_WHOIS_OUTPUT_BASIC END

Expand Down Expand Up @@ -175,11 +175,14 @@ The stats dictionary returned by ipwhois.experimental.bulk_lookup_rdap()
'ip_lookup_total' (int) - The total number of addresses that
lookups were attempted for, excluding any that failed ASN
registry checks.
'ip_failed_total' (int) - The total number of addresses that
lookups failed for. Excludes any that failed initially, but
succeeded after further retries.
'lacnic' (dict) -
{
'failed' (list) - The addresses that failed to lookup.
Excludes any that failed initially, but succeeded after
futher retries.
further retries.
'rate_limited' (list) - The addresses that encountered
rate-limiting. Unless an address is also in 'failed',
it eventually succeeded.
Expand Down Expand Up @@ -222,9 +225,7 @@ Basic usage
"total": 2
},
"apnic": {
"failed": [
"115.1.2.3"
],
"failed": [],
"rate_limited": [],
"total": 4
},
Expand All @@ -233,6 +234,7 @@ Basic usage
"rate_limited": [],
"total": 2
},
"ip_failed_total": 0,
"ip_input_total": 12,
"ip_lookup_total": 12,
"ip_unique_total": 12,
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-2019 Philip Hane
Copyright (c) 2013-2020 Philip Hane
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
19 changes: 13 additions & 6 deletions RDAP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ Arguments supported by IPWhois.lookup_rdap().
| | | when a rate limit notice is returned via |
| | | rdap+json. Defaults to 120. |
+--------------------+--------+-----------------------------------------------+
| asn_alts | list | Additional lookup types to attempt if the ASN |
| | | dns lookup fails. Allow permutations must be |
| | | enabled. If None, defaults to all |
| | | ['whois', 'http']. *WARNING* deprecated in |
| | | favor of new argument asn_methods. |
+--------------------+--------+-----------------------------------------------+
| extra_org_map | dict | Dictionary mapping org handles to RIRs. |
| | | This is for limited cases where ARIN REST |
| | | (ASN fallback HTTP lookup) does not show an |
Expand Down Expand Up @@ -79,6 +73,10 @@ Arguments supported by IPWhois.lookup_rdap().
| | | pulling ASN information via dns, in order to |
| | | get the ASN description. Defaults to True. |
+--------------------+--------+-----------------------------------------------+
| root_ent_check | bool | If True, will perform additional RDAP HTTP |
| | | queries for missing entity data at the root |
| | | level. Defaults to True. |
+--------------------+--------+-----------------------------------------------+

.. _rdap-output:

Expand Down Expand Up @@ -599,3 +597,12 @@ this very low for bulk queries, or disable completely by setting retry_count=0.

Note that setting this result too low may cause a larger number of IP lookups
to fail.

root_ent_check
^^^^^^^^^^^^^^

When root level entities (depth=0) are missing vcard data, additional
entity specific HTTP lookups are performed. In the past, you would expect
depth=0 to mean a single lookup per IP. This was a bug and has been fixed as of
v1.2.0. Set this to False to revert back to the old method, although you will be
missing entity specific data.
9 changes: 3 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ 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
: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
Expand Down Expand Up @@ -170,11 +172,6 @@ Input
| proxy_opener | object | The urllib.request.OpenerDirector request for |
| | | proxy support or None. |
+--------------------+--------+-----------------------------------------------+
| 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 False. |
+--------------------+--------+-----------------------------------------------+

RDAP (HTTP)
-----------
Expand Down
Loading