returning back to the beggining of the thread...
I tried to use this link in order to find the firmware from the CDN
the good news is I've managed to understand how to calculate the s= field and I get in return 200 (OK) responses for my requests.
the bad news is that even if I do this request to "previous" version (3.0.15 on earlier) it doesn't seem to return 3.0.16 firmware as an upgrade.
it is important to mention that I used the same technique from the chinese CDN and I managed to get 1.0.67 link, so it seems that the problem is that 3.0.16 doesn't exist at all in the CDN.
I am pasting the script here if someone wants to take a look. I hope that it'll work on the future when a new INT firmware will be released.
import requests
import datetime
import base64
import hashlib
DEFAULT_TOKEN = "8007236f-a2d6-4847-ac83-c49395ad6d65"
LINK = 'http://sg.api.miwifi.com/rs/grayupgrade'
def md5_base64(data):
b64_data = base64.b64encode(data.encode())
return hashlib.md5(b64_data).hexdigest()
def calculate_s(params_to_hash):
params_sorted = {k: v for k, v in sorted(params_to_hash.items(), key=lambda item: item[0])}
params_str = ''
for k, v in params_sorted.items():
params_str += f'{k}={v}&'
params_str += DEFAULT_TOKEN
result = md5_base64(params_str)
print(result)
return result
def main():
now = datetime.datetime.now()
params_to_hash = {
"countryCode": 'EU',
"rom": '3.0.16',
"serialNumber": 'my_serial_number',
"rootfs": '0.0.1',
"cfe": '1.0.2',
"deviceID": 'my_device_id',
"ispCode": '',
"linux": '4.4.16',
"sqafs": '0.0.1',
"hardware": 'R3600',
"locale": 'en_US',
"ramfs": '0.0.1',
"channel": 'release',
'time': now.strftime('%Y-%m-%d---%H:%M:%S')
}
params_to_hash['s'] = calculate_s(params_to_hash)
params_to_hash['token'] = DEFAULT_TOKEN
response = requests.get(LINK, params=params_to_hash)
if response.ok:
print(response.text)
else:
print("invalid token")
if __name__ == '__main__':
main()
UPDATE:
it worked as kokesan mentions the new INT link according to the API:
{"code":"0","data":{"needUpgrade":true,"size":31728232,"changelogUrl":"https://cdn.alsgp0.fds.api.mi-img.com/miwifi/4fa89995-0d6f-41c3-8aae-e0dc41280fe2.html","link":"http://cdn.alsgp0.fds.api.mi-img.com/xiaoqiang/rom/r3600/miwifi_r3600_all_6510e_3.0.22_INT.bin","description":"","weight":"1","upgradeId":"419","hash":"6fff38bccffd94866335c9ae30b6510e","toVersion":"3.0.22"}}