Skip to main content

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

Project description


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


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 | head -n10


-$ ipexpand | head -n10 | ipreduce

Network size:

-$ netlen netlen 2001:db4::/56

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
-$ echo $?
-$ innet
-$ echo $?

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


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

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

ipwrangle-0.0.4.tar.gz (2.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page