Browse Source

fix: Catching results exceptions properly

pull/340/head
chrisr3d 2 years ago
parent
commit
8bcb630340
No known key found for this signature in database GPG Key ID: 6BBED1B63A6D639F
  1. 6
      misp_modules/modules/expansion/dbl_spamhaus.py

6
misp_modules/modules/expansion/dbl_spamhaus.py

@ -49,8 +49,10 @@ def handler(q=False):
try:
query_result = resolver.query(query, 'A')[0]
result = "{} - {}".format(requested_value, dbl_mapping[str(query_result)])
except Exception as e:
result = str(e)
except dns.resolver.NXDOMAIN as e:
result = e.msg
except Exception:
return {'error': 'Not able to reach dbl.spamhaus.org or something went wrong'}
return {'results': [{'types': mispattributes.get('output'), 'values': result}]}

Loading…
Cancel
Save