Skip to main content

Expands networks given in CIDR, dashed, or splat format.

Project description

netexpand

Expands networks given in CIDR, dashed, or splat format.

PyPI Version Python Versions License: GPL v3 GitHub Issues Code Size

netexpand takes a given network (which can be notated with CIDR, dashed, or splat format) and expands the network; i.e., it prints each valid address within the network given.

Supported Notations:

  • CIDR: x.x.x.x/x (e.g., 192.168.1.0/24)
  • Dashed: x.x.x.x-x (e.g., 192.168.1.1-254)
  • Splat: x.x.x.* (e.g., 192.168.1.*)

NOTE: Network notations should not be mixed; the program will report an error and exit upon detection.

By default, the tool prints each valid host address to stdout. It also includes options to randomize the output addresses and to select specific network components (like network addresses or broadcast addresses).

Installation

Requires a current Python 3.7+ installation with standard libraries.

To install netexpand globally on your system, clone the repository and use pip:

git clone [https://github.com/sjtrotter/netexpand.git](https://github.com/sjtrotter/netexpand.git)
cd netexpand
pip install .

Usage Example

Once installed, you can call netexpand natively from anywhere in your terminal.

Standard Host Expansion (Default):

$ netexpand 192.168.1.0/30
192.168.1.1
192.168.1.2

Randomized Output:

$ netexpand 192.168.1.10-15 -r
192.168.1.14
192.168.1.11
192.168.1.15
192.168.1.10
192.168.1.12
192.168.1.13

Output Specific Network Components: You can specify whether you want to output hosts, networks, or broadcast addresses using the -t or --type flag.

$ netexpand 10.0.0.* -t broadcast
10.0.0.255

Development Setup

To work on netexpand locally without needing to reinstall after every change, install the package in "editable" mode:

git clone [https://github.com/sjtrotter/netexpand.git](https://github.com/sjtrotter/netexpand.git)
cd netexpand
pip install -e .

Release History

  • 0.5.0
    • Refactored into a standard Python package layout (src/ structure)
    • Migrated string parsing engine to ipaddress.summarize_address_range
    • Added -t/--type parameter for selective component output
  • 0.0.0
    • Initial scripts and CLI proof of concept

Meta

Stephen Trotter – stephen@trotter.cloud

Distributed under the GNU GPLv3 license. See LICENSE for more information.

https://github.com/sjtrotter/netexpand

Contributing

  1. Fork it (https://github.com/sjtrotter/netexpand/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

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

netexpand-0.7.3.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netexpand-0.7.3-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file netexpand-0.7.3.tar.gz.

File metadata

  • Download URL: netexpand-0.7.3.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for netexpand-0.7.3.tar.gz
Algorithm Hash digest
SHA256 52038913e20728feb6609d67f2af87bf35695a56357018e1eabd4c9223bb094b
MD5 0e434b2c3eabf1b5adcb8a411756fb9f
BLAKE2b-256 2b1a00859af631b9f9620baa230e391a0a5b58e898a8d25d8cc21e70db671c8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for netexpand-0.7.3.tar.gz:

Publisher: python-publish.yml on sjtrotter/netexpand

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netexpand-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: netexpand-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for netexpand-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f67b7271ae945a896593c9731e83ca13098ee734ab96f74c0b60df2135cb56b3
MD5 4b7a13584add1c4cbb5322cce1cdd319
BLAKE2b-256 b6bd340c2ff8041159c60f3c6c7bce099911715ece12e677c5d4fffae951af3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for netexpand-0.7.3-py3-none-any.whl:

Publisher: python-publish.yml on sjtrotter/netexpand

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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