fix: Avoiding KeyError exception when no result is found

chrisr3d 2019-11-17 18:00:19 -05:00
parent 91d6f1baa0
commit 4990bcebd8
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 1 additions and 1 deletions

View File

@ -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)