mirror of
https://github.com/laramies/theHarvester.git
synced 2024-09-20 15:26:31 +08:00
Made it so you can do dnsbrute force without having to specificy searchengine.
This commit is contained in:
parent
1bf02717be
commit
a8d3043107
866
theHarvester.py
866
theHarvester.py
|
@ -32,25 +32,33 @@
|
|||
|
||||
|
||||
def start():
|
||||
parser = argparse.ArgumentParser(description='theHarvester is a open source intelligence gathering tool(OSINT) that is used for recon')
|
||||
parser = argparse.ArgumentParser(
|
||||
description='theHarvester is a open source intelligence gathering tool(OSINT) that is used for recon')
|
||||
parser.add_argument('-d', '--domain', help='company name or domain to search', required=True)
|
||||
parser.add_argument('-l', '--limit', help='limit the number of search results, default=500', default=500, type=int)
|
||||
parser.add_argument('-S', '--start', help='start with result number X, default=0', default=0, type=int)
|
||||
parser.add_argument('-g', '--google-dork', help='use Google Dorks for google search, default=False, params=True', default=False)
|
||||
parser.add_argument('-p', '--port-scan', help='scan the detected hosts and check for Takeovers (21,22,80,443,8080) default=False, params=True', default=False)
|
||||
#parser.add_argument('-s', '--shodan', help='use Shodan to query discovered hosts, default=False, params=True', default=False, type=bool)
|
||||
parser.add_argument('-s', '--shodan', help='use Shodan to query discovered hosts', default=False, action='store_true')
|
||||
parser.add_argument('-v', '--virtual-host', help='verify host name via DNS resolution and search for virtual hosts params=basic, default=False', default=False)
|
||||
parser.add_argument('-g', '--google-dork', help='use Google Dorks for google search', default=False,
|
||||
action='store_true')
|
||||
parser.add_argument('-p', '--port-scan',
|
||||
help='scan the detected hosts and check for Takeovers (21,22,80,443,8080) default=False, params=True',
|
||||
default=False)
|
||||
# parser.add_argument('-s', '--shodan', help='use Shodan to query discovered hosts, default=False, params=True', default=False, type=bool)
|
||||
parser.add_argument('-s', '--shodan', help='use Shodan to query discovered hosts', default=False,
|
||||
action='store_true')
|
||||
parser.add_argument('-v', '--virtual-host',
|
||||
help='verify host name via DNS resolution and search for virtual hosts params=basic, default=False',
|
||||
default=False)
|
||||
parser.add_argument('-e', '--dns-server', help='DNS server to use for lookup')
|
||||
parser.add_argument('-t', '--dns-tld', help='perform a DNS TLD expansion discovery, default False', default=False)
|
||||
parser.add_argument('-n', '--dns-lookup', help='enable DNS server lookup, default=False, params=True', default=False)
|
||||
parser.add_argument('-c', '--dns-brute', help='perform a DNS brute force on the domain, default=False, params=True', default=False)
|
||||
parser.add_argument('-n', '--dns-lookup', help='enable DNS server lookup, default=False, params=True',
|
||||
default=False)
|
||||
parser.add_argument('-c', '--dns-brute', help='perform a DNS brute force on the domain', default=False,
|
||||
action='store_true')
|
||||
parser.add_argument('-f', '--filename', help='save the results to an HTML and/or XML file', default='', type=str)
|
||||
parser.add_argument('-b', '--source', help='''source: baidu, bing, bingapi, censys, crtsh, cymon, dogpile,
|
||||
google, googleCSE, google-certificates, google-profiles,
|
||||
hunter, linkedin, netcraft, pgp, securityTrails, threatcrowd,
|
||||
trello, twitter, vhost, virustotal, yahoo, all''', required=True)
|
||||
|
||||
trello, twitter, vhost, virustotal, yahoo, all''')
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
|
@ -79,47 +87,48 @@ def start():
|
|||
vhost = []
|
||||
virtual = args.virtual_host
|
||||
word = args.domain
|
||||
engines = set(args.source.split(','))
|
||||
if set(engines).issubset(Core.get_supportedengines()):
|
||||
print(f'\033[94m[*] Target domain: {word} \n \033[0m')
|
||||
for engineitem in engines:
|
||||
if engineitem == 'baidu':
|
||||
print('\033[94m[*] Searching Baidu. \033[0m')
|
||||
try:
|
||||
search = baidusearch.SearchBaidu(word, limit)
|
||||
search.process()
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'baidu')
|
||||
db.store_all(word, all_emails, 'email', 'baidu')
|
||||
except Exception:
|
||||
pass
|
||||
if args.source is not None:
|
||||
engines = set(args.source.split(','))
|
||||
if set(engines).issubset(Core.get_supportedengines()):
|
||||
print(f'\033[94m[*] Target domain: {word} \n \033[0m')
|
||||
for engineitem in engines:
|
||||
if engineitem == 'baidu':
|
||||
print('\033[94m[*] Searching Baidu. \033[0m')
|
||||
try:
|
||||
search = baidusearch.SearchBaidu(word, limit)
|
||||
search.process()
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'baidu')
|
||||
db.store_all(word, all_emails, 'email', 'baidu')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elif engineitem == 'bing' or engineitem == 'bingapi':
|
||||
print('\033[94m[*] Searching Bing. \033[0m')
|
||||
try:
|
||||
search = bingsearch.SearchBing(word, limit, start)
|
||||
bingapi = ''
|
||||
if engineitem == 'bingapi':
|
||||
bingapi += 'yes'
|
||||
else:
|
||||
bingapi += 'no'
|
||||
search.process(bingapi)
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'bing')
|
||||
db.store_all(word, all_hosts, 'host', 'bing')
|
||||
except Exception as e:
|
||||
elif engineitem == 'bing' or engineitem == 'bingapi':
|
||||
print('\033[94m[*] Searching Bing. \033[0m')
|
||||
try:
|
||||
search = bingsearch.SearchBing(word, limit, start)
|
||||
bingapi = ''
|
||||
if engineitem == 'bingapi':
|
||||
bingapi += 'yes'
|
||||
else:
|
||||
bingapi += 'no'
|
||||
search.process(bingapi)
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'bing')
|
||||
db.store_all(word, all_hosts, 'host', 'bing')
|
||||
except Exception as e:
|
||||
if isinstance(e, MissingKey):
|
||||
print(e)
|
||||
else:
|
||||
pass
|
||||
|
||||
elif engineitem == 'censys':
|
||||
elif engineitem == 'censys':
|
||||
print('\033[94m[*] Searching Censys. \033[0m')
|
||||
from discovery import censys
|
||||
# Import locally or won't work
|
||||
|
@ -132,7 +141,7 @@ def start():
|
|||
db.store_all(word, all_hosts, 'host', 'censys')
|
||||
db.store_all(word, all_ip, 'ip', 'censys')
|
||||
|
||||
elif engineitem == 'crtsh':
|
||||
elif engineitem == 'crtsh':
|
||||
print('\033[94m[*] Searching CRT.sh. \033[0m')
|
||||
search = crtsh.search_crtsh(word)
|
||||
search.process()
|
||||
|
@ -141,7 +150,7 @@ def start():
|
|||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'CRTsh')
|
||||
|
||||
elif engineitem == 'cymon':
|
||||
elif engineitem == 'cymon':
|
||||
print('\033[94m[*] Searching Cymon. \033[0m')
|
||||
from discovery import cymon
|
||||
# Import locally or won't work.
|
||||
|
@ -151,22 +160,22 @@ def start():
|
|||
db = stash.stash_manager()
|
||||
db.store_all(word, all_ip, 'ip', 'cymon')
|
||||
|
||||
elif engineitem == 'dogpile':
|
||||
try:
|
||||
print('\033[94m[*] Searching Dogpile. \033[0m')
|
||||
search = dogpilesearch.SearchDogpile(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'dogpile')
|
||||
db.store_all(word, all_hosts, 'host', 'dogpile')
|
||||
except Exception as e:
|
||||
print(f'Error occured in Dogpile: {e}')
|
||||
elif engineitem == 'dogpile':
|
||||
try:
|
||||
print('\033[94m[*] Searching Dogpile. \033[0m')
|
||||
search = dogpilesearch.SearchDogpile(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'dogpile')
|
||||
db.store_all(word, all_hosts, 'host', 'dogpile')
|
||||
except Exception as e:
|
||||
print(f'Error occured in Dogpile: {e}')
|
||||
|
||||
elif engineitem == 'duckduckgo':
|
||||
elif engineitem == 'duckduckgo':
|
||||
print('\033[94m[*] Searching DuckDuckGo. \033[0m')
|
||||
from discovery import duckduckgosearch
|
||||
search = duckduckgosearch.SearchDuckDuckGo(word, limit)
|
||||
|
@ -179,7 +188,7 @@ def start():
|
|||
db.store_all(word, all_hosts, 'email', 'duckduckgo')
|
||||
db.store_all(word, all_hosts, 'host', 'duckduckgo')
|
||||
|
||||
elif engineitem == 'google':
|
||||
elif engineitem == 'google':
|
||||
print('\033[94m[*] Searching Google. \033[0m')
|
||||
search = googlesearch.search_google(word, limit, start)
|
||||
search.process(google_dorking)
|
||||
|
@ -191,7 +200,7 @@ def start():
|
|||
db.store_all(word, all_hosts, 'host', 'google')
|
||||
db.store_all(word, all_emails, 'email', 'google')
|
||||
|
||||
elif engineitem == 'googleCSE':
|
||||
elif engineitem == 'googleCSE':
|
||||
print('\033[94m[*] Searching Google Custom Search. \033[0m')
|
||||
try:
|
||||
search = googleCSE.SearchGoogleCSE(word, limit, start)
|
||||
|
@ -210,7 +219,7 @@ def start():
|
|||
else:
|
||||
pass
|
||||
|
||||
elif engineitem == 'google-certificates':
|
||||
elif engineitem == 'google-certificates':
|
||||
print('\033[94m[*] Searching Google Certificate transparency report. \033[0m')
|
||||
search = googlecertificates.SearchGoogleCertificates(word, limit, start)
|
||||
search.process()
|
||||
|
@ -219,7 +228,7 @@ def start():
|
|||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'google-certificates')
|
||||
|
||||
elif engineitem == 'google-profiles':
|
||||
elif engineitem == 'google-profiles':
|
||||
print('\033[94m[*] Searching Google profiles. \033[0m')
|
||||
search = googlesearch.search_google(word, limit, start)
|
||||
search.process_profiles()
|
||||
|
@ -236,411 +245,411 @@ def start():
|
|||
print(user)
|
||||
sys.exit(0)
|
||||
|
||||
elif engineitem == 'hunter':
|
||||
print('\033[94m[*] Searching Hunter. \033[0m')
|
||||
from discovery import huntersearch
|
||||
# Import locally or won't work.
|
||||
try:
|
||||
search = huntersearch.SearchHunter(word, limit, start)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
all_emails.extend(emails)
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'hunter')
|
||||
db.store_all(word, all_emails, 'email', 'hunter')
|
||||
except Exception as e:
|
||||
if isinstance(e, MissingKey):
|
||||
print(e)
|
||||
else:
|
||||
pass
|
||||
|
||||
elif engineitem == 'linkedin':
|
||||
print('\033[94m[*] Searching Linkedin. \033[0m')
|
||||
search = linkedinsearch.SearchLinkedin(word, limit)
|
||||
search.process()
|
||||
people = search.get_people()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'linkedin')
|
||||
|
||||
if len(people) == 0:
|
||||
print('\n[*] No users found Linkedin.\n\n')
|
||||
else:
|
||||
print(f'\n[*] Users found: {len(people)}')
|
||||
print('---------------------')
|
||||
for user in sorted(list(set(people))):
|
||||
print(user)
|
||||
sys.exit(0)
|
||||
|
||||
elif engineitem == 'netcraft':
|
||||
print('\033[94m[*] Searching Netcraft. \033[0m')
|
||||
search = netcraft.SearchNetcraft(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'netcraft')
|
||||
|
||||
elif engineitem == 'pgp':
|
||||
print('\033[94m[*] Searching PGP key server. \033[0m')
|
||||
try:
|
||||
search = pgpsearch.SearchPgp(word)
|
||||
search.process()
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'pgp')
|
||||
db.store_all(word, all_emails, 'email', 'pgp')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elif engineitem == 'securityTrails':
|
||||
print('\033[94m[*] Searching SecurityTrails. \033[0m')
|
||||
from discovery import securitytrailssearch
|
||||
try:
|
||||
search = securitytrailssearch.search_securitytrail(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, hosts, 'host', 'securityTrails')
|
||||
ips = search.get_ips()
|
||||
all_ip.extend(ips)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, ips, 'ip', 'securityTrails')
|
||||
except Exception as e:
|
||||
if isinstance(e, MissingKey):
|
||||
print(e)
|
||||
else:
|
||||
pass
|
||||
|
||||
elif engineitem == 'threatcrowd':
|
||||
print('\033[94m[*] Searching Threatcrowd. \033[0m')
|
||||
try:
|
||||
search = threatcrowd.search_threatcrowd(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'threatcrowd')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elif engineitem == 'trello':
|
||||
print('\033[94m[*] Searching Trello. \033[0m')
|
||||
from discovery import trello
|
||||
# Import locally or won't work.
|
||||
search = trello.search_trello(word, limit)
|
||||
elif engineitem == 'hunter':
|
||||
print('\033[94m[*] Searching Hunter. \033[0m')
|
||||
from discovery import huntersearch
|
||||
# Import locally or won't work.
|
||||
try:
|
||||
search = huntersearch.SearchHunter(word, limit, start)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
all_emails.extend(emails)
|
||||
info = search.get_urls()
|
||||
hosts = filter(info[0])
|
||||
trello_info = (info[1], True)
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, hosts, 'host', 'trello')
|
||||
db.store_all(word, emails, 'email', 'trello')
|
||||
|
||||
elif engineitem == 'twitter':
|
||||
print('\033[94m[*] Searching Twitter. \033[0m')
|
||||
search = twittersearch.search_twitter(word, limit)
|
||||
search.process()
|
||||
people = search.get_people()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'twitter')
|
||||
|
||||
if len(people) == 0:
|
||||
print('\n[*] No users found.\n\n')
|
||||
db.store_all(word, all_hosts, 'host', 'hunter')
|
||||
db.store_all(word, all_emails, 'email', 'hunter')
|
||||
except Exception as e:
|
||||
if isinstance(e, MissingKey):
|
||||
print(e)
|
||||
else:
|
||||
print('\n[*] Users found: ' + str(len(people)))
|
||||
print('---------------------')
|
||||
for user in sorted(list(set(people))):
|
||||
print(user)
|
||||
sys.exit(0)
|
||||
pass
|
||||
|
||||
# vhost
|
||||
elif engineitem == 'linkedin':
|
||||
print('\033[94m[*] Searching Linkedin. \033[0m')
|
||||
search = linkedinsearch.SearchLinkedin(word, limit)
|
||||
search.process()
|
||||
people = search.get_people()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'linkedin')
|
||||
|
||||
elif engineitem == 'virustotal':
|
||||
print('\033[94m[*] Searching VirusTotal. \033[0m')
|
||||
search = virustotal.search_virustotal(word)
|
||||
if len(people) == 0:
|
||||
print('\n[*] No users found Linkedin.\n\n')
|
||||
else:
|
||||
print(f'\n[*] Users found: {len(people)}')
|
||||
print('---------------------')
|
||||
for user in sorted(list(set(people))):
|
||||
print(user)
|
||||
sys.exit(0)
|
||||
|
||||
elif engineitem == 'netcraft':
|
||||
print('\033[94m[*] Searching Netcraft. \033[0m')
|
||||
search = netcraft.SearchNetcraft(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'netcraft')
|
||||
|
||||
elif engineitem == 'pgp':
|
||||
print('\033[94m[*] Searching PGP key server. \033[0m')
|
||||
try:
|
||||
search = pgpsearch.SearchPgp(word)
|
||||
search.process()
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'pgp')
|
||||
db.store_all(word, all_emails, 'email', 'pgp')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elif engineitem == 'securityTrails':
|
||||
print('\033[94m[*] Searching SecurityTrails. \033[0m')
|
||||
from discovery import securitytrailssearch
|
||||
try:
|
||||
search = securitytrailssearch.search_securitytrail(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'virustotal')
|
||||
|
||||
elif engineitem == 'yahoo':
|
||||
print('\033[94m[*] Searching Yahoo. \033[0m')
|
||||
search = yahoosearch.search_yahoo(word, limit)
|
||||
search.process()
|
||||
hosts = search.get_hostnames()
|
||||
emails = search.get_emails()
|
||||
all_hosts.extend(filter(hosts))
|
||||
all_emails.extend(filter(emails))
|
||||
db.store_all(word, hosts, 'host', 'securityTrails')
|
||||
ips = search.get_ips()
|
||||
all_ip.extend(ips)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'yahoo')
|
||||
db.store_all(word, all_emails, 'email', 'yahoo')
|
||||
|
||||
elif engineitem == 'all':
|
||||
print(('Full harvest on ' + word))
|
||||
all_emails = []
|
||||
all_hosts = []
|
||||
try:
|
||||
print('[*] Searching Baidu.')
|
||||
search = baidusearch.SearchBaidu(word, limit)
|
||||
search.process()
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'baidu')
|
||||
db.store_all(word, all_emails, 'email', 'baidu')
|
||||
except Exception:
|
||||
db.store_all(word, ips, 'ip', 'securityTrails')
|
||||
except Exception as e:
|
||||
if isinstance(e, MissingKey):
|
||||
print(e)
|
||||
else:
|
||||
pass
|
||||
|
||||
print('[*] Searching Bing.')
|
||||
bingapi = 'no'
|
||||
search = bingsearch.SearchBing(word, limit, start)
|
||||
search.process(bingapi)
|
||||
elif engineitem == 'threatcrowd':
|
||||
print('\033[94m[*] Searching Threatcrowd. \033[0m')
|
||||
try:
|
||||
search = threatcrowd.search_threatcrowd(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'threatcrowd')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elif engineitem == 'trello':
|
||||
print('\033[94m[*] Searching Trello. \033[0m')
|
||||
from discovery import trello
|
||||
# Import locally or won't work.
|
||||
search = trello.search_trello(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
all_emails.extend(emails)
|
||||
info = search.get_urls()
|
||||
hosts = filter(info[0])
|
||||
trello_info = (info[1], True)
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, hosts, 'host', 'trello')
|
||||
db.store_all(word, emails, 'email', 'trello')
|
||||
|
||||
elif engineitem == 'twitter':
|
||||
print('\033[94m[*] Searching Twitter. \033[0m')
|
||||
search = twittersearch.search_twitter(word, limit)
|
||||
search.process()
|
||||
people = search.get_people()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'twitter')
|
||||
|
||||
if len(people) == 0:
|
||||
print('\n[*] No users found.\n\n')
|
||||
else:
|
||||
print('\n[*] Users found: ' + str(len(people)))
|
||||
print('---------------------')
|
||||
for user in sorted(list(set(people))):
|
||||
print(user)
|
||||
sys.exit(0)
|
||||
|
||||
# vhost
|
||||
|
||||
elif engineitem == 'virustotal':
|
||||
print('\033[94m[*] Searching VirusTotal. \033[0m')
|
||||
search = virustotal.search_virustotal(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'virustotal')
|
||||
|
||||
elif engineitem == 'yahoo':
|
||||
print('\033[94m[*] Searching Yahoo. \033[0m')
|
||||
search = yahoosearch.search_yahoo(word, limit)
|
||||
search.process()
|
||||
hosts = search.get_hostnames()
|
||||
emails = search.get_emails()
|
||||
all_hosts.extend(filter(hosts))
|
||||
all_emails.extend(filter(emails))
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'yahoo')
|
||||
db.store_all(word, all_emails, 'email', 'yahoo')
|
||||
|
||||
elif engineitem == 'all':
|
||||
print(('Full harvest on ' + word))
|
||||
all_emails = []
|
||||
all_hosts = []
|
||||
try:
|
||||
print('[*] Searching Baidu.')
|
||||
search = baidusearch.SearchBaidu(word, limit)
|
||||
search.process()
|
||||
all_emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'baidu')
|
||||
db.store_all(word, all_emails, 'email', 'baidu')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('[*] Searching Bing.')
|
||||
bingapi = 'no'
|
||||
search = bingsearch.SearchBing(word, limit, start)
|
||||
search.process(bingapi)
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'bing')
|
||||
all_emails.extend(emails)
|
||||
all_emails = sorted(set(all_emails))
|
||||
db.store_all(word, all_emails, 'email', 'bing')
|
||||
|
||||
print('[*] Searching Censys.')
|
||||
from discovery import censys
|
||||
search = censys.SearchCensys(word, limit)
|
||||
search.process()
|
||||
ips = search.get_ipaddresses()
|
||||
setips = set(ips)
|
||||
uniqueips = list(setips) # Remove duplicates.
|
||||
all_ip.extend(uniqueips)
|
||||
hosts = filter(search.get_hostnames())
|
||||
sethosts = set(hosts)
|
||||
uniquehosts = list(sethosts) # Remove duplicates.
|
||||
all_hosts.extend(uniquehosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, uniquehosts, 'host', 'censys')
|
||||
db.store_all(word, uniqueips, 'ip', 'censys')
|
||||
|
||||
print('[*] Searching CRT.sh.')
|
||||
search = crtsh.search_crtsh(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'CRTsh')
|
||||
|
||||
# cymon
|
||||
print('\033[94m[*] Searching Cymon. \033[0m')
|
||||
from discovery import cymon
|
||||
# Import locally or won't work.
|
||||
search = cymon.search_cymon(word)
|
||||
search.process()
|
||||
all_ip = search.get_ipaddresses()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_ip, 'ip', 'cymon')
|
||||
|
||||
print('\033[94m[*] Searching Dogpile. \033[0m')
|
||||
search = dogpilesearch.SearchDogpile(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'dogpile')
|
||||
db.store_all(word, all_hosts, 'host', 'dogpile')
|
||||
|
||||
print('[*] Searching DuckDuckGo.')
|
||||
from discovery import duckduckgosearch
|
||||
search = duckduckgosearch.SearchDuckDuckGo(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'duckduckgo')
|
||||
db.store_all(word, all_hosts, 'host', 'duckduckgo')
|
||||
|
||||
print('[*] Searching Google.')
|
||||
search = googlesearch.search_google(word, limit, start)
|
||||
search.process(google_dorking)
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_emails, 'email', 'google')
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'google')
|
||||
|
||||
print('[*] Searching Google Certificate transparency report.')
|
||||
search = googlecertificates.SearchGoogleCertificates(word, limit, start)
|
||||
search.process()
|
||||
domains = filter(search.get_domains())
|
||||
all_hosts.extend(domains)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'google-certificates')
|
||||
|
||||
try:
|
||||
print('[*] Searching Google profiles.')
|
||||
search = googlesearch.search_google(word, limit, start)
|
||||
search.process_profiles()
|
||||
people = search.get_profiles()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'google-profile')
|
||||
print('\nUsers from Google profiles:')
|
||||
print('---------------------------')
|
||||
for users in people:
|
||||
print(users)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('[*] Searching Hunter.')
|
||||
from discovery import huntersearch
|
||||
# Import locally.
|
||||
try:
|
||||
search = huntersearch.SearchHunter(word, limit, start)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'bing')
|
||||
db.store_all(word, hosts, 'host', 'hunter')
|
||||
all_emails.extend(emails)
|
||||
all_emails = sorted(set(all_emails))
|
||||
db.store_all(word, all_emails, 'email', 'bing')
|
||||
db.store_all(word, all_emails, 'email', 'hunter')
|
||||
except Exception as e:
|
||||
if isinstance(e, MissingKey):
|
||||
print(e)
|
||||
else:
|
||||
pass
|
||||
|
||||
print('[*] Searching Censys.')
|
||||
from discovery import censys
|
||||
search = censys.SearchCensys(word, limit)
|
||||
print('\033[94m[*] Searching Linkedin. \033[0m')
|
||||
search = linkedinsearch.SearchLinkedin(word, limit)
|
||||
search.process()
|
||||
people = search.get_people()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'linkedin')
|
||||
|
||||
if len(people) == 0:
|
||||
print('\n[*] No users found.\n\n')
|
||||
else:
|
||||
print('\n[*] Users found: ' + str(len(people)))
|
||||
print('---------------------')
|
||||
for user in sorted(list(set(people))):
|
||||
print(user)
|
||||
|
||||
print('[*] Searching Netcraft.')
|
||||
search = netcraft.SearchNetcraft(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'netcraft')
|
||||
|
||||
print('[*] Searching PGP key server.')
|
||||
try:
|
||||
search = pgpsearch.SearchPgp(word)
|
||||
search.process()
|
||||
ips = search.get_ipaddresses()
|
||||
setips = set(ips)
|
||||
uniqueips = list(setips) # Remove duplicates.
|
||||
all_ip.extend(uniqueips)
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
sethosts = set(hosts)
|
||||
uniquehosts = list(sethosts) # Remove duplicates.
|
||||
all_hosts.extend(uniquehosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, uniquehosts, 'host', 'censys')
|
||||
db.store_all(word, uniqueips, 'ip', 'censys')
|
||||
|
||||
print('[*] Searching CRT.sh.')
|
||||
search = crtsh.search_crtsh(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'CRTsh')
|
||||
|
||||
# cymon
|
||||
print('\033[94m[*] Searching Cymon. \033[0m')
|
||||
from discovery import cymon
|
||||
# Import locally or won't work.
|
||||
search = cymon.search_cymon(word)
|
||||
search.process()
|
||||
all_ip = search.get_ipaddresses()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_ip, 'ip', 'cymon')
|
||||
|
||||
print('\033[94m[*] Searching Dogpile. \033[0m')
|
||||
search = dogpilesearch.SearchDogpile(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db.store_all(word, all_hosts, 'host', 'PGP')
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'dogpile')
|
||||
db.store_all(word, all_hosts, 'host', 'dogpile')
|
||||
db.store_all(word, all_emails, 'email', 'PGP')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('[*] Searching DuckDuckGo.')
|
||||
from discovery import duckduckgosearch
|
||||
search = duckduckgosearch.SearchDuckDuckGo(word, limit)
|
||||
print('[*] Searching Threatcrowd.')
|
||||
try:
|
||||
search = threatcrowd.search_threatcrowd(word)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'email', 'duckduckgo')
|
||||
db.store_all(word, all_hosts, 'host', 'duckduckgo')
|
||||
db.store_all(word, all_hosts, 'host', 'threatcrowd')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('[*] Searching Google.')
|
||||
search = googlesearch.search_google(word, limit, start)
|
||||
search.process(google_dorking)
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_emails, 'email', 'google')
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'google')
|
||||
print('[*] Searching Trello.')
|
||||
from discovery import trello
|
||||
# Import locally or won't work.
|
||||
search = trello.search_trello(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
all_emails.extend(emails)
|
||||
info = search.get_urls()
|
||||
hosts = filter(info[0])
|
||||
trello_info = (info[1], True)
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, hosts, 'host', 'trello')
|
||||
db.store_all(word, emails, 'email', 'trello')
|
||||
|
||||
print('[*] Searching Google Certificate transparency report.')
|
||||
search = googlecertificates.SearchGoogleCertificates(word, limit, start)
|
||||
search.process()
|
||||
domains = filter(search.get_domains())
|
||||
all_hosts.extend(domains)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'google-certificates')
|
||||
|
||||
try:
|
||||
print('[*] Searching Google profiles.')
|
||||
search = googlesearch.search_google(word, limit, start)
|
||||
search.process_profiles()
|
||||
people = search.get_profiles()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'google-profile')
|
||||
print('\nUsers from Google profiles:')
|
||||
print('---------------------------')
|
||||
for users in people:
|
||||
print(users)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('[*] Searching Hunter.')
|
||||
from discovery import huntersearch
|
||||
# Import locally.
|
||||
try:
|
||||
search = huntersearch.SearchHunter(word, limit, start)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, hosts, 'host', 'hunter')
|
||||
all_emails.extend(emails)
|
||||
all_emails = sorted(set(all_emails))
|
||||
db.store_all(word, all_emails, 'email', 'hunter')
|
||||
except Exception as e:
|
||||
if isinstance(e, MissingKey):
|
||||
print(e)
|
||||
else:
|
||||
pass
|
||||
|
||||
print('\033[94m[*] Searching Linkedin. \033[0m')
|
||||
search = linkedinsearch.SearchLinkedin(word, limit)
|
||||
try:
|
||||
print('[*] Searching Twitter.')
|
||||
search = twittersearch.search_twitter(word, limit)
|
||||
search.process()
|
||||
people = search.get_people()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'linkedin')
|
||||
db.store_all(word, people, 'name', 'twitter')
|
||||
print('\nUsers from Twitter:')
|
||||
print('-------------------')
|
||||
for user in people:
|
||||
print(user)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if len(people) == 0:
|
||||
print('\n[*] No users found.\n\n')
|
||||
else:
|
||||
print('\n[*] Users found: ' + str(len(people)))
|
||||
print('---------------------')
|
||||
for user in sorted(list(set(people))):
|
||||
print(user)
|
||||
print('\n[*] Virtual hosts:')
|
||||
print('------------------')
|
||||
for l in host_ip:
|
||||
search = bingsearch.SearchBing(l, limit, start)
|
||||
search.process_vhost()
|
||||
res = search.get_allhostnames()
|
||||
for x in res:
|
||||
x = re.sub(r'[[\<\/?]*[\w]*>]*', '', x)
|
||||
x = re.sub('<', '', x)
|
||||
x = re.sub('>', '', x)
|
||||
print((l + '\t' + x))
|
||||
vhost.append(l + ':' + x)
|
||||
full.append(l + ':' + x)
|
||||
vhost = sorted(set(vhost))
|
||||
|
||||
print('[*] Searching Netcraft.')
|
||||
search = netcraft.SearchNetcraft(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'netcraft')
|
||||
print('[*] Searching VirusTotal.')
|
||||
search = virustotal.search_virustotal(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'virustotal')
|
||||
|
||||
print('[*] Searching PGP key server.')
|
||||
try:
|
||||
search = pgpsearch.SearchPgp(word)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
hosts = filter(search.get_hostnames())
|
||||
sethosts = set(hosts)
|
||||
uniquehosts = list(sethosts) # Remove duplicates.
|
||||
all_hosts.extend(uniquehosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'PGP')
|
||||
all_emails.extend(emails)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_emails, 'email', 'PGP')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('[*] Searching Threatcrowd.')
|
||||
try:
|
||||
search = threatcrowd.search_threatcrowd(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'threatcrowd')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('[*] Searching Trello.')
|
||||
from discovery import trello
|
||||
# Import locally or won't work.
|
||||
search = trello.search_trello(word, limit)
|
||||
search.process()
|
||||
emails = filter(search.get_emails())
|
||||
all_emails.extend(emails)
|
||||
info = search.get_urls()
|
||||
hosts = filter(info[0])
|
||||
trello_info = (info[1], True)
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, hosts, 'host', 'trello')
|
||||
db.store_all(word, emails, 'email', 'trello')
|
||||
|
||||
try:
|
||||
print('[*] Searching Twitter.')
|
||||
search = twittersearch.search_twitter(word, limit)
|
||||
search.process()
|
||||
people = search.get_people()
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, people, 'name', 'twitter')
|
||||
print('\nUsers from Twitter:')
|
||||
print('-------------------')
|
||||
for user in people:
|
||||
print(user)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('\n[*] Virtual hosts:')
|
||||
print('------------------')
|
||||
for l in host_ip:
|
||||
search = bingsearch.SearchBing(l, limit, start)
|
||||
search.process_vhost()
|
||||
res = search.get_allhostnames()
|
||||
for x in res:
|
||||
x = re.sub(r'[[\<\/?]*[\w]*>]*', '', x)
|
||||
x = re.sub('<', '', x)
|
||||
x = re.sub('>', '', x)
|
||||
print((l + '\t' + x))
|
||||
vhost.append(l + ':' + x)
|
||||
full.append(l + ':' + x)
|
||||
vhost = sorted(set(vhost))
|
||||
|
||||
print('[*] Searching VirusTotal.')
|
||||
search = virustotal.search_virustotal(word)
|
||||
search.process()
|
||||
hosts = filter(search.get_hostnames())
|
||||
all_hosts.extend(hosts)
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'virustotal')
|
||||
|
||||
print('[*] Searching Yahoo.')
|
||||
search = yahoosearch.search_yahoo(word, limit)
|
||||
search.process()
|
||||
hosts = search.get_hostnames()
|
||||
emails = search.get_emails()
|
||||
all_hosts.extend(filter(hosts))
|
||||
all_emails.extend(filter(emails))
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'yahoo')
|
||||
db.store_all(word, all_emails, 'email', 'yahoo')
|
||||
else:
|
||||
print('\033[93m[!] Invalid source.\n\n \033[0m')
|
||||
sys.exit(1)
|
||||
print('[*] Searching Yahoo.')
|
||||
search = yahoosearch.search_yahoo(word, limit)
|
||||
search.process()
|
||||
hosts = search.get_hostnames()
|
||||
emails = search.get_emails()
|
||||
all_hosts.extend(filter(hosts))
|
||||
all_emails.extend(filter(emails))
|
||||
db = stash.stash_manager()
|
||||
db.store_all(word, all_hosts, 'host', 'yahoo')
|
||||
db.store_all(word, all_emails, 'email', 'yahoo')
|
||||
else:
|
||||
print('\033[93m[!] Invalid source.\n\n \033[0m')
|
||||
sys.exit(1)
|
||||
|
||||
# Sanity check to see if all_emails and all_hosts are defined.
|
||||
try:
|
||||
|
@ -951,5 +960,6 @@ def start():
|
|||
print('\n\n\033[93m[!] ctrl+c detected from user, quitting.\n\n \033[0m')
|
||||
except Exception:
|
||||
import traceback
|
||||
|
||||
print(traceback.print_exc())
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Reference in a new issue