mirror of https://github.com/MISP/misp-modules
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 parsepull/520/head
parent
7645b97bf7
commit
1d7f0ee1f0
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue