Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Emdee
import md5
import struct, string
import httplib, urllib
import time
import thread
def Encode(input, len):
k = len >> 2
res = apply(struct.pack, ("%iI" % k,) + tuple(input[:k]))
return string.join(res, "")
def Decode(input, len):
k = len >> 2
res = struct.unpack("%iI" % k, input[:len])
return list(res)
def hex(str):
return ''.join(hex(ord(x))[2:] for x in str)
def getEncoded(str, prepend = 0):
strLen = len(str) + prepend
padding = (64 - 9 - strLen)
res = str + "\x80" + ("\x00" * padding) + Encode((strLen << 3, 0), 8)
return res
def extension(hash, nbBlock, value):
m = md5.md5()
m.state = Decode(hash.decode('hex'), 16)
strLen = len(value)
nbBits = (strLen + nbBlock * 64) << 3
res = value + "\x80" + ("\x00" * (64 - 9 - strLen)) + Encode((nbBits, 0), 8)
m.transform(res)
return Encode(m.state, 16).encode('hex')
def apiRequest(secret):
conn = httplib.HTTPConnection("109.233.61.11:34380")
params = urllib.urlencode({'secret': secret})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn.request("POST", "/", params, headers)
response = conn.getresponse()
data = response.read()
begin = "Result: MD5( SALT + your_secret + "
end = " )"
start = data.index(begin) + len(begin)
end = data.index(end, start)
timestamp = data[start:end]
begin = " = <em>"
end = " -</em>"
start = data.index(begin) + len(begin)
end = data.index(end, start)
hash = data[start:end]
conn.close()
return [timestamp, hash, data]
def doAttempt(word, sa):
r = apiRequest(getEncoded(word, sa))
if (extension(expect, 1, r[0]) == r[1]):
print(word)
print(r[2])
print(sa)
print("Found !")
expect = "40288d60073775070a7edcdcd1df9c56"
with open("wordlist2.txt", "rb") as f:
lst = f.read().split("\r\n")
for w in range(0, len(lst)):
word = lst[w]
if (len(word) < 1 or len(word) > 6):
continue
print("At : " + str(w) + " (" + word + ")")
for sa in range(2, 45):
doAttempt(word, sa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment