A python class to quickly search ip2asn data for range matches
Project description
Objective
A python class to search ip2asn information for matches.
Installation
Using pip:
pip3 install ip2asn
Or manually:
git clone git@github.com:hardaker/ip2asn.git
cd ip2asn
python3 setup.py build
python3 setup.py install
Example Usage
setup
curl -o ip2asn-v4-u32.tsv.gz https://iptoasn.com/data/ip2asn-v4-u32.tsv.gz
gunzip ip2asn-v4-u32.tsv.gz
Coding
import ip2asn
i2a = ip2asn.IP2ASN("ip2asn-v4-u32.tsv")
result = i2a.lookup_address("93.184.216.34")
import pprint
pprint.pprint(result)
Produces:
{'ASN': '15133',
'country': 'US',
'ip_numeric': 1572395042,
'ip_range': [1572394752, 1572396543],
'ip_text': '93.184.216.34',
'owner': 'EDGECAST - MCI Communications Services, Inc. d/b/a Verizon Business'}
Author
Wes Hardaker, USC/ISI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ip2asn-0.9.tar.gz
(3.7 kB
view details)
Built Distribution
ip2asn-0.9-py3-none-any.whl
(4.4 kB
view details)
File details
Details for the file ip2asn-0.9.tar.gz
.
File metadata
- Download URL: ip2asn-0.9.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ee001e5f9dc36e74bac96ce800ae84a6b6bc32d78db96f1212226ffa0b47679 |
|
MD5 | 7c80f772491c9c9a9b813cca050fc543 |
|
BLAKE2b-256 | 1910ffdba8daa2a63ae798f19d5d4aa8321f0acd947edcb777ba256b5081529d |
File details
Details for the file ip2asn-0.9-py3-none-any.whl
.
File metadata
- Download URL: ip2asn-0.9-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32e4dc01522ada84466d6a4c244e5f9597aec5e85f899e7aa8d534e829bfbd7e |
|
MD5 | 5022860ab0736efcba705a262d515493 |
|
BLAKE2b-256 | a07487878bb2a8d3b8da9238fd2d0f78d6083bcf66a4c9f54388687c3e2ca120 |