Adds generation of reference info.json hash

This commit is contained in:
tek 2023-02-21 14:10:38 -05:00
parent f6814add71
commit 08277bfa87

View File

@ -13,7 +13,7 @@ from typing import Callable, Optional
from mvt.common.indicators import Indicators
from mvt.common.module import run_module, save_timeline
from mvt.common.utils import convert_datetime_to_iso, generate_hashes_from_path
from mvt.common.utils import convert_datetime_to_iso, generate_hashes_from_path, get_sha256_from_file_path
from mvt.common.version import MVT_VERSION
@ -119,6 +119,10 @@ class Command:
with open(info_path, "w+", encoding="utf-8") as handle:
json.dump(info, handle, indent=4)
if self.target_path and (os.environ.get("MVT_HASH_FILES") or self.hashes):
info_hash = get_sha256_from_file_path(info_path)
self.log.warning("Reference hash of the info.json file : %s", info_hash)
def generate_hashes(self) -> None:
"""
Compute hashes for files in the target_path