diff --git a/src/mvt/common/cmd_check_iocs.py b/src/mvt/common/cmd_check_iocs.py index 696803a..2db6edb 100644 --- a/src/mvt/common/cmd_check_iocs.py +++ b/src/mvt/common/cmd_check_iocs.py @@ -65,6 +65,10 @@ class CmdCheckIOCS(Command): m = iocs_module.from_json( file_path, log=logging.getLogger(iocs_module.__module__) ) + if not m: + log.warning("No result from this module, skipping it") + continue + if self.iocs.total_ioc_count > 0: m.indicators = self.iocs m.indicators.log = m.log diff --git a/src/mvt/common/module.py b/src/mvt/common/module.py index 1468cf4..2a52677 100644 --- a/src/mvt/common/module.py +++ b/src/mvt/common/module.py @@ -69,10 +69,14 @@ class MVTModule: @classmethod def from_json(cls, json_path: str, log: logging.Logger): with open(json_path, "r", encoding="utf-8") as handle: - results = json.load(handle) - if log: - log.info('Loaded %d results from "%s"', len(results), json_path) - return cls(results=results, log=log) + try: + results = json.load(handle) + if log: + log.info('Loaded %d results from "%s"', len(results), json_path) + return cls(results=results, log=log) + except json.decoder.JSONDecodeError as err: + log.error('Error to decode the json "%s" file: "%s"', json_path, err) + return None @classmethod def get_slug(cls) -> str: