Skip to content

Instantly share code, notes, and snippets.

@Chkcmd
Chkcmd / subnet.py
Created September 18, 2017 18:09 — forked from nboubakr/subnet.py
A simple python script converts a Classless Inter-Domain Routing (CIDR)-formatted IP address into an IP range and netmask.
#!/usr/bin/env python
# python subnet.py 200.100.33.65/26
import sys
# Get address string and CIDR string from command line
(addrString, cidrString) = sys.argv[1].split('/')
# Split address into octets and turn CIDR into int
addr = addrString.split('.')