Skip to content

Instantly share code, notes, and snippets.

Created July 31, 2016 14:11
Show Gist options
  • Save anonymous/34fb84c8807da5bda7e2ad084eb625d6 to your computer and use it in GitHub Desktop.
Save anonymous/34fb84c8807da5bda7e2ad084eb625d6 to your computer and use it in GitHub Desktop.
Just use it and don't think of it.
def connect(email, password):
'''
Atrocious function to connect to Pokémon Go with a Google account.
I have no shame.
Returns the identification token on success, 'None' otherwise.
'''
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
url = b'https://android.clients.google.com/auth?device_country=us&accountType=HOSTED_OR_GOOGLE&lang=us&sdk_version=17&androidId=9774d56d682e549c&service=ac2dm&source=android&operatorCountry=us&has_permission=1&Email=%s&EncryptedPasswd=%s&'
cipher = PKCS1_OAEP.new(RSA.construct((0xca26ff56bfbf495b94ed946ebb7ad09da072e5d296318541781cc995af7962c4c28ea9af0822de224865da1dca129942b356a799ca277b2b4577145be175043ddb684546726120a9a2d950d0639b4e7ba4a448d7a901d18a69786c79a884394232b3b11f044d06ca2cd5a0458d1044d573df890c251dcffcb8076b1ffaae67f9, 0x10001)))
try:
return __import__('requests').post((url + b'service=audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com&app=com.nianticlabs.pokemongo&client_sig=321187995bc7cdc2b5fc91b11a96e2baa8602c62') % (email.replace('@', '%40').encode(), __import__('requests').post((url + b'add_account=1') % (email.replace('@', '%40').encode(), __import__('base64').urlsafe_b64encode(b'\x00W\x1b\xe0\xa4' + cipher.encrypt((email + '\x00' + password).encode())))).content.split(b'\n')[3][6:])).content.split(b'\n')[2][5:]
except:
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment