anonymize_ip
This is a simple Python library for anonymizing IP addresses. Both IPv4 and IPv6 addresses are supported.
Examples:
- IPv4:
95.239.169.11→95.239.169.0 - IPv6:
5219:3a94:fdc5:19e1:70a3:b2c4:40ef:ae03→5219:3a94:fdc5:19e1::
Usage
pip install anonymizeip
from anonymizeip import anonymize_ip
address = "fe80::0202:b3ff:fe1e:8329"
anonymized = anonymize_ip(address)
print(anonymized)
# Prints "fe80::"
Settings
The number of address blocks that are set to 0 can be customized.
Besides the IP address, the function anonymize_ip takes two optional parameters:
anonymize_ip(
address,
ipv4_mask="...",
ipv6_mask="..."
)
ipv4_mask: Defaults to255.255.255.0, i.e. the last octet will be anonymized (set to 0)ipv6_mask: Defaults toffff:ffff:ffff:ffff::(same asffff:ffff:ffff:ffff:0:0:0:0), i.e. the last four blocks will be anonymized (set to 0)
Development
git clonepipenv install --dev- Make your code modifications
pipenv run testpipenv run lint
Contributions are always welcome. Please first discuss changes via issue before submitting a pull request.
Credits
The implementation of this library was strongly inspired by php-ip-anonymizer by Geert Wirken.
Metadata
Release files for anonymizeip 1.0.0
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 |
|---|---|---|---|---|
| anonymizeip-1.0.0.tar.gz | 4.3 kB | Without provenance | Details for anonymizeip-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anonymizeip-1.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for anonymizeip-1.0.0-py2.py3-none-any.whl |
Total release size: 7.7 kB
Release files / anonymizeip-1.0.0.tar.gz
| Download URL | anonymizeip-1.0.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
491cb94a31bae23294c5b93a13dd5c9ed55be98003c622e76e2fe64d6a4f3e91
|
|
BLAKE2b-256 checksum How to use checksums |
4a055987ce97a2a8debfba16e35efa88975f340559337b7faabb24e78b32f8c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|
Release files / anonymizeip-1.0.0-py2.py3-none-any.whl
| Download URL | anonymizeip-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e0d446b06b2bbf236394a90b971de403f90f805d14db3a405f8731716acad1fe
|
|
BLAKE2b-256 checksum How to use checksums |
e27427c04c380b9e5d40de1643677f07b54bda2733b33cabba809214405a737e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|
Security for anonymizeip 1.0.0
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.