Handle and manipulate IPv4 CIDRs in a simple fashion, including generating CIDR ranges and viewing general subnet information.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ipv4helper-0.9.1.tar.gz.
File metadata
- Download URL: ipv4helper-0.9.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
677224e07f5729779823e2b7be5691d1a80cc8b7173964cade522c967d4f48bd
|
|
| MD5 |
306b2fca0caee64a5e41ea8127f2b428
|
|
| BLAKE2b-256 |
44dbcff72df62b8417528de699cdaa4d1c344a564a5983aa531da2ffc572f6dd
|
File details
Details for the file ipv4helper-0.9.1-py3-none-any.whl.
File metadata
- Download URL: ipv4helper-0.9.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ca79265bcc7f28a83173b4f201dc07a576502b3afd931573ab3ea191dffdc5e
|
|
| MD5 |
9b5f54c722dc82785901060477390e7a
|
|
| BLAKE2b-256 |
020573eff0f00a4c701a114a5dd0845ac75cdcecc81dacade8908608eb2243e1
|