mirror of
https://github.com/mvt-project/mvt.git
synced 2026-10-10 18:03:56 +02:00
* Fix issue #574 for a module without IOCs output
This commit is contained in:
1 parent
e34e03d3a3
commit
3dedd169c4
2 files changed
+12
-4
No files matched your search
@@ -65,6 +65,10 @@ class CmdCheckIOCS(Command):
|
|||||||
m = iocs_module.from_json(
|
m = iocs_module.from_json(
|
||||||
file_path, log=logging.getLogger(iocs_module.__module__)
|
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:
|
if self.iocs.total_ioc_count > 0:
|
||||||
m.indicators = self.iocs
|
m.indicators = self.iocs
|
||||||
m.indicators.log = m.log
|
m.indicators.log = m.log
|
||||||
|
|||||||
@@ -69,10 +69,14 @@ class MVTModule:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, json_path: str, log: logging.Logger):
|
def from_json(cls, json_path: str, log: logging.Logger):
|
||||||
with open(json_path, "r", encoding="utf-8") as handle:
|
with open(json_path, "r", encoding="utf-8") as handle:
|
||||||
results = json.load(handle)
|
try:
|
||||||
if log:
|
results = json.load(handle)
|
||||||
log.info('Loaded %d results from "%s"', len(results), json_path)
|
if log:
|
||||||
return cls(results=results, log=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
|
@classmethod
|
||||||
def get_slug(cls) -> str:
|
def get_slug(cls) -> str:
|
||||||
|
|||||||
Reference in new issue
Block a user