from decrypt import *
import urllib2, base64, json, threading, sys, urllib
global checkurl
checkurl = 'http://update.miui.com/updates/miotaV3.php'
default = {
"n":"", # I don't know what this parameter is
"unlock":"1", # 1 means bootloader is unlocked. 0 means locked.
"g":"00000000000000000000000000000000", # This seems to be the android_id of the device. Maybe encoded somehow.
"sn":"0x00000000", # Probably the serial number of the device, maybe encoded somehow.
"a":"0", # Don't know what this is.
"v":"MIUI-V9.2.1.0.NBGMIEK", # The version of MIUI installed.
"l":"en_US", # The locale.
"i":"0000000000000000000000000000000000000000000000000000000000000000", # This seems to be the imei of the device, obviously encoded somehow.
"b":"F", # Same as above, 'X' for weekly build.
"c":"7.0", # Same as 'c' above, it's the Android version.
"sys":"0", # I don't know what this is.
"p":"msm8996", # The chipset
"id":"", # I don't' know what this is.
"cts":"0", # I don't know what this is.
"d":"natrium_global", # The device name, same as above, chiron for Chinese, chiron_global for global.
"f":"1", # I don't know what this is.
"bv":"9", # I don't know what this is.
"isR":"0", # I don't know what this is.
"r":"CN" # I don't know what this is, maybe region of device?
}
def makeRequest(inp, tval="", sval="1"):
js = json.dumps(inp, separators=(',', ':'))
global svalue
postdata = "q="+urllib.quote_plus(encrypt(js))+"&t="+tval+"&s=" + sval
print postdata
global checkurl
try:
response = urllib2.urlopen(checkurl, postdata)
ret = response.read()
r = decrypt(ret)
json.loads(r)
except:
print "Problem"
print(makeRequest(default))