Skip to main content

IPv4Helper

Handle and manipulate IPv4 CIDRs in a simple fashion, including generating CIDR ranges and viewing general subnet information.

Installation

pip install ipv4helper

Usage

Provide an IPv4 address, and optionally the CIDR it resides in (otherwise "/32" will be appended to the given IP).

from ipv4helper import IPv4Helper
i = IPv4Helper("127.144.4.9/28")
print(i.subnet_summary)
for x in i.ip_range_generator():
	print(x)

# snipped output
# ...
# 127.144.4.9/28
# CIDR                    28
# Mask                    255.255.255.240
# Binary Mask             11110000
# Range                   127.144.4.0 - 127.144.4.15
# Blocksize               16
# Subnet Addresses        16
# Usable Addresses        14
# ACL Wildcard            0.0.0.15
# Octet Incremented       4
# Octet Masked            1
# ...
# 127.144.4.0
# 127.144.4.1
# 127.144.4.2
# 127.144.4.3
# 127.144.4.4
# ...

Available Attributes

blocksize
cidr
given_ip
given_cidr
given_ip_first_octet
given_ip_second_octet
given_ip_third_octet
given_ip_fourth_octet
iparg
mask
mask_binary
octet # position to be incremented
mask_octet # position to be masked
subnets # dictionary of general subnet information
subnet_summary
subnet_addresses
usable_addresses
subnet_info # dictionary
subnet_json # json
subnet_min_ip
subnet_max_ip
subnet_max_octet
subnet_min_octet
wildcard

Available Generator Functions

octet_generator()
ip_range_generator()

Integration with IPv4Mutate GitHub PyPi

from ipv4helper import IPv4Helper
from ipv4mutate import IPv4Mutate
i = IPv4Helper("127.144.4.9/28")
for x in i.ip_range_generator():
	z = IPv4Mutate(x)
	print(z.mutate_hex)

# snipped output
# ...
# 0x7f.0x90.0x4.0x0
# 0x7f.0x90.0x4.0x1
# 0x7f.0x90.0x4.0x2
# 0x7f.0x90.0x4.0x3
# ...

Important Notes

  • "/0" is not supported in this version, but it will be "soon"

TODO

  • better internal naming convention
  • /0 support
  • integrate with IPv4Mutate and IPv6Helper

Metadata

Release files for ipv4helper 0.9.1

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

Source distribution (sdist)

Source distribution for ipv4helper 0.9.1
File Size Uploaded
ipv4helper-0.9.1.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ipv4helper 0.9.1
File Interpreter ABI Platform
ipv4helper-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / ipv4helper-0.9.1.tar.gz

Download URL ipv4helper-0.9.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
677224e07f5729779823e2b7be5691d1a80cc8b7173964cade522c967d4f48bd
BLAKE2b-256 checksum
How to use checksums
44dbcff72df62b8417528de699cdaa4d1c344a564a5983aa531da2ffc572f6dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.9

Release files / ipv4helper-0.9.1-py3-none-any.whl

Download URL ipv4helper-0.9.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ca79265bcc7f28a83173b4f201dc07a576502b3afd931573ab3ea191dffdc5e
BLAKE2b-256 checksum
How to use checksums
020573eff0f00a4c701a114a5dd0845ac75cdcecc81dacade8908608eb2243e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

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