mirror of
https://github.com/laramies/theHarvester.git
synced 2025-02-25 15:03:01 +08:00
Modified hostchecker to use corountines,also added suip module (needs testing).
This commit is contained in:
parent
1286ba4b75
commit
ffe0ce88e4
3 changed files with 38 additions and 2 deletions
|
@ -346,6 +346,19 @@ def start():
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
elif engineitem == 'suip':
|
||||||
|
print('\033[94m[*] Searching suip. \033[0m')
|
||||||
|
from theHarvester.discovery import suip
|
||||||
|
try:
|
||||||
|
suip_search = suip.SearchSuip(word)
|
||||||
|
suip_search.process()
|
||||||
|
hosts = filter(suip_search.get_hostnames())
|
||||||
|
all_hosts.extend(hosts)
|
||||||
|
db = stash.stash_manager()
|
||||||
|
db.store_all(word, all_hosts, 'host', 'suip')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
elif engineitem == 'threatcrowd':
|
elif engineitem == 'threatcrowd':
|
||||||
print('\033[94m[*] Searching Threatcrowd. \033[0m')
|
print('\033[94m[*] Searching Threatcrowd. \033[0m')
|
||||||
from theHarvester.discovery import threatcrowd
|
from theHarvester.discovery import threatcrowd
|
||||||
|
@ -451,15 +464,16 @@ def start():
|
||||||
if len(all_hosts) == 0:
|
if len(all_hosts) == 0:
|
||||||
print('\n[*] No hosts found.\n\n')
|
print('\n[*] No hosts found.\n\n')
|
||||||
else:
|
else:
|
||||||
|
import asyncio
|
||||||
print('\n[*] Hosts found: ' + str(len(all_hosts)))
|
print('\n[*] Hosts found: ' + str(len(all_hosts)))
|
||||||
print('---------------------')
|
print('---------------------')
|
||||||
all_hosts = sorted(list(set(all_hosts)))
|
all_hosts = sorted(list(set(all_hosts)))
|
||||||
full_host = hostchecker.Checker(all_hosts)
|
full_host = hostchecker.Checker(all_hosts)
|
||||||
full = full_host.check()
|
full = asyncio.run(full_host.check())
|
||||||
|
#full = full_host.check()
|
||||||
for host in full:
|
for host in full:
|
||||||
host = str(host)
|
host = str(host)
|
||||||
print(host.lower())
|
print(host.lower())
|
||||||
|
|
||||||
db = stash.stash_manager()
|
db = stash.stash_manager()
|
||||||
db.store_all(word, host_ip, 'ip', 'DNS-resolver')
|
db.store_all(word, host_ip, 'ip', 'DNS-resolver')
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ def get_supportedengines() -> Set[Union[str, Any]]:
|
||||||
'netcraft',
|
'netcraft',
|
||||||
'otx',
|
'otx',
|
||||||
'securityTrails',
|
'securityTrails',
|
||||||
|
'suip',
|
||||||
'threatcrowd',
|
'threatcrowd',
|
||||||
'trello',
|
'trello',
|
||||||
'twitter',
|
'twitter',
|
||||||
|
|
|
@ -25,6 +25,26 @@ async def query(host, resolver) -> [list, str]:
|
||||||
# print(f'An error occurred in query: {e}')
|
# print(f'An error occurred in query: {e}')
|
||||||
return f"{host}:"
|
return f"{host}:"
|
||||||
|
|
||||||
|
async def query_all(self, resolver) -> list:
|
||||||
|
results = await asyncio.gather(*[asyncio.create_task(self.query(host, resolver))
|
||||||
|
for host in self.hosts])
|
||||||
|
return results
|
||||||
|
|
||||||
|
async def check(self):
|
||||||
|
import pprint as p
|
||||||
|
p.pprint(self.hosts, indent=4)
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
resolver = aiodns.DNSResolver(loop=loop)
|
||||||
|
results = await self.query_all(resolver)
|
||||||
|
print('results: ', results)
|
||||||
|
import pprint as p
|
||||||
|
p.pprint(results, indent=4)
|
||||||
|
|
||||||
|
#loop.close()
|
||||||
|
return self.realhosts
|
||||||
|
|
||||||
|
"""
|
||||||
def check(self):
|
def check(self):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
resolver = aiodns.DNSResolver(loop=loop)
|
resolver = aiodns.DNSResolver(loop=loop)
|
||||||
|
@ -42,3 +62,4 @@ def check(self):
|
||||||
self.realhosts.append(true_result)
|
self.realhosts.append(true_result)
|
||||||
loop.close()
|
loop.close()
|
||||||
return self.realhosts
|
return self.realhosts
|
||||||
|
"""
|
||||||
|
|
Loading…
Reference in a new issue