Skip to main content

A package for generating random IPv4 and IPv6 addresses and subnets

Project description

Random IP/Prefix Generator

randomprefixgenerator is a simple Python module for generating random IPv4 and IPv6 addresses and subnets.

Features

  • Generate random IPv4 or IPv6 addresses.
  • Generate random IPv4 or IPv6 subnets with a specified prefix length.
  • Control the range of prefix lengths for generated subnets.

Installation

You can install myIp using pip:

pip install randomprefixgenerator

Usage

from randomprefixgenerator import RandomPrefixGenerator

# Create a new myIp object for generating IPv4 addresses
ipv4_gen = RandomPrefixGenerator(4, mode='ip')

# Generate a random IPv4 address
ipv4_addr = next(ipv4_gen)

# Create a new myIp object for generating IPv6 subnets with prefix lengths between 64 and 120
ipv6_gen = RandomPrefixGenerator(6, mode='prefix', min_length=64, max_length=120)

# Generate a random IPv6 subnet
ipv6_subnet = next(ipv6_gen)

Dependancies

  • Python 3.x
  • ipaddress module

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

random_prefix_generator-0.4.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

random_prefix_generator-0.4-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page