A python package and commandline tool for generating IPv4-addresses based on schema.
Project description
ipranger
A python package and commandline tool for generating IPv4-addresses based on a schema.
Setup
ipranger can be installed either by using pip or by pulling the source code from this repository:
# Install using pip
pip3 install ipranger
Overview
This section provides an overview of the individual ways to interact with ipranger.
Command Line
ipranger can be directly used via the commandline and as such included in bash-scripts for advanced IPv4 address
format processing.
# Print IPv4 subnet
$ ipranger 192.0.0.1/29
192.0.2.1
192.0.2.2
...
192.0.2.6
# Ranges, comma separated values and IPv4 addresses
$ ipranger 192.168.2.1,2,192.168.2.3,4,5-6
192.0.2.1
192.0.2.2
...
192.0.2.6
# Exclude IPv4 addresses
$ ipranger 192.168.2.1-6 --exclude 192.168.2.2
192.0.2.1
192.0.2.3
...
192.0.2.6
Package
ipranger can be used via the custom argparse type ip_addresses_type:
import argparse
from ipranger.ipranger import ip_addresses_type
parser = argparse.ArgumentParser(description='Scan IPv4 addresses')
parser.add_argument('ip_addresses', type=ip_addresses_type,
help="List of IPv4 addresses e.g. '192.168.0.1' '192.168.0.1,3-20', '192.168.0.1/24'")
arguments = parser.parse_args()
for ip_address in arguments.ip_addresses:
print(ip_address)
Another way to interact with ipranger in python programs is by importing the generate method:
from ipranger.ipranger import generate
for ip_address in generate(include_list=['192.168.0.1-6'], exclude_list=['192.168.0.2']):
print(ip_address)
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
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 ipranger-1.0.0.tar.gz.
File metadata
- Download URL: ipranger-1.0.0.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.8.0 tqdm/4.62.3 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bef9efbc0856cb85640f964bf64e6301837ce5061bf3357afb4f3f87c4d83e87
|
|
| MD5 |
1ea6b445a9f8a562d6a9b2b9e6f81cc2
|
|
| BLAKE2b-256 |
71b2f09a2838562c4babe97434e869e0e3be42169c5e76dedb62412a350b912b
|
File details
Details for the file ipranger-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ipranger-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.8.0 tqdm/4.62.3 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
419310804afa2ea5be076b0c80e78a67fdf9ba8530010487811e7a83bc1e54b4
|
|
| MD5 |
ab6ee80b788bacc064ec5e8105528580
|
|
| BLAKE2b-256 |
be9c651ce09c5482691725ae2259625ed472a841af8d14c66073667b26c7979f
|