ASN Check
Given a list of IPs the tool returns their AS numbers and names.
Data sources:
Features:
- Caching the data from sources - first run may take a long time,
- Binary IP network search for high throughput,
- Returns AS Number, AS Name and a country code for each IP address,
- Supports both IPv4 and IPv6,
- Reserved ranges included,
- Also available as a lib!
Installation
pip install asn-check
Options
--input-file FILENAME Input file with one IPv4 per line [default:STDIN]
--output-file FILENAME Output file - csv, header: ip,asn,name,country_code [default: STDOUT]
--log-level [DEBUG|INFO|WARNING|ERROR|CRITICAL] Set logging level. [default: WARNING]
--help Show this message and exit.
Example CLI
$ echo '250.254.147.119
12.154.0.67
41.13.122.240
176.218.30.1078
128.105.177.84
85.227.158.196
74.74.207.74
2a03:2880:f077::1' | asn-check
Output:
ip,asn,name,country_code
250.254.147.119,rfc6890-t15,Reserved for Future Use,IANA
12.154.0.67,7018,ATT-INTERNET4,US
41.13.122.240,29975,VODACOM-,ZA
128.105.177.84,59,WISC-MADISON-AS,US
85.227.158.196,2119,TELENOR-NEXTEL Telenor Norge AS,NO
74.74.207.74,11351,TWC-11351-NORTHEAST,US
2a03:2880:f077::1,32934,FACEBOOK,US
Example Lib Usage
from ipaddress import ip_address
from asn_check import ASNChecker
checker = ASNChecker()
print(checker.search(ip_address("12.154.0.67")))
Output:
{'ip': IPv4Address('12.154.0.67'), 'asn': '7018', 'name': 'ATT-INTERNET4', 'country_code': 'US'}
Note: If you'd like to use your own data sources, theoretically you can, but they need to follow the same format as the APNIC sources (and the format is not consistent!) - check out the constructor options asn_routes_url_v4, asn_routes_url_v6, asn_names_url. I'd recommend sticking to the defaults.
Metadata
Release files for asn-check 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asn_check-1.1.3.tar.gz | 23.5 kB | Without provenance | Details for asn_check-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asn_check-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for asn_check-1.1.3-py3-none-any.whl |
Total release size: 44.6 kB
Release files / asn_check-1.1.3.tar.gz
| Download URL | asn_check-1.1.3.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9aa28857256cc80962293b983197906e421abb90595b69e6ca1480bb127b6455
|
|
BLAKE2b-256 checksum How to use checksums |
42ccacaea3d5036e42997471f76584e226653af7266118895dd919066c6bbe4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.2
|
Release files / asn_check-1.1.3-py3-none-any.whl
| Download URL | asn_check-1.1.3-py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b560cda3464759aa9927e3e1ae8ab1ea7dd26015c768280f642864fe36c22b6
|
|
BLAKE2b-256 checksum How to use checksums |
55745821386bb6dbc77a092af51ac178ec96cb504eede60d617f0dfefdcc0da0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.2
|
Security for asn-check 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.