mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-14 00:06:46 +00:00
Also output checksums when using tclcheck.py.
This commit is contained in:
parent
4917b87741
commit
a3dca9a52a
@ -70,6 +70,9 @@ req_xml = fc.do_request(curef, fv, tv, fw_id)
|
|||||||
print(fc.pretty_xml(req_xml))
|
print(fc.pretty_xml(req_xml))
|
||||||
fileid, fileurl, slaves, encslaves, s3_fileurl, s3_slaves = fc.parse_request(req_xml)
|
fileid, fileurl, slaves, encslaves, s3_fileurl, s3_slaves = fc.parse_request(req_xml)
|
||||||
|
|
||||||
|
chksum_xml = fc.do_checksum(random.choice(encslaves), fileurl, fileurl)
|
||||||
|
print(fc.pretty_xml(chksum_xml))
|
||||||
|
|
||||||
for s in slaves:
|
for s in slaves:
|
||||||
print("http://{}{}".format(s, fileurl))
|
print("http://{}{}".format(s, fileurl))
|
||||||
|
|
||||||
|
28
tcllib.py
28
tcllib.py
@ -308,6 +308,15 @@ class FotaCheck:
|
|||||||
params = {base64.b64decode(key): base64.b64decode(val) for key, val in creds.items()}
|
params = {base64.b64decode(key): base64.b64decode(val) for key, val in creds.items()}
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_creds2():
|
||||||
|
creds = {
|
||||||
|
b"YWNjb3VudA==": b"VGVsZUV4dFRlc3Q=",
|
||||||
|
b"cGFzc3dvcmQ=": b"dDA1MjM=",
|
||||||
|
}
|
||||||
|
params = {base64.b64decode(key): base64.b64decode(val) for key, val in creds.items()}
|
||||||
|
return params
|
||||||
|
|
||||||
'''
|
'''
|
||||||
private HashMap<String, String> buildDownloadUrisParams(UpdatePackageInfo updatePackageInfo) {
|
private HashMap<String, String> buildDownloadUrisParams(UpdatePackageInfo updatePackageInfo) {
|
||||||
FotaLog.m28v(TAG, "doAfterCheck");
|
FotaLog.m28v(TAG, "doAfterCheck");
|
||||||
@ -379,7 +388,7 @@ class FotaCheck:
|
|||||||
def do_encrypt_header(self, encslave, address):
|
def do_encrypt_header(self, encslave, address):
|
||||||
params = self.get_creds()
|
params = self.get_creds()
|
||||||
params[b"address"] = bytes(address, "utf-8")
|
params[b"address"] = bytes(address, "utf-8")
|
||||||
url = "https://" + encslave + "/encrypt_header.php"
|
url = "http://" + encslave + "/encrypt_header.php"
|
||||||
req = self.sess.post(url, data=params, verify=False)
|
req = self.sess.post(url, data=params, verify=False)
|
||||||
# Expect "HTTP 206 Partial Content" response
|
# Expect "HTTP 206 Partial Content" response
|
||||||
if req.status_code == 206:
|
if req.status_code == 206:
|
||||||
@ -389,3 +398,20 @@ class FotaCheck:
|
|||||||
print(repr(req.headers))
|
print(repr(req.headers))
|
||||||
print(repr(req.text))
|
print(repr(req.text))
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
|
def do_checksum(self, encslave, uri1, uri2):
|
||||||
|
url = "http://" + encslave + "/checksum.php"
|
||||||
|
params = self.get_creds2()
|
||||||
|
params[b"address"] = bytes('{"' + uri1 + '":"' + uri2 + '"}', "utf-8")
|
||||||
|
|
||||||
|
#print(repr(dict(params)))
|
||||||
|
req = self.sess.post(url, data=params)
|
||||||
|
if req.status_code == 200:
|
||||||
|
req.encoding = "utf-8" # Force encoding as server doesn't give one
|
||||||
|
self.write_dump(req.text)
|
||||||
|
return req.text
|
||||||
|
else:
|
||||||
|
print("CHECKSUM: " + repr(req))
|
||||||
|
print(repr(req.headers))
|
||||||
|
print(repr(req.text))
|
||||||
|
raise SystemExit
|
||||||
|
Loading…
Reference in New Issue
Block a user