From 1d7f0ee1f0cadee76684039a61e7ec397f904493 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Thu, 26 Aug 2021 15:02:32 +0200 Subject: [PATCH] fix: [hashlookup] Fixed the errors handling - Since the modules system is waiting for a dict, we return `misperrors` instead of the actual value of the 'error' key, and the module will no longer fail when there is no result to parse --- misp_modules/modules/expansion/hashlookup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/misp_modules/modules/expansion/hashlookup.py b/misp_modules/modules/expansion/hashlookup.py index d71597b..82872a0 100644 --- a/misp_modules/modules/expansion/hashlookup.py +++ b/misp_modules/modules/expansion/hashlookup.py @@ -70,17 +70,16 @@ def handler(q=False): hashlookupresult = r.json() if not hashlookupresult: misperrors['error'] = 'Empty result' - return misperrors['error'] + return misperrors elif r.status_code == 404: misperrors['error'] = 'Non existing hash' - return misperrors['error'] + return misperrors else: misperrors['error'] = 'API not accessible' - return misperrors['error'] + return misperrors parser = HashlookupParser(attribute, hashlookupresult, api_url) parser.parse_hashlookup_information() result = parser.get_result() - print(result) return result