Hashing files only when MVT_HASH_FILES env is set

This commit is contained in:
Nex 2022-06-20 23:41:59 +02:00
parent 4830aa5a6c
commit 3899dce353
1 changed files with 3 additions and 1 deletions

View File

@ -89,7 +89,9 @@ class Command(object):
for coll in self.iocs.ioc_collections:
info["ioc_files"].append(coll.get("stix2_file_path", ""))
if self.target_path:
# TODO: Revisit if setting this from environment variable is good
# enough.
if self.target_path and os.environ.get("MVT_HASH_FILES"):
if os.path.isfile(self.target_path):
h = hashlib.sha256()
with open(self.target_path, "rb") as handle: