mirror of
https://github.com/laramies/theHarvester.git
synced 2026-09-28 04:24:55 +02:00
xml-output: host,vhost added subfield ip and hostname, adding shodan output
adding sorted(set()) to all_emails, all_hosts, vhosts; using full in the xml-output
This commit is contained in:
Regular → Executable
+48
-3
@@ -272,6 +272,7 @@ def start(argv):
|
||||
if all_emails == []:
|
||||
print "No emails found"
|
||||
else:
|
||||
all_emails=sorted(set(all_emails))
|
||||
for emails in all_emails:
|
||||
print emails
|
||||
|
||||
@@ -280,6 +281,7 @@ def start(argv):
|
||||
if all_hosts == []:
|
||||
print "No hosts found"
|
||||
else:
|
||||
all_hosts=sorted(set(all_hosts))
|
||||
print "[-] Resolving hostnames IPs... "
|
||||
full_host = hostchecker.Checker(all_hosts)
|
||||
full = full_host.check()
|
||||
@@ -359,6 +361,7 @@ def start(argv):
|
||||
print l + "\t" + x
|
||||
vhost.append(l + ":" + x)
|
||||
full.append(l + ":" + x)
|
||||
vhost=sorted(set(vhost))
|
||||
else:
|
||||
pass
|
||||
shodanres = []
|
||||
@@ -402,6 +405,7 @@ def start(argv):
|
||||
else:
|
||||
pass
|
||||
|
||||
#Reporting#######################################################
|
||||
if filename != "":
|
||||
try:
|
||||
print "[+] Saving files..."
|
||||
@@ -425,10 +429,51 @@ def start(argv):
|
||||
file.write('<?xml version="1.0" encoding="UTF-8"?><theHarvester>')
|
||||
for x in all_emails:
|
||||
file.write('<email>' + x + '</email>')
|
||||
for x in all_hosts:
|
||||
file.write('<host>' + x + '</host>')
|
||||
|
||||
for x in full:
|
||||
x = x.split(":")
|
||||
if len(x) == 2:
|
||||
file.write('<host>' + '<ip>' + x[0] + '</ip><hostname>' + x[1] + '</hostname>' + '</host>')
|
||||
else:
|
||||
file.write('<host>' + x + '</host>')
|
||||
for x in vhost:
|
||||
file.write('<vhost>' + x + '</vhost>')
|
||||
x = x.split(":")
|
||||
if len(x) == 2:
|
||||
file.write('<vhost>' + '<ip>' + x[0] + '</ip><hostname>' + x[1] + '</hostname>' + '</vhost>')
|
||||
else:
|
||||
file.write('<vhost>' + x + '</vhost>')
|
||||
|
||||
if shodanres != []:
|
||||
shodanalysis = []
|
||||
for x in shodanres:
|
||||
res = x.split("SAPO")
|
||||
# print " res[0] " + res[0] # ip/host
|
||||
# print " res[1] " + res[1] # banner/info
|
||||
# print " res[2] " + res[2] # port
|
||||
file.write('<shodan>')
|
||||
#page.h3(res[0])
|
||||
file.write('<host>' + res[0] + '</host>')
|
||||
#page.a("Port :" + res[2])
|
||||
file.write('<port>' + res[2] + '</port>')
|
||||
#page.pre(res[1])
|
||||
file.write('<banner><!--' + res[1] + '--></banner>')
|
||||
|
||||
|
||||
reg_server = re.compile('Server:.*')
|
||||
temp = reg_server.findall(res[1])
|
||||
if temp != []:
|
||||
shodanalysis.append(res[0] + ":" + temp[0])
|
||||
|
||||
file.write('</shodan>')
|
||||
if shodanalysis != []:
|
||||
shodanalysis=sorted(set(shodanalysis))
|
||||
file.write('<servers>')
|
||||
for x in shodanalysis:
|
||||
#page.pre(x)
|
||||
file.write('<server>' + x + '</server>')
|
||||
file.write('</servers>')
|
||||
|
||||
|
||||
file.write('</theHarvester>')
|
||||
file.close
|
||||
print "Files saved!"
|
||||
|
||||
Reference in New Issue
Block a user