Skip to main content

ipwrangle

Simple python-based command-line utilities to work with CIDRs individual IPs.

Usage

ipwrangle is installed as four command-line utility accessible as innet, netlen, ipreduce and ipexpand from the command-line.

You can use it them to convert a CIDR notation into the list of IP addresses contained in the block, reduce a list of IP addresses into its smallest CIDR blocks possible, calculate a CIDR block size or check if an IP is in a CIDR block.

An example of expansion:

-$ ipexpand 192.0.2.0/24 | head -n10
192.0.2.0
192.0.2.1
192.0.2.2
192.0.2.3
192.0.2.4
192.0.2.5
192.0.2.6
192.0.2.7
192.0.2.8
192.0.2.9

Reduction:

-$ ipexpand 192.0.2.0/24 | head -n10 | ipreduce
192.0.2.0/29
192.0.2.8/31

Network size:

-$ netlen netlen 2001:db4::/56
4722366482869645213696

IP in CDIR block, this utility writes on stderr (for human reading) but also has a return code of 0 (true) -1 (false) to use in automation:

-$ innet 192.168.0.1 192.168.0.0/24
true
-$ echo $?
0
-$ innet 192.169.0.1 192.168.0.0/24
false
-$ echo $?
255

All tools besides innet accept data as commandline arguments (multiple entries split with a comma) or through stdin as multiline.

Bugs

Feel free to report issues, I build these tools simply because I couldn't find ones that did exactly this.

Metadata

Release files for ipwrangle 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipwrangle 0.0.4
File Size Uploaded Provenance Actions
ipwrangle-0.0.4.tar.gz 2.8 kB Without provenance Details for ipwrangle-0.0.4.tar.gz

Release files / ipwrangle-0.0.4.tar.gz

Download URL ipwrangle-0.0.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ca13ee15d136141bbe6eaa8eb26a5dda7a9443488731f75b40ad00fc0f980b29
BLAKE2b-256 checksum
How to use checksums
91607c58a78b6eb6b5e6ddcd031134fedcd788dda42ab8678d53246f2c360802
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.7

Security for ipwrangle 0.0.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page