Skip to content

Instantly share code, notes, and snippets.

@David-5-1
Created December 18, 2016 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save David-5-1/815dc613c0618a6416557551865089c5 to your computer and use it in GitHub Desktop.
Save David-5-1/815dc613c0618a6416557551865089c5 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# WTFPL http://www.wtfpl.net/txt/copying/
import ipaddress
import sys
for range_ in sys.argv[1:]:
try:
print(*ipaddress.ip_network(range_, strict=False).hosts(), sep='\n')
except ValueError:
print("{range_} is not a valid IP range".format(range_=range_))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment