Created
April 3, 2013 11:28
-
-
Save stania/5300408 to your computer and use it in GitHub Desktop.
prerequisite:
gnu mpfr (may can be installed by distribution installer)
pycrypto, pycryptopan (both can be installed by pip)
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
from cryptopan import CryptoPan | |
import re, sys | |
c = CryptoPan("".join([chr(x) for x in range(0, 32)])) | |
p = re.compile(r"^([^ ]+) ([^ ]+)") | |
def replace(mo): | |
try: | |
domain = mo.group(1) | |
ip = mo.group(2) | |
domain = domain[:domain.index(".")] + ".famous.site" | |
ip = c.anonymize(ip) | |
return domain + " " + ip | |
except: | |
return mo.group(1) + " " + c.anonymize(mo.group(2)) | |
for line in sys.stdin: | |
sys.stdout.write(p.sub(replace, line)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment