Fixed creation of Indicators instance

This commit is contained in:
Nex committed 2021-08-18 13:12:37 +02:00
1 parent 6a63256b5c
commit 48810af83d
1 file changed
+6 -9
+6 -9
View File
@@ -146,10 +146,9 @@ def check_backup(ctx, iocs, output, fast, backup_path, list_modules, module):
log.critical("Unable to create output folder %s: %s", output, e) log.critical("Unable to create output folder %s: %s", output, e)
ctx.exit(1) ctx.exit(1)
indicators = Indicators(log=log)
for ioc_path in iocs: for ioc_path in iocs:
try: try:
indicators = Indicators()
indicators.log = log
indicators.parse_stix2(ioc_path) indicators.parse_stix2(ioc_path)
except IndicatorsFileBadFormat as e: except IndicatorsFileBadFormat as e:
log.critical(e) log.critical(e)
@@ -166,8 +165,8 @@ def check_backup(ctx, iocs, output, fast, backup_path, list_modules, module):
m.is_backup = True m.is_backup = True
if iocs: if iocs:
indicators.log = m.log
m.indicators = indicators m.indicators = indicators
m.indicators.log = m.log
run_module(m) run_module(m)
timeline.extend(m.timeline) timeline.extend(m.timeline)
@@ -209,10 +208,9 @@ def check_fs(ctx, iocs, output, fast, dump_path, list_modules, module):
log.critical("Unable to create output folder %s: %s", output, e) log.critical("Unable to create output folder %s: %s", output, e)
ctx.exit(1) ctx.exit(1)
indicators = Indicators(log=log)
for ioc_path in iocs: for ioc_path in iocs:
try: try:
indicators = Indicators()
indicators.log = log
indicators.parse_stix2(ioc_path) indicators.parse_stix2(ioc_path)
except IndicatorsFileBadFormat as e: except IndicatorsFileBadFormat as e:
log.critical(e) log.critical(e)
@@ -230,8 +228,8 @@ def check_fs(ctx, iocs, output, fast, dump_path, list_modules, module):
m.is_fs_dump = True m.is_fs_dump = True
if iocs: if iocs:
indicators.log = m.log
m.indicators = indicators m.indicators = indicators
m.indicators.log = m.log
run_module(m) run_module(m)
timeline.extend(m.timeline) timeline.extend(m.timeline)
@@ -269,10 +267,9 @@ def check_iocs(ctx, iocs, list_modules, module, folder):
log.info("Checking stored results against provided indicators...") log.info("Checking stored results against provided indicators...")
indicators = Indicators(log=log)
for ioc_path in iocs: for ioc_path in iocs:
try: try:
indicators = Indicators()
indicators.log = log
indicators.parse_stix2(ioc_path) indicators.parse_stix2(ioc_path)
except IndicatorsFileBadFormat as e: except IndicatorsFileBadFormat as e:
log.critical(e) log.critical(e)
@@ -295,8 +292,8 @@ def check_iocs(ctx, iocs, list_modules, module, folder):
m = iocs_module.from_json(file_path, m = iocs_module.from_json(file_path,
log=logging.getLogger(iocs_module.__module__)) log=logging.getLogger(iocs_module.__module__))
indicators.log = m.log
m.indicators = indicators m.indicators = indicators
m.indicators.log = m.log
try: try:
m.check_indicators() m.check_indicators()