Created
December 7, 2018 17:33
-
-
Save dmehrotra/491d45dfb1adf90e5840ca6de03b788d to your computer and use it in GitHub Desktop.
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 sys | |
import ipaddress | |
fi = sys.argv[1] | |
count = 0 | |
with open(fi) as f: | |
for i,line in enumerate(f): | |
network = line.split(',')[0] | |
if (network != 'network' and network != '\n'): | |
net = ipaddress.ip_network(network) | |
for x in net.hosts(): | |
count = count+1 | |
print (count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment