Python Libary for IP & ASN Bogons
Project description
python-bogons
Python version of https://github.com/mellowdrifter/bogons
Python library to validate IP and ASN bogons. This library does not filter out unassigned space. It will filter IPv4, IPv6, and Autonomous system numbers that have been marked as bogons in the following RFCs:
For IPv6: 6to4, 6bone, and any prefix not in 2000::/3 is marked as invalid.
Install
pip install bogons
How to use
import bogons
>>> bogons.is_public_ip("1.1.1.1")
True
>>> bogons.is_public_ip("10.0.0.0")
False
>>> bogons.is_public_ip("2600::")
True
>>> bogons.is_public_ip("4600::")
False
>>> bogons.valid_public_asn(1)
True
>>> bogons.valid_public_asn(23456)
False
Development
I welcome pull requests for updated RFCs or errors.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bogons-1.0.3.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file bogons-1.0.3.tar.gz
.
File metadata
- Download URL: bogons-1.0.3.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1e4ef149812181b704450056a7839cd787919968a63d0fca3e54b30bcdab179 |
|
MD5 | 44ebd747dec881840cc2805d955a2090 |
|
BLAKE2b-256 | 94fd5f5d2255f894abe0a4d173a705e595dd100ed5ae4c909269a3917c9fa556 |
File details
Details for the file bogons-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: bogons-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45d8b818552817a03bc4501ebfd58034a57908234599082a0510c2d4c3b899a3 |
|
MD5 | d4266f4a1122afd3fae1cc73c9b703e1 |
|
BLAKE2b-256 | 28116279da16df646e37d3b972876175676c403312a1e2662613d5e0dcb3a29c |