Skip to content

Instantly share code, notes, and snippets.

@axot axot/genserial.py
Last active Aug 29, 2015

Embed
What would you like to do?
tkbctf4 "Simple Serial Code"
import random
import string
import md5
flag = md5.new()
flag.update("this_is_not_flag!!")
flag_md5 = flag.hexdigest()
print "flag_md5:", flag_md5
flag_md5 = [flag_md5[i:i+4] for i in range(0, len(flag_md5), 4)]
i = 0
res = []
while True:
serial = ''.join(random.choice(string.ascii_lowercase + \
string.ascii_uppercase) for _ in range(4))
m = md5.new()
m.update(serial)
md = m.hexdigest()
if i < len(flag_md5) and md[0:4] == flag_md5[i]:
res.append(serial)
i += 1
if i == len(flag_md5):
print "found serial: ",''.join(res)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.