From bad538653d304086c6940f72df12f91f3112d223 Mon Sep 17 00:00:00 2001 From: Jesse Hedden Date: Fri, 4 Dec 2020 11:59:57 -0800 Subject: [PATCH] added more explicit error messages for indicators that return no enrichment data --- misp_modules/modules/expansion/trustar_enrich.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misp_modules/modules/expansion/trustar_enrich.py b/misp_modules/modules/expansion/trustar_enrich.py index 1724441..b7ee2a4 100644 --- a/misp_modules/modules/expansion/trustar_enrich.py +++ b/misp_modules/modules/expansion/trustar_enrich.py @@ -195,12 +195,16 @@ def handler(q=False): try: metadata = trustar_parser.ts_client.get_indicators_metadata([Indicator(value=attribute['value'])])[0] + except IndexError: + misperrors['error'] += f" -- No metadata found for indicator {attribute['value']}" except Exception as e: misperrors['error'] += f" -- Could not retrieve indicator metadata from TruSTAR {e}" try: summary = list( trustar_parser.ts_client.get_indicator_summaries([attribute['value']], page_size=MAX_PAGE_SIZE))[0] + except IndexError: + misperrors['error'] += f" -- No summary data found for indicator {attribute['value']}" except Exception as e: misperrors['error'] += f" -- Unable to retrieve TruSTAR summary data: {e}"