Created
May 21, 2012 17:07
-
-
Save ideamonk/2763324 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Wrote this to find free licenses of TotalFinder , after which they discontinued their coupon offers | |
import base64, string, urllib2, itertools, multiprocessing | |
totallist = list(set(j+"".join(i) for i in list(itertools.permutations(string.ascii_uppercase*3, 3)) for j in string.digits)) | |
baseurl = base64.decodestring('aHR0cDovL3NpdGVzLmZhc3RzcHJpbmcuY29tL2JpbmFyeWFnZS9wcm9kdWN0L3RvdGFsZmluZGVy\nZnJlZT9jb3Vwb249VEhBTktT\n') | |
def isValid(code): | |
url = baseurl+code | |
if not("is not a valid coupon." in urllib2.urlopen(url).read()): | |
print code, url | |
return (code, url) | |
else: | |
return None | |
pool = multiprocessing.Pool(processes=20) | |
results = [pool.apply_async(isValid, (a,)) for a in totallist] | |
results = [r.get() for r in results] | |
f = open("totality.txt", "w+") | |
for r in results: | |
if (r): f.write(r[0] + " : " + r[1]) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment