mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
save downloaded encrypted headers in subfolder
This commit is contained in:
parent
26745f024d
commit
f60b44ddea
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
/__pycache__/
|
/__pycache__/
|
||||||
/logs/
|
/logs/
|
||||||
|
/headers/
|
||||||
/.nvimlog
|
/.nvimlog
|
||||||
/header*.bin
|
/header*.bin
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
# pylint: disable=C0111,C0326,C0103
|
# pylint: disable=C0111,C0326,C0103
|
||||||
|
|
||||||
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import tcllib
|
import tcllib
|
||||||
@ -44,9 +45,13 @@ for s in slaves:
|
|||||||
|
|
||||||
if fc.mode == fc.MODE.FULL:
|
if fc.mode == fc.MODE.FULL:
|
||||||
header = fc.do_encrypt_header(random.choice(encslaves), fileurl)
|
header = fc.do_encrypt_header(random.choice(encslaves), fileurl)
|
||||||
|
headname = "header_{}.bin".format(tv)
|
||||||
|
headdir = "headers"
|
||||||
|
if not os.path.exists(headdir):
|
||||||
|
os.makedirs(headdir)
|
||||||
if len(header) == 4194320:
|
if len(header) == 4194320:
|
||||||
print("Header length check passed. Writing to header_{}.bin.".format(tv))
|
print("Header length check passed. Writing to {}.".format(headname))
|
||||||
with open("header_{}.bin".format(tv), "wb") as f:
|
with open(os.path.join(headdir, headname), "wb") as f:
|
||||||
f.write(header)
|
f.write(header)
|
||||||
else:
|
else:
|
||||||
print("Header length invalid ({}).".format(len(header)))
|
print("Header length invalid ({}).".format(len(header)))
|
||||||
|
Loading…
Reference in New Issue
Block a user