Advanced IPv4 Subnet Calculator in Python3

Overview

Tested on Python 3.6+ Code Size Contributors Release Date Commit Activity Languages Count Top Language Stars Forks Open Issues Closed PR License Code style: black Imports: isort Pre-Commit

Advanced IPv4 Subnet Calculator in Python3

Table of Contents

  1. Getting Started
  2. Installation
  3. How it works?
  4. SVI Configuration Template
  5. Previews

Getting Started

│   main.py
│   read_subnets.py
│   subnetting.py
│   export_subnets.py
│   parse_excel.py
│   svi_generator.py
│   svi.j2
│   subnets.csv
│   requirements.txt
│   README.md
│   .pre-commit-config.yaml
│   .gitignore
│   LICENSE
│
└───assets
        preview.png
        subnets-csv.png
        subnetting-cli.png
        svi-template.png
        svi.png

Installation

$ git clone https://github.com/Tes3awy/subnetting.git
$ cd subnetting
$ pip install -r requirements.txt --user

OR

  1. Download the latest release from Releases.
  2. Extract subnetting.zip file.
  3. cd into subnetting directory.
  4. Run path_to\subnetting> pip install -r requirements.txt --user in terminal.

How it works?

Windows

path_to\subnetting> python main.py

macOS or Unix

$ python3 main.py

You will be prompted to enter the name of the CSV file containing input subnets, the gateway, a name for the Excel file to be created. (All inputs have default values).

A subnets.csv file can be found in the repo. This file is an entry point to get started using this program. It's prepopulated with three different subnets. (Class A, B, and C).

- CSV file [subnets.csv]:
- The gateway, first or last IP Address [0/1] [0]:
- Excel file to create [New-Schema.xlsx]:

Voila You have an Excel file that includes all required data about each subnet.

Please check New-Schema_<TODAYS_DATE>.xlsx in current working directory.

Default behaviors:

  1. CIDR notation with no prefix length will be handled as /32.
    - For example, if you enter 10.0.0.1 without a prefix length in the CSV file, the script will handle it like 10.0.0.1/32.
  1. The header line Subnets in CIDR Notation within the subnets.csv file is automatically skipped. So, there is no need to manually remove it.
  1. The gateway input accepts 0 or 1 ONLY [Defaults to 0]. 0 picks the first IP address of the subnet, while 1 picks the last IP address.

SVI Configuration Template

Finally, if you have a L3 switch and you want to create SVI interfaces of the created subnets on that switch, you can run:

$ python parse_excel.py --file <EXCEL_FILE_NAME>.xlsx

This Python script will generate a configuration file that includes all VLANs and their SVI interfaces.

NOTE: Make sure you add the VLAN ID and VLAN Name in all the cells in the generated Excel file before running parse_excel.py script. Otherwise, VLAN ID and VLAN Name will be NaN in the generated configuration file.


Previews

Terminal Python CLI Elapsed time is about 9 seconds in here because a CIDR notation like 10.0.0.0/8 is a little bit extensive to process.

CSV File (Input File) CSV File

Excel File (Output File) Excel Preview

python parse_excel.py -f <EXCEL_FILE_NAME>.xlsx SVI CLI

SVI Template SVI Template

You might also like...
An attempt at furthering Factorio Calculator to work in more general contexts.

factorio-optimizer Lets do Factorio Calculator but make it optimize. Why not use Factorio Calculator? Becuase factorio calculator is not general. The

A price calculator for multiple things
A price calculator for multiple things

Price Calculator A price calculator for multiple things Example I have 0.0567kg diamond. The price of diamond in kg is: $4500. Then it says: The price

Calculator in command line using python programming language

Calculator in command line using python programming language University of the People Python fundamental Chapter 5 Conditionals and recursion The main

A calculator for common measurements used in sci-fi books.

Sci-fi-speed-calculator A calculator for common measurements used in sci-fi books. Author: Tyler Windmemuth Purpose: This program allows sci-fi author

A promo calculator for sports betting odds.

Sportbetter Calculation Toolkit Parlay Calculator This is a quick parlay calculator that considers some of the common promos offered. It is used to id

Improved version calculator, now using while True and etc
Improved version calculator, now using while True and etc

CalcuPython_2.0 Olá! Calculadora versão melhorada, agora usando while True e etc... melhorei o design e os carai tudo (rode no terminal, pra melhor ex

Simple calculator made in python
Simple calculator made in python

calculator Uma alculadora simples feita em python CMD, PowerShell, Bash ✔️ Início 💻 apt-get update apt-get upgrade -y apt-get install python git git

Ballistic calculator for Airsoft

Ballistic-calculator-for-Airsoft 用于Airsoft的弹道计算器 This is a ballistic calculator for airsoft gun. To calculate your airsoft gun's ballistic, you should

A simple calculator that can add, subtract, multiply or divide depending upon the input from the user

Calculator A simple calculator that can add, subtract, multiply or divide depending upon the input from the user. In this example, we should have the

Releases(v4.0)
Owner
Osama Abbas
Network Automation Engineer who finds it fun to automate stuff
Osama Abbas
Code needed for hybrid land cover change analysis for NASA IDS project

Documentation for the NASA IDS change analysis Poley 10/21/2021 Required python packages: whitebox numpy rasterio rasterio.mask os glob math itertools

Andrew Poley 2 Nov 12, 2021
Predict if a fuse is usable on an appliance depending on the fuse rating

fuse-feasibility-analysis Predict if a fuse is usable on an appliance depending on the fuse rating , Power rating and resistance in the appliance

Sebastian Muchui 4 Jul 21, 2022
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

18.6k Jan 02, 2023
Feature engineering library that helps you keep track of feature dependencies, documentation and schema

Feature engineering library that helps you keep track of feature dependencies, documentation and schema

28 May 31, 2022
PyLaboratory 0 Feb 07, 2022
Simple script to match riders with drivers.

theBestPooler Simple script to match riders with drivers. It's a greedy, unoptimised search, so no guarantees that it works. It just seems to work (ve

Devansh 1 Nov 22, 2021
Py4J enables Python programs to dynamically access arbitrary Java objects

Py4J Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine. Methods are called as

Barthelemy Dagenais 1k Jan 02, 2023
Repository for DNN training, theory to practice, part of the Large Scale Machine Learning class at Mines Paritech

DNN Training, from theory to practice This repository is complementary to the deep learning training lesson given to les Mines ParisTech on the 11th o

Alexandre Défossez 6 Nov 14, 2022
LiteX-Acorn-Baseboard is a baseboard developed around the SQRL's Acorn board (or Nite/LiteFury) expanding their possibilities

LiteX-Acorn-Baseboard is a baseboard developed around the SQRL's Acorn board (or Nite/LiteFury) expanding their possibilities

33 Nov 26, 2022
SmartGrid - Een poging tot een optimale SmartGrid oplossing, door Dirk Kuiper & Lars Zwaan

SmartGrid - Een poging tot een optimale SmartGrid oplossing, door Dirk Kuiper & Lars Zwaan

1 Jan 12, 2022
An advanced NFT Generator

NFT Generator An advanced NFT Generator Free software: GNU General Public License v3 Documentation: https://nft-generator.readthedocs.io. Features TOD

NFT Generator 5 Apr 21, 2022
Built as part of an assignment for S5 OOSE Subject CSE

Installation Steps: Download and install Python from here based on your operating system. I have used Python v3.8.10 for this. Clone the repository gi

Abhinav Rajesh 2 Sep 09, 2022
API Rate Limit Decorator

ratelimit APIs are a very common way to interact with web services. As the need to consume data grows, so does the number of API calls necessary to re

Tomas Basham 574 Dec 26, 2022
Gerador de dafaces

🎴 DefaceGenerator Obs: esse script foi criado com a intenção de ajudar pessoas iniciantes no hacking que ainda não conseguem criar suas próprias defa

LordShinigami 3 Jan 09, 2022
ViberExport - Export messages from Viber messenger using viber.db file

📲 ViberExport Export messages from Viber messenger using viber.db file ⚡ Usage:

7 Nov 23, 2022
chiarose(XCR) based on chia(XCH) source code fork, open source public chain

chia-rosechain 一个无耻的小活动 | A shameless little event 如果您喜欢这个项目,请点击star 将赠送您520朵玫瑰,可以去 facebook 留下您的(xcr)地址,和github用户名。 If you like this project, please

ddou123 376 Dec 14, 2022
Script de monitoramento de telemetria para missões espaciais, cansat e foguetemodelismo.

Aeroespace_GroundStation Script de monitoramento de telemetria para missões espaciais, cansat e foguetemodelismo. Imagem 1 - Dashboard realizando moni

Vinícius Azevedo 5 Nov 27, 2022
Fastest Semantle solver this side of the Mississippi

semantle Fastest Semantle solver this side of the Mississippi. Roughly 3 average turns to win Measured against (part of) the word2vec-google-news-300

Frank Odom 8 Dec 26, 2022
Python plugin for Krita that assists with making python plugins for Krita

Krita-PythonPluginDeveloperTools Python plugin for Krita that assists with making python plugins for Krita Introducing Python Plugin developer Tools!

18 Dec 01, 2022
Runtime fault injection platform by Daniele Rizzieri (2021)

GDBitflip [v1.04] Runtime fault injection platform by Daniele Rizzieri (2021) This platform executes N times a binary and during each execution it inj

Daniele Rizzieri 1 Dec 07, 2021