misp-modules
misp-modules copied to clipboard
XForceExchange: Not handling errors
Original Report: https://gitter.im/MISP/Support?at=5e5acf064eefc06dcf27f477
2020-02-28 14:33:38,855 - misp-modules - ERROR - Something went wrong:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/misp_modules/__init__.py", line 201, in post
response = yield tornado.gen.with_timeout(timeout, self.run_request(jsonpayload))
File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/misp_modules/__init__.py", line 189, in run_request
response = mhandlers[x['module']].handler(q=jsonpayload)
File "modules/expansion/xforceexchange.py", line 164, in handler
parser.parse()
File "modules/expansion/xforceexchange.py", line 43, in parse
getattr(self, to_call)(self.attribute.value)
File "modules/expansion/xforceexchange.py", line 125, in _parse_ip
self._parse_dns(value)
File "modules/expansion/xforceexchange.py", line 108, in _parse_dns
if dns_result.get('Passive') and dns_result['Passive'].get('records'):
AttributeError: 'NoneType' object has no attribute 'get'
https://github.com/MISP/misp-modules/blob/master/misp_modules/modules/expansion/xforceexchange.py#L107-L108
_api_call can return NoneType either via exception, or non 200 HTTP code. This problem appears to be not handled in all calls to _api_call
I do not have an API key to even test this, so can't even begin to figure out the solution.
Same problem here. Dont know what is wrong, but would be great to be fixed soon.