Created
November 23, 2015 04:51
-
-
Save icheernoom/8efbb4a05e02d5e4dfff to your computer and use it in GitHub Desktop.
Python script to solve "Phone Lock" challenge in Hack Dat Kiwi 2015
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
#!/usr/bin/python | |
# Author: Kitwipat Towattana (@icheernoom) | |
import hashlib, sys | |
salt = 'f074dc1fbaaf66163dfca8ad1079ceea' # random | |
valid = 'a8178dee94945e518c90dad6bffcc657' # random | |
''' | |
if (md5(salt+result)==valid) | |
flag = md5(salt+result+result) | |
''' | |
for result in range(0000,9999): | |
md5 = hashlib.md5("{0}{1}".format(salt,result)).hexdigest() | |
print "{0} : {1}".format(result,md5) | |
if md5 == valid: | |
md5flag = hashlib.md5("{0}{1}{2}".format(salt,result,result)).hexdigest() | |
print "Password: {0}".format(result) | |
print "Flag: {0}".format(md5flag) | |
sys.exit() | |
''' | |
root@ubuntu:~# web50.py | |
...[snip]... | |
3396 : da54054da6a7cefa3204713b71669566 | |
3397 : bf918a33c530b497779200888e6eb582 | |
3398 : a8178dee94945e518c90dad6bffcc657 | |
Password: 3398 | |
Flag: 98635f80048b8abbd71e9bb55958a6c8 | |
root@ubuntu:~# | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment