def getpkm(): token = 'c9KcX1Cry3QKS2Ai7yxL6QiQGeBGeQKR' sent = False print 'Ready to receive from NDS' while not sent: sock, req = getReq() a = req.action if len(req.getvars) == 1: sendResp(sock, token) elif a == 'info': sendResp(sock, '\x01\x00') print 'Connection Established.' elif a == 'setProfile': sendResp(sock, '\x00' * 8) elif a == 'result': sendResp(sock, '\x05\x00') elif a == 'delete': sendResp(sock, '\x01\x00') elif a == 'search': sendResp(sock, '') elif a == 'post': sendResp(sock, '\x0c\x00') print 'Receiving Pokemon...' data = req.getvars['data'] bytes = b64decode(data.replace('-', '+').replace('_', '/')) decrypt = makepkm(bytes) filename = namegen(decrypt[0x48:0x5e]) filename += '.pkm' save(filename, decrypt) statread(decrypt) sent = True
def getpkm(): sent = False response = '' print 'Ready to receive from NDS' while not sent: sock, req = getReq() a = req.action if len(req.getvars) == 1: sendResp(sock, gtsvar.token) continue elif a == 'info': response = '\x01\x00' print 'Connection Established.' elif a == 'setProfile': response = '\x00' * 8 elif a == 'result': response = '\x05\x00' elif a == 'delete': response = '\x01\x00' elif a == 'search': response = '\x01\x00' elif a == 'post': response = '\x0c\x00' print 'Receiving Pokemon...' data = req.getvars['data'] bytes = urlsafe_b64decode(data) decrypt = makepkm(bytes) filename = '' if decrypt[0x49] != '\x00': pid = 0 for i in xrange(0, 4): pid += ord(decrypt[i]) << (i * 8) filename = str(pid) else: for i in decrypt[0x48:0x5e]: if i == '\xff': break if i != '\x00': filename += i filename += '.pkm' save(filename, decrypt) statread(decrypt) sent = True m = hashlib.sha1() m.update(gtsvar.salt + urlsafe_b64encode(response) + gtsvar.salt) response += m.hexdigest() sendResp(sock, response)
def getpkm(): sent = False response = '' print 'Ready to receive from game.' while not sent: sock, req = getReq() a = req.action if len(req.getvars) == 1: sendResp(sock, gtsvar.token) continue elif a == 'info': response = '\x01\x00' print 'Connection Established.' elif a == 'setProfile': response = '\x00' * 8 elif a == 'result': response = '\x05\x00' elif a == 'delete': response = '\x01\x00' elif a == 'search': response = '\x01\x00' elif a == 'post': response = '\x0c\x00' print 'Receiving Pokemon...' data = req.getvars['data'] bytes = urlsafe_b64decode(data) decrypt = makepkm(bytes) filename = '' if decrypt[0x49] != '\x00': pid = 0 for i in xrange(0, 4): pid += ord(decrypt[i]) << (i * 8) filename = str(pid) else: for i in decrypt[0x48:0x5e]: if i == '\xff': break if i != '\x00': filename += i filename += '.pkm' save(filename, decrypt) cpath = 'in-game, saved to %s' % filename statread(decrypt, cpath) sent = True m = hashlib.sha1() m.update(gtsvar.salt + urlsafe_b64encode(response) + gtsvar.salt) response += m.hexdigest() sendResp(sock, response)