1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-10 06:16:46 +00:00

reenable args, pass cltp into vkhash

This commit is contained in:
thurask 2017-08-23 19:39:24 -04:00
parent 3145027304
commit 2ed352a090
No known key found for this signature in database
GPG Key ID: A6CCCDEA29795048

View File

@ -105,8 +105,8 @@ class FotaCheck:
filehash = fileinfo.find("CHECKSUM").text filehash = fileinfo.find("CHECKSUM").text
return curef, fv, tv, fw_id, fileid, filename, filesize, filehash return curef, fv, tv, fw_id, fileid, filename, filesize, filehash
def get_vk2(self, params_dict): def get_vk2(self, params_dict, cltp):
params_dict["cltp"] = 10 params_dict["cltp"] = cltp
query = "" query = ""
for k, v in params_dict.items(): for k, v in params_dict.items():
if len(query) > 0: if len(query) > 0:
@ -151,7 +151,7 @@ class FotaCheck:
params["type"] = self.ftype params["type"] = self.ftype
params["fw_id"] = fw_id params["fw_id"] = fw_id
params["mode"] = self.mode params["mode"] = self.mode
params["vk"] = self.get_vk2(params) params["vk"] = self.get_vk2(params, self.cltp)
params["cltp"] = self.cltp params["cltp"] = self.cltp
params["cktp"] = self.cktp params["cktp"] = self.cktp
params["rtd"] = self.rtd params["rtd"] = self.rtd
@ -190,7 +190,7 @@ class FotaCheck:
url = "http://" + encslave + "/encrypt_header.php" url = "http://" + encslave + "/encrypt_header.php"
req = self.sess.post(url, data=params) req = self.sess.post(url, data=params)
if req.status_code == 206: # partial if req.status_code == 206: # partial
#return req.text #return req.content
contentlength = int(req.headers["Content-Length"]) contentlength = int(req.headers["Content-Length"])
sentinel = "\nHEADER FOUND" if contentlength == 4194320 else "\nNO HEADER FOUND" sentinel = "\nHEADER FOUND" if contentlength == 4194320 else "\nNO HEADER FOUND"
return sentinel return sentinel
@ -202,11 +202,20 @@ class FotaCheck:
if __name__ == "__main__": if __name__ == "__main__":
fc = FotaCheck() fc = FotaCheck()
if len(sys.argv) == 3: # python tclcheck.py $PRD $FV = OTA delta for $PRD from $FV
fc.curef = sys.argv[1]
fc.fv = sys.argv[2]
fc.mode = fc.MODE_OTA
elif len(sys.argv) == 2: # python tclcheck.py $PRD = FULL for $PRD
fc.curef = sys.argv[1]
fc.fv = "AAM481"
fc.mode = fc.MODE_FULL
else: # python tclcheck.py = OTA for default PRD, FV
fc.curef = "PRD-63117-011"
fc.fv = "AAM481"
fc.mode = fc.MODE_OTA
fc.serid = "3531510" fc.serid = "3531510"
fc.curef = "PRD-63117-011"
fc.fv = "AAM481"
#fc.osvs = "7.1.1" #fc.osvs = "7.1.1"
fc.mode = fc.MODE_OTA
fc.cltp = 10 fc.cltp = 10
check_xml = fc.do_check() check_xml = fc.do_check()