mirror of
https://github.com/laramies/theHarvester.git
synced 2026-09-18 07:37:44 +02:00
added theHarvester scan statistics table to the report
This commit is contained in:
+63
-58
@@ -22,74 +22,79 @@ try:
|
||||
self.scattercountips = []
|
||||
self.scattercountshodans = []
|
||||
self.scattercountvhosts = []
|
||||
|
||||
|
||||
def drawlatestscangraph(self,domain,latestscandata):
|
||||
self.barcolumns= ['email','host','ip','shodan','vhost']
|
||||
self.bardata.append(latestscandata['email'])
|
||||
self.bardata.append(latestscandata['host'])
|
||||
self.bardata.append(latestscandata['ip'])
|
||||
self.bardata.append(latestscandata['shodan'])
|
||||
self.bardata.append(latestscandata['vhost'])
|
||||
layout = dict(title = "Last scan - number of targets identified for "+ domain +" on "+str(latestscandata["latestdate"]),
|
||||
xaxis = dict(title = 'Targets'),
|
||||
yaxis = dict(title = 'Hits'),)
|
||||
barchartcode = plotly.offline.plot({
|
||||
"data": [go.Bar(x=self.barcolumns,y=self.bardata)],
|
||||
"layout": layout,
|
||||
}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
return barchartcode
|
||||
try:
|
||||
self.barcolumns= ['email','host','ip','shodan','vhost']
|
||||
self.bardata.append(latestscandata['email'])
|
||||
self.bardata.append(latestscandata['host'])
|
||||
self.bardata.append(latestscandata['ip'])
|
||||
self.bardata.append(latestscandata['shodan'])
|
||||
self.bardata.append(latestscandata['vhost'])
|
||||
layout = dict(title = "Last scan - number of targets identified for "+ domain +" on "+str(latestscandata["latestdate"]),
|
||||
xaxis = dict(title = 'Targets'),
|
||||
yaxis = dict(title = 'Hits'),)
|
||||
barchartcode = plotly.offline.plot({
|
||||
"data": [go.Bar(x=self.barcolumns,y=self.bardata)],
|
||||
"layout": layout,
|
||||
}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
return barchartcode
|
||||
except Exception as e:
|
||||
print("Error generating HTML bar graph code for domain: " + str(e))
|
||||
|
||||
def drawscattergraphscanhistory(self,domain,scanhistorydomain):
|
||||
scandata = scanhistorydomain
|
||||
for i in scandata:
|
||||
self.scatterxdata.append(datetime.date(datetime.strptime(i['date'],'%Y-%m-%d')))
|
||||
self.scattercountemails.append(int(i['email']))
|
||||
self.scattercounthosts.append(int(i['hosts']))
|
||||
self.scattercountips.append(int(i['ip']))
|
||||
self.scattercountshodans.append(int(i['shodan']))
|
||||
self.scattercountvhosts.append(int(i['vhost']))
|
||||
try:
|
||||
scandata = scanhistorydomain
|
||||
for i in scandata:
|
||||
self.scatterxdata.append(datetime.date(datetime.strptime(i['date'],'%Y-%m-%d')))
|
||||
self.scattercountemails.append(int(i['email']))
|
||||
self.scattercounthosts.append(int(i['hosts']))
|
||||
self.scattercountips.append(int(i['ip']))
|
||||
self.scattercountshodans.append(int(i['shodan']))
|
||||
self.scattercountvhosts.append(int(i['vhost']))
|
||||
|
||||
trace0 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercounthosts,
|
||||
mode = 'lines+markers',
|
||||
name = 'hosts')
|
||||
trace0 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercounthosts,
|
||||
mode = 'lines+markers',
|
||||
name = 'hosts')
|
||||
|
||||
trace1 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountips,
|
||||
mode = 'lines+markers',
|
||||
name = 'IP address')
|
||||
trace1 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountips,
|
||||
mode = 'lines+markers',
|
||||
name = 'IP address')
|
||||
|
||||
trace2 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountvhosts,
|
||||
mode = 'lines+markers',
|
||||
name = 'vhost')
|
||||
trace2 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountvhosts,
|
||||
mode = 'lines+markers',
|
||||
name = 'vhost')
|
||||
|
||||
trace3 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountshodans,
|
||||
mode = 'lines+markers',
|
||||
name = 'shodan')
|
||||
trace3 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountshodans,
|
||||
mode = 'lines+markers',
|
||||
name = 'shodan')
|
||||
|
||||
trace4 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountemails,
|
||||
mode = 'lines+markers',
|
||||
name = 'email')
|
||||
trace4 = go.Scatter(
|
||||
x=self.scatterxdata,
|
||||
y=self.scattercountemails,
|
||||
mode = 'lines+markers',
|
||||
name = 'email')
|
||||
|
||||
data = [trace0, trace1, trace2, trace3, trace4]
|
||||
layout = dict(title = "Scanning history for " + domain,
|
||||
xaxis = dict(title = 'Date'),
|
||||
yaxis = dict(title = 'Results'),
|
||||
)
|
||||
scatterchartcode = plotly.offline.plot({
|
||||
"data": data,
|
||||
"layout": layout}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
return scatterchartcode
|
||||
data = [trace0, trace1, trace2, trace3, trace4]
|
||||
layout = dict(title = "Scanning history for " + domain,
|
||||
xaxis = dict(title = 'Date'),
|
||||
yaxis = dict(title = 'Results'),
|
||||
)
|
||||
scatterchartcode = plotly.offline.plot({
|
||||
"data": data,
|
||||
"layout": layout}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
return scatterchartcode
|
||||
except Exception as e:
|
||||
print("Error generating HTML for the historical graph for domain: " + str(e))
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("Error in the reportgraph module: " + str(e))
|
||||
|
||||
|
||||
+124
-84
@@ -3,89 +3,129 @@ class htmlgenerator:
|
||||
self.domain = word
|
||||
|
||||
def generatedashboardcode(self, scanboarddata):
|
||||
totalnumberofdomains = scanboarddata['domains']
|
||||
totalnumberofhosts = scanboarddata['host']
|
||||
totalnumberofip = scanboarddata['ip']
|
||||
totalnumberofvhost= scanboarddata['vhost']
|
||||
totalnumberofemail= scanboarddata['email']
|
||||
totalnumberofshodan= scanboarddata['shodan']
|
||||
html='''
|
||||
<head><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head>
|
||||
<html>
|
||||
<body>
|
||||
<h1 style="text-align: center;"><span style="color: #ff0000;">theHarvester Scan Report</span></h1>
|
||||
<h2><span style="color: #000000;"><strong>TheHarvester scanning dashboard</strong></span></h2>
|
||||
<table align="left" style="height: 108px; border-color: #000000; margin-left: auto; margin-right: auto;" border=" #000000" width="713">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>Domains</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>Hosts</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>IP Addresses</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>Vhosts</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>Emails</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>Shodan</strong></h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>'''+str(totalnumberofdomains)+'''</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>'''+str(totalnumberofhosts)+'''</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>'''+str(totalnumberofip)+'''</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>'''+str(totalnumberofvhost)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>'''+str(totalnumberofemail)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>'''+str(totalnumberofshodan)+'''</strong></h2></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
'''
|
||||
return html
|
||||
try:
|
||||
totalnumberofdomains = scanboarddata['domains']
|
||||
totalnumberofhosts = scanboarddata['host']
|
||||
totalnumberofip = scanboarddata['ip']
|
||||
totalnumberofvhost= scanboarddata['vhost']
|
||||
totalnumberofemail= scanboarddata['email']
|
||||
totalnumberofshodan= scanboarddata['shodan']
|
||||
html='''
|
||||
<head><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head>
|
||||
<html>
|
||||
<body>
|
||||
<h1 style="text-align: center;"><span style="color: #ff0000;">theHarvester Scan Report</span></h1>
|
||||
<h2><span style="color: #000000;"><strong>TheHarvester scanning dashboard</strong></span></h2>
|
||||
<table align="left" style="height: 108px; border-color: #000000; margin-left: auto; margin-right: auto;" border=" #000000" width="713">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>Domains</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>Hosts</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>IP Addresses</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>Vhosts</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>Emails</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>Shodan</strong></h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>'''+str(totalnumberofdomains)+'''</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>'''+str(totalnumberofhosts)+'''</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>'''+str(totalnumberofip)+'''</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>'''+str(totalnumberofvhost)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>'''+str(totalnumberofemail)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>'''+str(totalnumberofshodan)+'''</strong></h2></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
'''
|
||||
return html
|
||||
except Exception as e:
|
||||
print("Error generating dashboard HTML code: " + str(e))
|
||||
|
||||
def generatescanstatistics(self, scanhistorystatistics):
|
||||
try:
|
||||
html='''
|
||||
<h1 style="text-align: center;">theHarvester scan statistics</h1>
|
||||
<p> </p>
|
||||
<table style="height: 63px; border-color: #000000; margin-left: auto; margin-right: auto;" border="#000000" width="811">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 156.042px; text-align: center;"><strong>Domain</strong></td>
|
||||
<td style="width: 156.042px; text-align: center;"><strong>Date</strong></td>
|
||||
<td style="width: 157.153px; text-align: center;"><strong>Recordtype</strong></td>
|
||||
<td style="width: 157.153px; text-align: center;"><strong>Source</strong></td>
|
||||
<td style="width: 157.153px; text-align: center;"><strong>Total results</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
'''
|
||||
for i in scanhistorystatistics:
|
||||
html += '<td style="width: 156.042px;">' + str(i[0]) + "</td>"
|
||||
html += '<td style="width: 156.042px;">' + str(i[1]) + "</td>"
|
||||
html += '<td style="width: 157.153px;">' + str(i[2]) + "</td>"
|
||||
html += '<td style="width: 157.153px;">' + str(i[3]) + "</td>"
|
||||
html += '<td style="width: 157.153px;">' + str(i[4]) + "</td>"
|
||||
html +='</tr>'
|
||||
html +='''
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
'''
|
||||
print("END")
|
||||
return html
|
||||
except Exception as e:
|
||||
print("Error generating scan statistics HTML code: " + str(e))
|
||||
|
||||
def generatescandetailsdomain(self, word, latestscandomain):
|
||||
emails = latestscandomain['scandetailsemail']
|
||||
hosts = latestscandomain['scandetailshost']
|
||||
ips = latestscandomain['scandetailsip']
|
||||
vhosts = latestscandomain['scandetailsvhost']
|
||||
shodans = latestscandomain['scandetailsshodan']
|
||||
html='''
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<h2><span style="color: #000000;">Latest scan details for '''+ word + ''' on: '''+str(latestscandomain['latestdate'])+'''</span></h2>
|
||||
<h3><strong><span style="color: #0000ff;">Emails found:</span></strong></h3>
|
||||
<ul>
|
||||
'''
|
||||
for email in emails:
|
||||
html += '<li><span style="color: #000000;">'+ str(email[1]) + "</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">Hosts found:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for host in hosts:
|
||||
html += '<li><span style="color: #000000;">'+ str(host[1]) + "</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">IP found:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for ip in ips:
|
||||
html += '<li><span style="color: #000000;">'+str(ip[1])+"</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">vhosts found:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for vhost in vhosts:
|
||||
html +='<li><span style="color: #000000;">'+str(vhost[1])+"</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">Shodan results:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for shodan in shodans:
|
||||
html +='<li><span style="color: #000000;">'+str(shodan[1])+"</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
'''
|
||||
return html
|
||||
try:
|
||||
emails = latestscandomain['scandetailsemail']
|
||||
hosts = latestscandomain['scandetailshost']
|
||||
ips = latestscandomain['scandetailsip']
|
||||
vhosts = latestscandomain['scandetailsvhost']
|
||||
shodans = latestscandomain['scandetailsshodan']
|
||||
html='''
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<h2><span style="color: #000000;">Latest scan details for '''+ word + ''' on: '''+str(latestscandomain['latestdate'])+'''</span></h2>
|
||||
<h3><strong><span style="color: #0000ff;">Emails found:</span></strong></h3>
|
||||
<ul>
|
||||
'''
|
||||
for email in emails:
|
||||
html += '<li><span style="color: #000000;">'+ str(email[1]) + "</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">Hosts found:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for host in hosts:
|
||||
html += '<li><span style="color: #000000;">'+ str(host[1]) + "</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">IP found:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for ip in ips:
|
||||
html += '<li><span style="color: #000000;">'+str(ip[1])+"</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">vhosts found:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for vhost in vhosts:
|
||||
html +='<li><span style="color: #000000;">'+str(vhost[1])+"</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">Shodan results:</span></h3>
|
||||
<ul>
|
||||
'''
|
||||
for shodan in shodans:
|
||||
html +='<li><span style="color: #000000;">'+str(shodan[1])+"</span></li>"
|
||||
html +='''
|
||||
</ul>
|
||||
'''
|
||||
return html
|
||||
except Exception as e:
|
||||
print("Error generating scan details HTML code: " + str(e))
|
||||
+72
-54
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@ class stash_manager:
|
||||
self.latestscandomain = {}
|
||||
self.domainscanhistory = []
|
||||
self.scanboarddata = {}
|
||||
self.scanstats = []
|
||||
|
||||
def do_init(self):
|
||||
conn = sqlite3.connect(self.db)
|
||||
@@ -99,32 +100,32 @@ class stash_manager:
|
||||
conn.close()
|
||||
|
||||
def getscanboarddata(self):
|
||||
try:
|
||||
conn = sqlite3.connect(self.db)
|
||||
c = conn.cursor()
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="host"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["host"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="email"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["email"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="ip"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["ip"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="vhost"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["vhost"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="shodan"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["shodan"] = data[0]
|
||||
c.execute('''SELECT COUNT(DISTINCT(domain)) FROM results ''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["domains"] = data[0]
|
||||
return self.scanboarddata
|
||||
except Exception as e:
|
||||
print(e)
|
||||
finally:
|
||||
conn.close()
|
||||
try:
|
||||
conn = sqlite3.connect(self.db)
|
||||
c = conn.cursor()
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="host"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["host"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="email"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["email"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="ip"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["ip"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="vhost"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["vhost"] = data[0]
|
||||
c.execute('''SELECT COUNT(*) from results WHERE type="shodan"''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["shodan"] = data[0]
|
||||
c.execute('''SELECT COUNT(DISTINCT(domain)) FROM results ''')
|
||||
data = c.fetchone()
|
||||
self.scanboarddata["domains"] = data[0]
|
||||
return self.scanboarddata
|
||||
except Exception as e:
|
||||
print(e)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
def getscanhistorydomain(self,domain):
|
||||
try:
|
||||
@@ -161,4 +162,24 @@ class stash_manager:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
finally:
|
||||
conn.close()
|
||||
conn.close()
|
||||
|
||||
def getscanstatistics(self):
|
||||
try:
|
||||
conn = sqlite3.connect(self.db)
|
||||
c = conn.cursor()
|
||||
c.execute('''
|
||||
SELECT domain,find_date, type, source, count(*)
|
||||
FROM results
|
||||
GROUP BY domain,find_date, type, source
|
||||
''')
|
||||
results = c.fetchall()
|
||||
self.scanstats = results
|
||||
return self.scanstats
|
||||
except Exception as e:
|
||||
print(e)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
|
||||
-188
@@ -1,188 +0,0 @@
|
||||
try:
|
||||
import plotly
|
||||
import plotly.graph_objs as go
|
||||
import plotly.plotly as py
|
||||
import datetime
|
||||
scanneddomain='google.com'
|
||||
totalnumberofdomains = 4
|
||||
totalnumberofhosts = 14
|
||||
totalnumberofip = 10
|
||||
totalnumberofvhost=3
|
||||
totalnumberofemail=15
|
||||
totalnumberofshodan=7
|
||||
date1=datetime.date(2018,12,1)
|
||||
date2=datetime.date(2018,12,3)
|
||||
date3=datetime.date(2018,12,5)
|
||||
date4=datetime.date(2018,12,8)
|
||||
date5=datetime.date(2018,12,10)
|
||||
HTML='''
|
||||
<head><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head>
|
||||
<html>
|
||||
<body>
|
||||
<h1 style="text-align: center;"><span style="color: #ff0000;">theHarvester Scan Report</span></h1>
|
||||
<h2><span style="color: #000000;"><strong>TheHarvester scanning dashboard</strong></span></h2>
|
||||
<table align="left" style="height: 108px; border-color: #000000; margin-left: auto; margin-right: auto;" border=" #000000" width="713">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>Domains</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>Hosts</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>IP Addresses</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>Vhosts</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>Emails</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>Shodan</strong></h2></td>
|
||||
</tr>
|
||||
'''+'''<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>'''+str(totalnumberofdomains)+'''</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>'''+str(totalnumberofhosts)+'''</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>'''+str(totalnumberofip)+'''</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>'''+str(totalnumberofvhost)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>'''+str(totalnumberofemail)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>'''+str(totalnumberofshodan)+'''</strong></h2></td>
|
||||
'''+'''
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<h2><span style="color: #000000;">Latest scan summary for '''+scanneddomain+'''</span></h2>
|
||||
<h3><strong><span style="color: #0000ff;">Emails found:</span></strong></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">email1@google.com</span></li>
|
||||
<li><span style="color: #000000;">email2@google.com</span></li>
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">Hosts found:</span></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">host1.google.com</span></li>
|
||||
<li><span style="color: #000000;">host2.google.com</span></li>
|
||||
<li><span style="color: #000000;">host3.google.com</span></li>
|
||||
</ul>
|
||||
<h3><strong><span style="color: #0000ff;">IP addresses found:</span></strong></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">87.12.42.12</span></li>
|
||||
<li><span style="color: #000000;">87.12.42.11</span></li>
|
||||
<li><span style="color: #000000;">87.12.43.11</span></li>
|
||||
<li><span style="color: #000000;">87.12.44.11</span></li>
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;"><strong>Shodan results:</strong></span></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">NONE</span></li>
|
||||
</ul>
|
||||
'''
|
||||
barcolumns = ["host","ip","vhost","shodan","email"]
|
||||
bardata = [totalnumberofhosts,totalnumberofip,totalnumberofvhost,totalnumberofshodan,totalnumberofemail]
|
||||
layout = dict(title = "Last scan - number of targets identified for "+scanneddomain+" on "+str(date5),
|
||||
xaxis = dict(title = 'Targets'),
|
||||
yaxis = dict(title = 'Hits'),
|
||||
)
|
||||
|
||||
barchart=plotly.offline.plot({
|
||||
"data": [go.Bar(x=barcolumns,y=bardata)],
|
||||
"layout": layout,
|
||||
}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
HTML+=barchart
|
||||
|
||||
|
||||
trace0 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[3, 10, 9, 17,10],
|
||||
mode = 'lines+markers',
|
||||
name = 'hosts')
|
||||
|
||||
trace1 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[2, 6, 9, 10, 5],
|
||||
mode = 'lines+markers',
|
||||
name = 'IP address')
|
||||
|
||||
trace2 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[1, 2, 4, 6, 2],
|
||||
mode = 'lines+markers',
|
||||
name = 'vhost')
|
||||
|
||||
trace3 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[2, 3, 2, 5, 7],
|
||||
mode = 'lines+markers',
|
||||
name = 'shodan')
|
||||
|
||||
trace4 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[12, 14, 20, 24, 20],
|
||||
mode = 'lines+markers',
|
||||
name = 'email')
|
||||
|
||||
|
||||
data = [trace0, trace1, trace2, trace3, trace4]
|
||||
layout = dict(title = "Scanning history for "+scanneddomain,
|
||||
xaxis = dict(title = 'Date'),
|
||||
yaxis = dict(title = 'Results'),
|
||||
)
|
||||
|
||||
scatterchart = plotly.offline.plot({
|
||||
"data": data,
|
||||
"layout": layout}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
HTML+=scatterchart
|
||||
|
||||
trace1 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[20, 21, 23, 20, 17],
|
||||
text=['domain1.com', 'domain2.com', 'domain3.com', 'domain4.com', 'domain5.com'],
|
||||
name='hosts'
|
||||
)
|
||||
trace2 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[24, 23, 29, 30, 25],
|
||||
text=['domain1.com', 'domain2.com', 'domain3.com', 'domain4.com', 'domain5.com'],
|
||||
name='IP addresses'
|
||||
)
|
||||
|
||||
trace3 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[3, 5, 2, 1, 3],
|
||||
text=['domain1.com', 'domain2.com', 'domain3.com', 'domain4.com', 'domain5.com'],
|
||||
name='vhosts'
|
||||
)
|
||||
|
||||
trace4 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[13, 10, 12, 13, 12],
|
||||
text=['domain1.com', 'domain2.com', 'domain3.com', 'domain4.com', 'domain5.com'],
|
||||
name='shodan'
|
||||
)
|
||||
|
||||
trace5 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[30, 34, 35, 41, 31],
|
||||
text=['domain1.com', 'domain2.com', 'domain3.com', 'domain4.com', 'domain5.com'],
|
||||
name='email'
|
||||
)
|
||||
|
||||
data = [trace1, trace2, trace3, trace4, trace5]
|
||||
layout = go.Layout(
|
||||
barmode='stack'
|
||||
)
|
||||
|
||||
layout = dict(title = "theHarvester scan history",
|
||||
xaxis = dict(title = 'Date'),
|
||||
yaxis = dict(title = 'Hits'),
|
||||
)
|
||||
|
||||
barchart=plotly.offline.plot({
|
||||
"data": data,
|
||||
"layout": layout,
|
||||
}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
HTML+=barchart
|
||||
HTML+='<p><span style="color: #000000;">Report generated on '+ str(datetime.datetime.now())+'</span></p>'
|
||||
HTML+='''
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
Html_file= open("report.html","w")
|
||||
Html_file.write(HTML)
|
||||
Html_file.close()
|
||||
except Exception as e:
|
||||
print("ERROR: "+str(e))
|
||||
@@ -1,186 +0,0 @@
|
||||
try:
|
||||
import plotly
|
||||
import plotly.graph_objs as go
|
||||
import plotly.plotly as py
|
||||
import datetime
|
||||
scanneddomain='google.com'
|
||||
totalnumberofdomains = 4
|
||||
totalnumberofhosts = 14
|
||||
totalnumberofip = 10
|
||||
totalnumberofvhost=3
|
||||
totalnumberofemail=15
|
||||
totalnumberofshodan=7
|
||||
date1=datetime.date(2018,12,1)
|
||||
date2=datetime.date(2018,12,3)
|
||||
date3=datetime.date(2018,12,5)
|
||||
date4=datetime.date(2018,12,8)
|
||||
date5=datetime.date(2018,12,10)
|
||||
HTML='''
|
||||
<head><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head>
|
||||
<html>
|
||||
<body>
|
||||
<h1 style="text-align: center;"><span style="color: #ff0000;">theHarvester Scan Report</span></h1>
|
||||
<h2><span style="color: #000000;"><strong>TheHarvester scanning dashboard</strong></span></h2>
|
||||
<table align="left" style="height: 108px; border-color: #000000; margin-left: auto; margin-right: auto;" border=" #000000" width="713">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>Domains</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>Hosts</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>IP Addresses</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>Vhosts</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>Emails</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>Shodan</strong></h2></td>
|
||||
</tr>
|
||||
'''+'''<tr>
|
||||
<td style="width: 113px; text-align: center;background: #ffff38"><h2><strong>'''+str(totalnumberofdomains)+'''</strong></h2></td>
|
||||
<td style="width: 108px; text-align: center;background: #1f77b4"><h2><strong>'''+str(totalnumberofhosts)+'''</strong></h2></td>
|
||||
<td style="width: 119px; text-align: center;background: #ff7f0e"><h2><strong>'''+str(totalnumberofip)+'''</strong></h2></td>
|
||||
<td style="width: 111px; text-align: center;background: #2ca02c"><h2><strong>'''+str(totalnumberofvhost)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #9467bd"><h2><strong>'''+str(totalnumberofemail)+'''</strong></h2></td>
|
||||
<td style="width: 110px; text-align: center;background: #d62728"><h2><strong>'''+str(totalnumberofshodan)+'''</strong></h2></td>
|
||||
'''+'''
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<h2><span style="color: #000000;">Latest scan summary for '''+scanneddomain+'''</span></h2>
|
||||
<h3><strong><span style="color: #0000ff;">Emails found:</span></strong></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">email1@google.com</span></li>
|
||||
<li><span style="color: #000000;">email2@google.com</span></li>
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;">Hosts found:</span></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">host1.google.com</span></li>
|
||||
<li><span style="color: #000000;">host2.google.com</span></li>
|
||||
<li><span style="color: #000000;">host3.google.com</span></li>
|
||||
</ul>
|
||||
<h3><strong><span style="color: #0000ff;">IP addresses found:</span></strong></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">87.12.42.12</span></li>
|
||||
<li><span style="color: #000000;">87.12.42.11</span></li>
|
||||
<li><span style="color: #000000;">87.12.43.11</span></li>
|
||||
<li><span style="color: #000000;">87.12.44.11</span></li>
|
||||
</ul>
|
||||
<h3><span style="color: #0000ff;"><strong>Shodan results:</strong></span></h3>
|
||||
<ul>
|
||||
<li><span style="color: #000000;">NONE</span></li>
|
||||
</ul>
|
||||
'''
|
||||
barcolumns = ["host","ip","vhost","shodan","email"]
|
||||
bardata = [totalnumberofhosts,totalnumberofip,totalnumberofvhost,totalnumberofshodan,totalnumberofemail]
|
||||
layout = dict(title = "Last scan - number of targets identified for "+scanneddomain+" on "+str(date5),
|
||||
xaxis = dict(title = 'Targets'),
|
||||
yaxis = dict(title = 'Hits'),
|
||||
)
|
||||
|
||||
barchart=plotly.offline.plot({
|
||||
"data": [go.Bar(x=barcolumns,y=bardata)],
|
||||
"layout": layout,
|
||||
}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
HTML+=barchart
|
||||
|
||||
|
||||
trace0 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[3, 10, 9, 17,10],
|
||||
mode = 'lines+markers',
|
||||
name = 'hosts')
|
||||
|
||||
trace1 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[2, 6, 9, 10, 5],
|
||||
mode = 'lines+markers',
|
||||
name = 'IP address')
|
||||
|
||||
trace2 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[1, 2, 4, 6, 2],
|
||||
mode = 'lines+markers',
|
||||
name = 'vhost')
|
||||
|
||||
trace3 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[2, 3, 2, 5, 7],
|
||||
mode = 'lines+markers',
|
||||
name = 'shodan')
|
||||
|
||||
trace4 = go.Scatter(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[12, 14, 20, 24, 20],
|
||||
mode = 'lines+markers',
|
||||
name = 'email')
|
||||
|
||||
|
||||
data = [trace0, trace1, trace2, trace3, trace4]
|
||||
layout = dict(title = "Scanning history for "+scanneddomain,
|
||||
xaxis = dict(title = 'Date'),
|
||||
yaxis = dict(title = 'Results'),
|
||||
)
|
||||
|
||||
scatterchart = plotly.offline.plot({
|
||||
"data": data,
|
||||
"layout": layout}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
HTML+=scatterchart
|
||||
|
||||
trace1 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[20, 21, 23, 20, 17],
|
||||
text=['domain1.com', 'domain1.com', 'domain1.com', 'domain1.com', 'domain1.com'],
|
||||
name='hosts'
|
||||
)
|
||||
trace2 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[24, 23, 29, 30, 25],
|
||||
text=['domain2.com', 'domain2.com', 'domain2.com', 'domain2.com', 'domain2.com'],
|
||||
name='IP addresses'
|
||||
)
|
||||
|
||||
trace3 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[3, 5, 2, 1, 3],
|
||||
text=['domain3.com', 'domain3.com', 'domain3.com', 'domain3.com', 'domain3.com'],
|
||||
name='vhosts'
|
||||
)
|
||||
|
||||
trace4 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[13, 10, 12, 13, 12],
|
||||
text=['domain4.com', 'domain4.com', 'domain4.com', 'domain4.com', 'domain4.com'],
|
||||
name='shodan'
|
||||
)
|
||||
|
||||
trace5 = go.Bar(
|
||||
x=[date1,date2,date3,date4,date5],
|
||||
y=[30, 34, 35, 41, 31],
|
||||
text=['domain5.com', 'domain5.com', 'domain5.com', 'domain5.com', 'domain5.com'],
|
||||
name='email'
|
||||
)
|
||||
|
||||
data = [trace1, trace2, trace3, trace4, trace5]
|
||||
|
||||
layout = dict(title = "theHarvester scan history",
|
||||
xaxis = dict(title = 'Date'),
|
||||
yaxis = dict(title = 'Hits'),
|
||||
barmode='stack'
|
||||
)
|
||||
|
||||
barchart=plotly.offline.plot({
|
||||
"data": data,
|
||||
"layout": layout,
|
||||
}, auto_open=False,include_plotlyjs=False,filename='report.html', output_type='div')
|
||||
HTML+=barchart
|
||||
HTML+='<p><span style="color: #000000;">Report generated on '+ str(datetime.datetime.now())+'</span></p>'
|
||||
HTML+='''
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
Html_file= open("report.html","w")
|
||||
Html_file.write(HTML)
|
||||
Html_file.close()
|
||||
except Exception as e:
|
||||
print("ERROR: "+str(e))
|
||||
+3
-3
@@ -690,12 +690,12 @@ def start(argv):
|
||||
#Reporting#######################################################
|
||||
if filename != "":
|
||||
try:
|
||||
#NEW REPORT BEGINS
|
||||
print("NEW REPORTING BEGINS:")
|
||||
db = stash.stash_manager()
|
||||
scanboarddata = db.getscanboarddata()
|
||||
latestscandomain = db.getlatestscandomain(word)
|
||||
scanhistorydomain = db.getscanhistorydomain(word)
|
||||
scanstatistics = db.getscanstatistics()
|
||||
from lib import statichtmlgenerator
|
||||
generator = statichtmlgenerator.htmlgenerator(word)
|
||||
HTMLcode = generator.generatedashboardcode(scanboarddata)
|
||||
@@ -705,6 +705,7 @@ def start(argv):
|
||||
graph = reportgraph.graphgenerator(word)
|
||||
HTMLcode += graph.drawlatestscangraph(word, latestscandomain)
|
||||
HTMLcode += graph.drawscattergraphscanhistory(word, scanhistorydomain)
|
||||
HTMLcode += generator.generatescanstatistics(scanstatistics)
|
||||
HTMLcode += '<p><span style="color: #000000;">Report generated on '+ str(datetime.datetime.now())+'</span></p>'
|
||||
HTMLcode +='''
|
||||
</body>
|
||||
@@ -713,8 +714,7 @@ def start(argv):
|
||||
Html_file= open("report.html","w")
|
||||
Html_file.write(HTMLcode)
|
||||
Html_file.close()
|
||||
print("NEW REPORTING FINISHED:")
|
||||
#NEW REPORT FINISHED
|
||||
print("NEW REPORTING FINISHED!")
|
||||
|
||||
print("[+] Saving files...")
|
||||
html = htmlExport.htmlExport(
|
||||
|
||||
Reference in New Issue
Block a user