fix: exception in MISP module when a domain cannot be resolved

pull/986/head
Raphaël Vinot 2024-11-05 10:15:42 +01:00
parent 35b4748cbd
commit 3f07e22a73
1 changed files with 5 additions and 4 deletions

View File

@ -257,10 +257,11 @@ class MISP(AbstractModule):
tld = self.psl.publicsuffix(hostnode.name) tld = self.psl.publicsuffix(hostnode.name)
domain = re.sub(f'.{tld}$', '', hostnode.name).split('.')[-1] domain = re.sub(f'.{tld}$', '', hostnode.name).split('.')[-1]
to_lookup = [node.name, hostnode.name, f'{domain}.{tld}'] to_lookup = [node.name, hostnode.name, f'{domain}.{tld}']
if 'v4' in hostnode.resolved_ips: if hasattr(hostnode, 'resolved_ips'):
to_lookup += hostnode.resolved_ips['v4'] if 'v4' in hostnode.resolved_ips:
if 'v6' in hostnode.resolved_ips: to_lookup += hostnode.resolved_ips['v4']
to_lookup += hostnode.resolved_ips['v6'] if 'v6' in hostnode.resolved_ips:
to_lookup += hostnode.resolved_ips['v6']
if hasattr(hostnode, 'cnames'): if hasattr(hostnode, 'cnames'):
to_lookup += hostnode.cnames to_lookup += hostnode.cnames
if not node.empty_response: if not node.empty_response: