Created
July 23, 2015 22:59
-
-
Save packetchef/1a84bfd33bdfeeccf591 to your computer and use it in GitHub Desktop.
For a given subnet and salt, mask each IP
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
# Rumor has it that in newer releases of Python v3, ipaddr objects are not iterable | |
import ipaddr | |
import hashlib | |
salt = 'NN' | |
subnet = ipaddr.IPNetwork('192.168.100.0/24') | |
for ip in subnet: | |
# Try md5 or sha512 | |
maskedIP = hashlib.md5(str(ip) + salt).hexdigest() | |
print('{ip:<15} :: {maskedIP}'.format(ip=ip, maskedIP=maskedIP)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment