Giter Club home page Giter Club logo

subnet-divider's Introduction

Subnet Divider

Subnet Divider is a bash script that helps you divide IP ranges into smaller-sized subnets. This script accepts either an IP range or a file containing multiple IP ranges as input and creates a list of mutually exclusive subnets based on the user-specified subnet size. It supports IPv4 with CIDR range notation.

Features

  • Divides IP ranges into subnets
  • Supports both single IP ranges and an input file containing IP ranges split by new lines
  • User-specified subnet size
  • Outputs subnets into a file
  • Combines previous outputs by removing duplicate ranges and sorting them all together
  • [Optional] Split the output file into multiple files based on a user-specified maximum number of lines per file

Installation

  1. Clone the repository:
git clone https://github.com/rahgozar94725/Subnet-Divider.git
  1. Navigate to the repository directory:
cd Subnet-Divider
  1. Make the script executable:
chmod +x subnet-divider.sh

Usage

./subnet-divider.sh -i <IP_RANGE_OR_FILE> [--output <OUTPUT_FILE>] [--subnet <SUBNET_BITS>] [--lines <MAX_LINES>]
  • -i <IP_RANGE_OR_FILE>, --input <IP_RANGE_OR_FILE>: IP range or a file containing IP ranges.
  • -o <OUTPUT_FILE>, --output <OUTPUT_FILE> (optional): The output file name [Default: Based on input file name]
  • -s <SUBNET_BITS>, --subnet <SUBNET_BITS> (optional): Target subnet size in bits. [Default: 24]
  • -l <MAX_LINES>, --lines <MAX_LINES> (optional): Maximum lines per file for splitting the output. [Default: No splitting]

Examples

Divide a single IP range:

./subnet-divider.sh -i 192.168.0.0/16

Extract IP ranges from a file, designate an output file, specify the desired subnet size, and divide the resulting output into multiple files, each containing 100 lines:

./subnet-divider.sh --input ip_ranges.txt --output output.txt --subnet 16 --lines 100

Support

Give a Star

If you find this script useful, please consider giving it a star on GitHub. It boosts the project's visibility and encourages further development.

Donation

If you find this script helpful and would like to support its development and maintenance, you can donate using the cryptocurrencies:

Crypto donation button by NOWPayments

Your donations will be greatly appreciated (But not required) and will contribute to this project's ongoing improvement and support.

Custom badge

subnet-divider's People

Contributors

rahgozar94725 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.