fix: [dns] add the exception in the error message

As there are still distribution installing old version of dnspython,
it's easier to debug if we receive the exception directly in misp-module.
pull/664/head
Alexandre Dulaunoy 2024-05-09 17:03:18 +02:00
parent 0774c75ac3
commit 55d7fc95dc
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import dns.resolver
misperrors = {'error': 'Error'}
mispattributes = {'input': ['hostname', 'domain', 'domain|ip'], 'output': ['ip-src',
'ip-dst']}
moduleinfo = {'version': '0.2', 'author': 'Alexandre Dulaunoy',
moduleinfo = {'version': '0.3', 'author': 'Alexandre Dulaunoy',
'description': 'Simple DNS expansion service to resolve IP address from MISP attributes',
'module-type': ['expansion', 'hover']}
@ -43,8 +43,8 @@ def handler(q=False):
except dns.exception.Timeout:
misperrors['error'] = "Timeout"
return misperrors
except Exception:
misperrors['error'] = "DNS resolving error"
except Exception as e:
misperrors['error'] = f'DNS resolving error {e}'
return misperrors
r = {'results': [{'types': mispattributes['output'],