From f60b44ddea80f4717b1b94745ad010826957cd45 Mon Sep 17 00:00:00 2001 From: thurask Date: Fri, 3 Nov 2017 01:00:49 -0400 Subject: [PATCH] save downloaded encrypted headers in subfolder --- .gitignore | 1 + tclcheck.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bfc1f68..d0f56cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /__pycache__/ /logs/ +/headers/ /.nvimlog /header*.bin diff --git a/tclcheck.py b/tclcheck.py index 6ba74f8..3945cd3 100755 --- a/tclcheck.py +++ b/tclcheck.py @@ -3,6 +3,7 @@ # pylint: disable=C0111,C0326,C0103 +import os import random import sys import tcllib @@ -44,9 +45,13 @@ for s in slaves: if fc.mode == fc.MODE.FULL: 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: - print("Header length check passed. Writing to header_{}.bin.".format(tv)) - with open("header_{}.bin".format(tv), "wb") as f: + print("Header length check passed. Writing to {}.".format(headname)) + with open(os.path.join(headdir, headname), "wb") as f: f.write(header) else: print("Header length invalid ({}).".format(len(header)))