Browse Source

fix: Avoiding KeyError exception when no result is found

pull/352/head
chrisr3d 2 years ago
parent
commit
4990bcebd8
No known key found for this signature in database GPG Key ID: 6BBED1B63A6D639F
  1. 2
      misp_modules/modules/expansion/xforceexchange.py

2
misp_modules/modules/expansion/xforceexchange.py

@ -105,7 +105,7 @@ class XforceExchange():
def _parse_dns(self, value):
dns_result = self._api_call(f'{self.base_url}/resolve/{value}')
if dns_result and dns_result['Passive'].get('records'):
if dns_result.get('Passive') and dns_result['Passive'].get('records'):
itype, ftype, value = self._fetch_types(dns_result['Passive']['query'])
misp_object = MISPObject('domain-ip')
misp_object.add_attribute(itype, value)

Loading…
Cancel
Save