Skip to content

Instantly share code, notes, and snippets.

@ducnhse130201
Created January 3, 2019 12:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ducnhse130201/ef451668ad37fd7dce8aa85779e1e4c3 to your computer and use it in GitHub Desktop.
Save ducnhse130201/ef451668ad37fd7dce8aa85779e1e4c3 to your computer and use it in GitHub Desktop.
IQTest2_solve
import subprocess
import requests
from base64 import *
def hash_length_ex(data,len_secret,append,sign,_format):
res_sign = ''
res_string = ''
command = './hash_extender -d "' + data + '" -l ' + str(len_secret) + ' -a "' + append + '" -s "' + sign + '" -f "' + _format + '"'
p = subprocess.Popen(command, shell = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
if line.startswith('New signature:'):
res_sign = line.split(' ')[2].strip()
if line.startswith('New string:'):
res_string = line.split(' ')[2].strip()
retval = p.wait()
return res_sign,res_string
def get_url(h,save):
s = requests.Session()
url = 'http://45.76.148.31:9004/index.php'
cookies = {'hash': h,'saved': save}
r = s.get(url,cookies=cookies)
return r.content
add = '&level=xiii'
h = 'f783148cc4750250969e3e1a0336aa43'
for i in range(1,40):
a,b = hash_length_ex('true',i,add,h,'md5')
if 'level13' in get_url(a, b64encode('seed=' + b.decode('hex'))):
print 'hash: ' + a
print 'saved: ' + b64encode('seed=' + b.decode('hex'))
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment