Skip to content

Instantly share code, notes, and snippets.

@AlexxIT
Created December 22, 2019 10:55
Show Gist options
  • Save AlexxIT/9fc9781c3463f0f843719f3ddd8b27c2 to your computer and use it in GitHub Desktop.
Save AlexxIT/9fc9781c3463f0f843719f3ddd8b27c2 to your computer and use it in GitHub Desktop.
import base64
import hashlib
import hmac
import json
import time
import uuid
import requests
user = 'mymail@gmail.com'
pass_ = 'mypass'
app_details = {
'email': user,
'password': pass_,
'version': 6,
'ts': int(time.time()),
'nonce': int(time.time_ns() / 10000),
'appid': 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq',
'imei': str(uuid.uuid4()),
'os': 'android',
'model': '',
'romVersion': '',
'appVersion': '3.12.0'
}
decryptedAppSecret = b'6Nz4n0xA8s8qdxQf2GqurZj2Fs55FUvM'
hex_dig = hmac.new(
decryptedAppSecret,
str.encode(json.dumps(app_details)),
digestmod=hashlib.sha256).digest()
sign = base64.b64encode(hex_dig).decode()
_headers = {
'Authorization': 'Sign ' + sign
}
r = requests.post('https://eu-api.coolkit.cc:8080/api/user/login',
headers=_headers, json=app_details)
resp = r.json()
print(resp)
_headers = {
'Authorization': f"Bearer {resp['at']}"
}
params = {
'lang': 'en',
'apiKey': resp['user']['apikey'],
'getTags': 1,
'version': 6,
'ts': int(time.time()),
'nonce': int(time.time_ns() / 10000),
'appid': 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq',
'imei': str(uuid.uuid4()),
'os': 'android',
'model': '',
'romVersion': '',
'appVersion': '3.12.0'
}
r = requests.get('https://eu-api.coolkit.cc:8080/api/user/device',
headers=_headers, params=params)
with open('out.json', 'wb') as f:
f.write(r.content)
print(r.content)
@AlexxIT
Copy link
Author

AlexxIT commented Dec 22, 2019

deviceid and devicekey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment