1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-09 22:06:47 +00:00

Separate credentials to also get them for checksum.php later. Fix

missing random import.
This commit is contained in:
Markus Birth 2017-09-01 13:59:12 +02:00
parent e827c6d679
commit 525b2b4256
2 changed files with 12 additions and 5 deletions

View File

@ -4,6 +4,7 @@
# pylint: disable=C0111,C0326
import tcllib
import random
import sys
fc = tcllib.FotaCheck()
@ -25,7 +26,7 @@ fc.cltp = 10
#fc.cltp = 2010
check_xml = fc.do_check()
#print(fc.pretty_xml(check_xml))
print(fc.pretty_xml(check_xml))
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
req_xml = fc.do_request(curef, fv, tv, fw_id)

View File

@ -116,6 +116,15 @@ class FotaCheck:
hexhash = engine.hexdigest()
return hexhash
@staticmethod
def get_creds():
creds = {
b"YWNjb3VudA==": b"emhlbmdodWEuZ2Fv",
b"cGFzc3dvcmQ=": b"cWFydUQ0b2s=",
}
params = {base64.b64decode(key): base64.b64decode(val) for key, val in creds.items()}
return params
'''
private HashMap<String, String> buildDownloadUrisParams(UpdatePackageInfo updatePackageInfo) {
FotaLog.m28v(TAG, "doAfterCheck");
@ -180,10 +189,7 @@ class FotaCheck:
return fileid, fileurl, slaves, encslaves
def encrypt_header(self, address, encslave):
encs = dict()
encs[b"YWNjb3VudA=="] = b"emhlbmdodWEuZ2Fv"
encs[b"cGFzc3dvcmQ="] = b"cWFydUQ0b2s="
params = {base64.b64decode(key): base64.b64decode(val) for key, val in encs.items()}
params = self.get_creds()
params[b"address"] = bytes(address, "utf-8")
url = "https://" + encslave + "/encrypt_header.php"
req = self.sess.post(url, data=params, verify=False)