Skip to content

Instantly share code, notes, and snippets.

@pahaz
Created November 19, 2014 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pahaz/98429d17b4a2e32c6b92 to your computer and use it in GitHub Desktop.
Save pahaz/98429d17b4a2e32c6b92 to your computer and use it in GitHub Desktop.
hack parsing task
import threading
import requests as r
import re
__author__ = 'pahaz'
def download(_from, _to, lock, f):
for i in range(_from, _to):
s = r.session()
z = s.get('http://188.226.175.123/' + str(i), headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36',
'Origin': 'http://188.226.175.123',
'Referer': 'http://188.226.175.123/',
})
txt = (repr(z.text))
url = (re.findall(r'open\("POST","(.*?)"', txt)[0])
z = s.post('http://188.226.175.123/' + url, data=str(i), headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36',
'Origin': 'http://188.226.175.123',
'Referer': 'http://188.226.175.123/' + str(i),
})
k = z.text
print(i, k, url, txt)
with lock:
f.write(str(i) + ' ' + k + '\n')
if __name__ == "__main__":
count = 10000
threads = 200
count_per_thread = int(count / threads)
threads_lst = []
f = open('keys.txt', 'w', encoding='utf-8')
lock = threading.Lock()
for x in range(threads):
_from = x * count_per_thread
_to = _from + count_per_thread
t = threading.Thread(target=download, args=(_from+1, _to+1, lock, f))
t.start()
threads_lst.append(t)
for t in threads_lst:
t.join()
f.close()
answ = 0
for code in open('keys.txt').readlines():
index, key = code.split()
answ ^= int(key, 16)
print(hex(answ)[2:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment