diff --git a/theHarvester/__main__.py b/theHarvester/__main__.py index f86edce3..cbc255de 100644 --- a/theHarvester/__main__.py +++ b/theHarvester/__main__.py @@ -434,10 +434,8 @@ def start(): else: print('\n[*] IPs found: ' + str(len(all_ip))) print('-------------------') - # ips = sorted(ipaddress.ip_address(line.strip()) for line in set(all_ip)) - # print('\n'.join(map(str, ips))) - ip_list = sorted([netaddr.IPAddress(ip.strip()) for ip in set(all_ip)]) # use netaddr as the list may contain ipv4 and ipv6 addresses + ip_list = sorted([netaddr.IPAddress(ip.strip()) for ip in set(all_ip)]) print('\n'.join(map(str, ip_list))) if len(all_emails) == 0: diff --git a/theHarvester/discovery/otxsearch.py b/theHarvester/discovery/otxsearch.py index 7d0da415..44b5c781 100644 --- a/theHarvester/discovery/otxsearch.py +++ b/theHarvester/discovery/otxsearch.py @@ -25,12 +25,12 @@ def do_search(self): self.totalresults += self.results dct = json.loads(self.totalresults) self.totalhosts: set = {host['hostname'] for host in dct['passive_dns']} - self.totalips: set = {ip['address'] for ip in dct['passive_dns'] if 'NXDOMAIN' not in ip['address']} # filter out ips that are just called NXDOMAIN + self.totalips: set = {ip['address'] for ip in dct['passive_dns'] if 'NXDOMAIN' not in ip['address']} def get_hostnames(self) -> set: return self.totalhosts - + def get_ips(self) -> set: return self.totalips