grindr-session/gcm_re.py

71 lines
2.3 KiB
Python
Executable File

import random
import requests
import checkin_pb2
def get_android_id():
# most minimal checkin request possible
cr = checkin_pb2.CheckinRequest()
cr.androidId = 0
cr.checkin.build.fingerprint = "google/razor/flo:5.0.1/LRX22C/1602158:user/release-keys"
cr.checkin.build.hardware = "flo"
cr.checkin.build.brand = "google"
cr.checkin.build.radio = "FLO-04.04"
cr.checkin.build.clientId = "android-google"
cr.checkin.build.sdkVersion = 21
cr.checkin.lastCheckinMs = 0
cr.locale = "en"
cr.macAddress.append("".join(random.choice("ABCDEF0123456789") for _ in range(12)))
cr.meid = "".join(random.choice("0123456789") for _ in range(15))
cr.timeZone = "America/Los_Angeles"
cr.version = 3
cr.otaCert.append("--no-output--")
cr.macAddressType.append("wifi")
cr.fragment = 0
cr.userSerialNumber = 0
data = cr.SerializeToString()
headers = {
"Content-type": "application/x-protobuffer",
"Accept-Encoding": "gzip",
"User-Agent": "Android-Checkin/2.0 (vbox86p JLS36G); gzip",
}
r = requests.post("https://android.clients.google.com/checkin", headers=headers, data=data)
if r.status_code == 200:
cresp = checkin_pb2.CheckinResponse()
cresp.ParseFromString(r.content)
android_id = cresp.androidId
security_token = cresp.securityToken
return android_id, security_token
else:
print(r.text)
def get_gcm_token(android_id, security_token):
headers = {"Authorization": "AidLogin {}:{}".format(android_id, security_token)}
data = {
'app': 'com.grindrapp.android',
'sender': '1036042917246',
'device': str(android_id),
# 'cert': 'ce1f7e703ccca26d2c4ef3e48fd5ae0ea4cb1c29',
# 'app_ver': '1001800',
# 'gcm_ver': '11055448',
# 'X-appid': '$randomString',
'X-scope': 'GCM',
# 'X-app_ver_name': '4.48.0',
}
r = requests.post("https://android.clients.google.com/c2dm/register3", data=data, headers=headers)
if r.status_code == 200:
return r.text.split('=')[1]
else:
print(r.status_code, r.text)
if __name__ == '__main__':
android_id, security_token = get_android_id()
print(android_id, security_token)
print(get_gcm_token(android_id, security_token))