From 4917b87741ce73f919c3403e14b6a1046e306239 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Fri, 12 Jan 2018 00:31:39 +0100 Subject: [PATCH] Also output download links for Amazon S3 servers. --- tclcheck.py | 5 ++++- tcldown.py | 5 ++++- tcllib.py | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tclcheck.py b/tclcheck.py index 2439657..74ee4ac 100755 --- a/tclcheck.py +++ b/tclcheck.py @@ -68,11 +68,14 @@ curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml) req_xml = fc.do_request(curef, fv, tv, fw_id) print(fc.pretty_xml(req_xml)) -fileid, fileurl, slaves, encslaves = fc.parse_request(req_xml) +fileid, fileurl, slaves, encslaves, s3_fileurl, s3_slaves = fc.parse_request(req_xml) for s in slaves: print("http://{}{}".format(s, fileurl)) +for s in s3_slaves: + print("http://{}{}".format(s, s3_fileurl)) + if fc.mode == fc.MODE.FULL: header = fc.do_encrypt_header(random.choice(encslaves), fileurl) headname = "header_{}.bin".format(tv) diff --git a/tcldown.py b/tcldown.py index 9c3790a..0e624b4 100644 --- a/tcldown.py +++ b/tcldown.py @@ -61,11 +61,14 @@ tv = args.targetversion[0] fw_id = args.fwid[0] req_xml = fc.do_request(fc.curef, fv, tv, fw_id) print(fc.pretty_xml(req_xml)) -fileid, fileurl, slaves, encslaves = fc.parse_request(req_xml) +fileid, fileurl, slaves, encslaves, s3_fileurl, s3_slaves = fc.parse_request(req_xml) for s in slaves: print("http://{}{}".format(s, fileurl)) +for s in s3_slaves: + print("http://{}{}".format(s, s3_fileurl)) + if fc.mode == fc.MODE.FULL: header = fc.do_encrypt_header(random.choice(encslaves), fileurl) headname = "header_{}.bin".format(tv) diff --git a/tcllib.py b/tcllib.py index 705e613..4e9ce1b 100644 --- a/tcllib.py +++ b/tcllib.py @@ -367,11 +367,14 @@ class FotaCheck: file = root.find("FILE_LIST").find("FILE") fileid = file.find("FILE_ID").text fileurl = file.find("DOWNLOAD_URL").text + s3_fileurl = file.find("S3_DOWNLOAD_URL").text slave_list = root.find("SLAVE_LIST").findall("SLAVE") enc_list = root.find("SLAVE_LIST").findall("ENCRYPT_SLAVE") + s3_slave_list = root.find("SLAVE_LIST").findall("S3_SLAVE") slaves = [s.text for s in slave_list] encslaves = [s.text for s in enc_list] - return fileid, fileurl, slaves, encslaves + s3_slaves = [s.text for s in s3_slave_list] + return fileid, fileurl, slaves, encslaves, s3_fileurl, s3_slaves def do_encrypt_header(self, encslave, address): params = self.get_creds()