Skip to content

Instantly share code, notes, and snippets.

@ddfault
ddfault / cidr.py
Last active July 31, 2021 18:23 — forked from toringe/cidr.py
Merge CIDR blocks into super blocks if possible
View cidr.py
#!/usr/bin/env python
#
# Example 1: All blocks in list.txt, one CIDR per line
# cat list.txt | cidr.py (linux)
# type list.txt | cidr.py (Windows)
#
# Example 2: Echo CIDR blocks to stdout
# echo 1.2.3.0/25 1.2.3.128/25 | cidr.py
# Adjusted python print to print() to work with my python 3.5 on Windows.