1
0

Rename encrypt_header to do_encrypt_header. Changed signature. Also

write header.bin since we already received it.
This commit is contained in:
2017-09-01 14:07:06 +02:00
parent 525b2b4256
commit 98daf57086
3 changed files with 13 additions and 7 deletions
+3 -6
View File
@@ -188,17 +188,14 @@ class FotaCheck:
encslaves = [s.text for s in enc_list]
return fileid, fileurl, slaves, encslaves
def encrypt_header(self, address, encslave):
def do_encrypt_header(self, encslave, address):
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)
# Expect "HTTP 206 Partial Content" response
if req.status_code == 206: # partial
#return req.content
contentlength = int(req.headers["Content-Length"])
sentinel = "\nHEADER FOUND" if contentlength == 4194320 else "\nNO HEADER FOUND"
return sentinel
if req.status_code == 206:
return req.content
else:
print("ENCRYPT: " + repr(req))
print(repr(req.headers))