Skip to main content

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

Uploaded Source

Built Distribution

bogons-1.0.3-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page