Skip to content

Commit

Permalink
internetdb speed optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechromancer committed Feb 4, 2024
1 parent b9095cb commit 57ea37e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bbot/modules/internetdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ def get_ip(self, event):
elif event.type == "DNS_NAME":
# always try IPv4 first
ipv6 = []
for host in event.resolved_hosts:
if self.helpers.is_ip(host, version=4):
return host
elif self.helpers.is_ip(host, version=6):
ipv6.append(host)
ips = [self.helpers.make_ip_type(h) for h in event.resolved_hosts if self.helpers.is_ip(h)]
for ip in sorted(ips):
if self.helpers.is_ip(ip, version=4):
return ip
elif self.helpers.is_ip(ip, version=6):
ipv6.append(ip)
for ip in ipv6:
return ip

0 comments on commit 57ea37e

Please sign in to comment.