mirror of
https://github.com/laramies/theHarvester.git
synced 2025-02-24 22:42:56 +08:00
Google Certificates
Added new search engine Google Certificate Transparency and fixed temporarily Shodan
This commit is contained in:
parent
d9fe5720c0
commit
36ceaab174
3 changed files with 27 additions and 22 deletions
|
@ -20,21 +20,21 @@ def __init__(self, word, limit, start):
|
|||
def do_search(self):
|
||||
try:
|
||||
urly="https://" + self.server + "/transparencyreport/api/v3/httpsreport/ct/certsearch?include_expired=true&include_subdomains=true&domain=" + self.word
|
||||
except Exception, e:
|
||||
print e
|
||||
except Exception as e:
|
||||
print (e)
|
||||
try:
|
||||
r=requests.get(urly)
|
||||
except Exception,e:
|
||||
print e
|
||||
self.results = r.content
|
||||
except Exception as e:
|
||||
print (e)
|
||||
self.results = r.text
|
||||
self.totalresults += self.results
|
||||
|
||||
def get_domains(self):
|
||||
domains = []
|
||||
rawres = json.loads(self.totalresults.split("\n", 2)[2])
|
||||
for array in rawres[0][1]:
|
||||
domains.append(array[1])
|
||||
return list(set(domains))
|
||||
domains = []
|
||||
rawres = json.loads(self.totalresults.split("\n", 2)[2])
|
||||
for array in rawres[0][1]:
|
||||
domains.append(array[1])
|
||||
return list(set(domains))
|
||||
|
||||
def process(self):
|
||||
self.do_search()
|
||||
|
|
|
@ -13,9 +13,12 @@ def __init__(self, host):
|
|||
|
||||
def run(self):
|
||||
try:
|
||||
host = self.api.host(self.host)
|
||||
return host['data']
|
||||
result = self.api.host(self.host)
|
||||
#for service in result['data']:
|
||||
# print ("%s:%s" % (service['ip_str'], service['port']))
|
||||
# print ("%s" % (service['product']))
|
||||
# print ("%s" % (service['hostnames']))
|
||||
return result
|
||||
except Exception as e:
|
||||
print("SHODAN empty reply or error in the call")
|
||||
print(e)
|
||||
return "error"
|
||||
|
|
|
@ -93,6 +93,7 @@ def start(argv):
|
|||
takeover_check = False
|
||||
google_dorking = False
|
||||
limit = 500
|
||||
full = []
|
||||
dnsserver = ""
|
||||
for value in enumerate(opts):
|
||||
opt = value[1][0]
|
||||
|
@ -391,7 +392,7 @@ def start(argv):
|
|||
search = googlecertificates.search_googlecertificates(word, limit, start)
|
||||
search.process()
|
||||
domains = search.get_domains()
|
||||
all_hosts.extend(domains)
|
||||
all_hosts.extend(domains)
|
||||
|
||||
|
||||
|
||||
|
@ -553,6 +554,10 @@ def start(argv):
|
|||
shodanvisited = []
|
||||
if shodan == True:
|
||||
print("\n\n\033[1;32;40m[-] Shodan DB search (passive):\n")
|
||||
if full ==[]:
|
||||
print ('No host to search, exiting.')
|
||||
sys.exit()
|
||||
|
||||
for x in full:
|
||||
try:
|
||||
ip = x.split(":")[1]
|
||||
|
@ -561,18 +566,15 @@ def start(argv):
|
|||
a = shodansearch.search_shodan(ip)
|
||||
shodanvisited.append(ip)
|
||||
results = a.run()
|
||||
time.sleep(2)
|
||||
for res in results:
|
||||
if res['info'] == []:
|
||||
res['info'] = ''
|
||||
shodanres.append(
|
||||
x + "SAPO" + str(res['info']) + "SAPO" + str(res['data']))
|
||||
except Exception:
|
||||
#time.sleep(2)
|
||||
for res in results['data']:
|
||||
shodanres.append(str("%s:%s - %s - %s - %s," % (res['ip_str'], res['port'],res['os'],res['isp'])))
|
||||
except Exception as e:
|
||||
pass
|
||||
print("\n [+] Shodan results:")
|
||||
print("------------------")
|
||||
for x in shodanres:
|
||||
print((x.split("SAPO")[0] + ":" + x.split("SAPO")[1]))
|
||||
print (x)
|
||||
else:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in a new issue