From 800e472ecf431170350731d7bfa93d116f99dc5c Mon Sep 17 00:00:00 2001 From: jzold Date: Fri, 14 Dec 2018 16:18:29 +0000 Subject: [PATCH] Create testreportstack.py --- testreportstack.py | 186 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 testreportstack.py diff --git a/testreportstack.py b/testreportstack.py new file mode 100644 index 00000000..bf1ec979 --- /dev/null +++ b/testreportstack.py @@ -0,0 +1,186 @@ +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=''' + + + +

theHarvester Scan Report

+

TheHarvester scanning dashboard

+ + + + + + + + + + + '''+''' + + + + + + + '''+''' + + +

Domains

Hosts

IP Addresses

Vhosts

Emails

Shodan

'''+str(totalnumberofdomains)+'''

'''+str(totalnumberofhosts)+'''

'''+str(totalnumberofip)+'''

'''+str(totalnumberofvhost)+'''

'''+str(totalnumberofemail)+'''

'''+str(totalnumberofshodan)+'''

+

 

+

 

+

 

+

 

+

Latest scan summary for '''+scanneddomain+'''

+

Emails found:

+ +

Hosts found:

+ +

IP addresses found:

+ +

Shodan results:

+ + ''' + 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+='

Report generated on '+ str(datetime.datetime.now())+'

' + HTML+=''' + + + ''' + + Html_file= open("report.html","w") + Html_file.write(HTML) + Html_file.close() +except Exception as e: + print("ERROR: "+str(e))