Created
November 9, 2019 13:05
-
-
Save akhil-reni/5c248544f3247e3cf0b6d8e4ae3ab5fe to your computer and use it in GitHub Desktop.
cat cidr.txt | python3 cidrtoips.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ipaddress | |
import fileinput | |
ips = [] | |
for line in fileinput.input(): | |
try: | |
ips.extend(list(ipaddress.ip_network(line.strip()))) | |
except: | |
pass | |
print('\n'.join(map(str, ips))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment