def writehtml(self): page = markup.page() page.title("Metagoofil results") page.html() self.styler() page.head(self.style) page.head.close() page.body() page.h2("Metagoofil results") page.h3("Results for: " + self.domain) graph = graphs.BarGraph('vBar') graph.values = [ len(self.users), len(self.softs), len(self.emails), len(self.paths) ] graph.labels = ["Usernames", "Software", "Emails", "Paths/Servers"] graph.showValues = 1 page.body(graph.create()) page.h3("User names found:") page.ul(class_="userslist") page.li(self.users, class_="useritem") page.ul.close() page.h3("Software versions found:") page.ul(class_="softlist") page.li(self.softs, class_="softitem") page.ul.close() page.h3("E-mails found:") if self.emails != []: page.ul(class_="emailslist") page.li(self.emails, class_="emailitem") page.ul.close() else: page.p("0 results") page.h3("Servers and paths found:") if self.paths != []: page.ul(class_="pathslist") page.li(self.paths, class_="pathitem") page.ul.close() else: page.p("0 results") page.h3("Files analyzed:") page.ul(class_="files") for x in self.allinfo: page.li(x[0], class_="file") page.ul.close() page.h2("Files and metadata found:") for x in self.allinfo: page.h3(x[0]) page.a("Local copy", class_="link", href=self.dir + "/" + x[0].split('/')[-1]) for i in range(len(x[1])): if isinstance(x[1][i], unicode): temp = x[1][i] x[1][i] = "" for c in temp: x[1][i] += chr(ord(c)) try: x[1][i] = x[1][i].decode('gb2312').encode('utf8') except: x[1][i] = x[1][i].decode( chardet.detect(x[1][i])['encoding']).encode('utf8') for i in range(len(x[2])): if isinstance(x[2][i], unicode): temp = x[2][i] x[2][i] = "" for c in temp: x[2][i] += chr(ord(c)) try: x[2][i] = x[2][i].decode('gb2312').encode('utf8') except: x[2][i] = x[2][i].decode( chardet.detect(x[2][i])['encoding']).encode('utf8') page.pre(x[1]) page.pre(x[2]) for i in range(len(x[3])): if isinstance(x[3][i], unicode): temp = x[3][i] x[3][i] = "" for c in temp: x[3][i] += chr(ord(c)) try: x[3][i] = x[3][i].decode('gb2312').encode('utf8') except: x[3][i] = x[3][i].decode( chardet.detect(x[3][i])['encoding']).encode('utf8') page.pre(x[3][i]) page.pre(x[5]) page.pre.close() page.h2("Failed extractions and reasons") for x in self.failed: page.pre(x) page.body.close() page.html.close() file = open(self.fname, 'w') for x in page.content: try: file.write(x) except: #print "Exception" + x # send to logs pass file.close return "ok"
def writehtml(self): page = markup.page() #page.init (title="theHarvester Results",css=('edge.css'),footer="Edge-security 2011")A page.html() self.styler() page.head(self.style) page.body() page.h1("theHarvester results") page.h2("for :" + self.domain) page.h3("Dashboard:") graph = graphs.BarGraph('vBar') graph.values = [ len(self.users), len(self.hosts), len(self.vhost), len(self.tldres), len(self.shodan) ] graph.labels = ['Emails', 'hosts', 'Vhost', 'TLD', 'Shodan'] graph.showValues = 1 page.body(graph.create()) page.h3("E-mails names found:") if self.users != []: page.ul(class_="userslist") page.li(self.users, class_="useritem") page.ul.close() else: page.h2("No emails found") page.h3("Hosts found:") if self.hosts != []: page.ul(class_="softlist") page.li(self.hosts, class_="softitem") page.ul.close() else: page.h2("No hosts found") if self.tldres != []: page.h3("TLD domains found in TLD expansion:") page.ul(class_="tldlist") page.li(self.tldres, class_="tlditem") page.ul.close() if self.dnsres != []: page.h3("Hosts found in DNS brute force:") page.ul(class_="dnslist") page.li(self.dnsres, class_="dnsitem") page.ul.close() if self.dnsrev != []: page.h3("Hosts found with reverse lookup :") page.ul(class_="dnsrevlist") page.li(self.dnsrev, class_="dnsrevitem") page.ul.close() if self.vhost != []: page.h3("Virtual hosts found:") page.ul(class_="pathslist") page.li(self.vhost, class_="pathitem") page.ul.close() if self.shodan != []: shodanalysis = [] page.h3("Shodan results:") for x in self.shodan: res = x.split("SAPO") page.h3(res[0]) page.a("Port :" + res[2]) page.pre(res[1]) page.pre.close() ban = res[1] reg_server = re.compile('Server:.*') temp = reg_server.findall(res[1]) if temp != []: shodanalysis.append(res[0] + ":" + temp[0]) if shodanalysis != []: page.h3("Server technologies:") repeated = [] for x in shodanalysis: if x not in repeated: page.pre(x) page.pre.close() repeated.append(x) page.body.close() page.html.close() file = open(self.fname, 'w') for x in page.content: try: file.write(x) except: print "Exception" + x # send to logs pass file.close return "ok"
def writehtml(self): page = markup.page() # page.init (title="theHarvester # Results",css=('edge.css'),footer="Edge-security 2011")A page.html() self.styler() page.head(self.style) page.body() page.h1("theHarvester results") page.h2("for :" + self.domain) page.h3("Dashboard:") graph = graphs.BarGraph('vBar') graph.values = [len( self.users), len(self.hosts), len(self.vhost), len(self.tldres), len(self.shodan)] graph.labels = ['Emails', 'hosts', 'Vhost', 'TLD', 'Shodan'] graph.showValues = 1 page.body(graph.create()) page.h3("E-mails names found:") if self.users != []: page.ul(class_="userslist") page.li(self.users, class_="useritem") page.ul.close() else: page.h2("No emails found") page.h3("Hosts found:") if self.hosts != []: page.ul(class_="softlist") page.li(self.hosts, class_="softitem") page.ul.close() else: page.h2("No hosts found") if self.tldres != []: page.h3("TLD domains found in TLD expansion:") page.ul(class_="tldlist") page.li(self.tldres, class_="tlditem") page.ul.close() if self.dnsres != []: page.h3("Hosts found in DNS brute force:") page.ul(class_="dnslist") page.li(self.dnsres, class_="dnsitem") page.ul.close() if self.dnsrev != []: page.h3("Hosts found with reverse lookup :") page.ul(class_="dnsrevlist") page.li(self.dnsrev, class_="dnsrevitem") page.ul.close() if self.vhost != []: page.h3("Virtual hosts found:") page.ul(class_="pathslist") page.li(self.vhost, class_="pathitem") page.ul.close() if self.shodan != []: shodanalysis = [] page.h3("Shodan results:") for x in self.shodan: res = x.split("SAPO") page.h3(res[0]) page.a("Port :" + res[2]) page.pre(res[1]) page.pre.close() ban = res[1] reg_server = re.compile('Server:.*') temp = reg_server.findall(res[1]) if temp != []: shodanalysis.append(res[0] + ":" + temp[0]) if shodanalysis != []: page.h3("Server technologies:") repeated = [] for x in shodanalysis: if x not in repeated: page.pre(x) page.pre.close() repeated.append(x) page.body.close() page.html.close() file = open(self.fname, 'w') for x in page.content: try: file.write(x) except: print "Exception" + x # send to logs pass file.close return "ok"
def writehtml(self): page = markup.page() page.title("Metagoofil results") page.html() self.styler() page.head(self.style) page.head.close() page.body() page.h2("Metagoofil results") page.h3("Results for: " + self.domain) graph = graphs.BarGraph('vBar') try: graph.values = [len(self.users),len(self.softs),len(self.emails),len(self.paths)] graph.labels = ["Usernames","Software","Emails","Paths/Servers"] graph.showValues = 1 page.body(graph.create()) except: print "graph" try: page.h3("User names found:") page.ul( class_="userslist") page.li( self.users, class_="useritem") page.ul.close( ) page.h3("Software versions found:") except: print "user" try: page.ul( class_="softlist") page.li(self.softs, class_="softitem") page.ul.close( ) except: print "email" page.h3("E-mails found:") if self.emails!=[]: page.ul( class_="emailslist") page.li(self.emails, class_="emailitem") page.ul.close( ) else: page.p("0 results") page.h3("Servers and paths found:") if self.paths!=[]: page.ul( class_="pathslist") page.li(self.paths, class_="pathitem") page.ul.close( ) else: page.p("0 results") page.h3("Files analyzed:") page.ul( class_="files") for x in self.allinfo: page.li(x[0], class_="file") page.ul.close() page.h2("Files and metadata found:") for x in self.allinfo: page.h3(x[0]) page.a("Local copy", class_="link", href=self.dir+"/"+x[0]) page.pre(x[1]) page.pre(x[2]) page.pre(x[3]) page.pre(x[5]) page.pre.close() page.h2("Failed extractions and reasons") for x in self.failed: page.pre(x) page.body.close() page.html.close() file = open(self.fname,'w') for x in page.content: try: file.write(x) except: #print "Exception" + x # send to logs pass file.close return "ok"
def writehtml(self): page = markup.page() #page.init (title="theHarvester Results",css=('edge.css'),footer="Edge-security 2011")A page.html() self.styler() page.head(self.style) page.body() page.h1("theHarvester results") page.h2("for: " + self.word) page.h3("Dashboard:") graph = graphs.BarGraph('vBar') graph.values = [len(self.emails), len(self.hosts_ips), len(self.vhost), len(self.dns_tld_results), len(self.dns_brute_results), len(self.dns_reverse_results), len(self.shodan_results)] graph.labels = ['Emails','hosts','Vhost','TLD','Brute','Reverse','Shodan'] graph.showValues = 1 page.body(graph.create()) page.h3("E-mails names found:") if self.emails!=[]: page.ul( class_="emaillist") page.li( self.emails, class_="emailitem") page.ul.close( ) else: page.h2("No emails found") page.h3("Hosts found:") if self.hosts_ips!=[]: page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.hosts_ips.iteritems() : page.addcontent("<tr><td>"+ip+"</td><td>"+host+"</td></tr>") page.table.close() else: page.h2("No hosts found") if len(self.people)>0: page.h3("People found:") page.ul( class_="peoplelist") page.li(self.people, class_="peopleitem") page.ul.close( ) if len(self.dns_tld_results)>0: page.h3("TLD domains found in TLD expansion:") page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.dns_tld_results.iteritems() : page.addcontent("<tr><td>"+ip+"</td><td>"+host+"</td></tr>") page.table.close() if len(self.dns_brute_results)>0: page.h3("Hosts found in DNS brute force:") page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.dns_brute_results.iteritems() : page.addcontent("<tr><td>"+ip+"</td><td>"+host+"</td></tr>") page.table.close() if len(self.dns_reverse_results)>0: page.h3("Hosts found with reverse lookup :") page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.dns_reverse_results.iteritems() : page.addcontent("<tr class='dnsrevitem'><td>"+ip+"</td><td>"+host+"</td></tr>") page.table.close() if len(self.vhost)>0: page.h3("Virtual hosts found:") page.ul( class_="pathslist") page.li(self.vhost, class_="pathitem") page.ul.close( ) if len(self.shodan_results)>0: shodanalysis=[] page.h3("Shodan results:") for shodan_result in self.shodan_results: page.h3(shodan_result.ip+":"+shodan_result.host+' - Updated: '+shodan_result.last_update) page.a("Port :" + shodan_result.port) page.pre(shodan_result.banner) page.pre.close() banner=shodan_result.banner reg_server=re.compile('Server:.*') temp=reg_server.findall(banner) if temp != []: shodanalysis.append(shodan_result.ip+":"+shodan_result.host+" - "+temp[0]) if shodanalysis != []: page.h3("Server technologies:") repeated=[] for x in shodanalysis: if x not in repeated: page.pre(x) page.pre.close() repeated.append(x) page.body.close() page.html.close() file = open(self.html_filename,'w') for x in page.content: try: file.write(x) except: print "Exception" + x # send to logs pass file.close() return "ok"
def writehtml(self): page = markup.page() page.title("Metagoofil results") page.html() self.styler() page.head(self.style) page.head.close() page.body() page.h2("Metagoofil results") page.h3("Results for: " + self.domain) graph = graphs.BarGraph('vBar') graph.values = [len(self.users),len(self.softs),len(self.emails),len(self.paths)] graph.labels = ["Usernames","Software","Emails","Paths/Servers"] graph.showValues = 1 page.body(graph.create()) page.h3("User names found:") page.ul( class_="userslist") page.li( self.users, class_="useritem") page.ul.close( ) page.h3("Software versions found:") page.ul( class_="softlist") page.li(self.softs, class_="softitem") page.ul.close( ) page.h3("E-mails found:") if self.emails!=[]: page.ul( class_="emailslist") page.li(self.emails, class_="emailitem") page.ul.close( ) else: page.p("0 results") page.h3("Servers and paths found:") if self.paths!=[]: page.ul( class_="pathslist") page.li(self.paths, class_="pathitem") page.ul.close( ) else: page.p("0 results") page.h3("Files analyzed:") page.ul( class_="files") for x in self.allinfo: page.li(x[0], class_="file") page.ul.close() page.h2("Files and metadata found:") for x in self.allinfo: page.h3(x[0]) page.a("Local copy", class_="link", href=self.dir+"/"+x[0].split('/')[-1]) for i in range(len(x[1])): if isinstance(x[1][i], unicode): temp = x[1][i] x[1][i] = "" for c in temp: x[1][i] += chr(ord(c)) try: x[1][i] = x[1][i].decode('gb2312').encode('utf8') except: x[1][i] = x[1][i].decode(chardet.detect(x[1][i])['encoding']).encode('utf8') for i in range(len(x[2])): if isinstance(x[2][i], unicode): temp = x[2][i] x[2][i] = "" for c in temp: x[2][i] += chr(ord(c)) try: x[2][i] = x[2][i].decode('gb2312').encode('utf8') except: x[2][i] = x[2][i].decode(chardet.detect(x[2][i])['encoding']).encode('utf8') page.pre(x[1]) page.pre(x[2]) for i in range(len(x[3])): if isinstance(x[3][i], unicode): temp = x[3][i] x[3][i] = "" for c in temp: x[3][i] += chr(ord(c)) try: x[3][i] = x[3][i].decode('gb2312').encode('utf8') except: x[3][i] = x[3][i].decode(chardet.detect(x[3][i])['encoding']).encode('utf8') page.pre(x[3][i]) page.pre(x[5]) page.pre.close() page.h2("Failed extractions and reasons") for x in self.failed: page.pre(x) page.body.close() page.html.close() file = open(self.fname,'w') for x in page.content: try: file.write(x) except: #print "Exception" + x # send to logs pass file.close return "ok"
def writehtml(self): page = markup.page() #page.init (title="theHarvester Results",css=('edge.css'),footer="Edge-security 2011")A page.html() self.styler() page.head(self.style) page.body() page.h1("theHarvester results") page.h2("for: " + self.word) page.h3("Dashboard:") graph = graphs.BarGraph('vBar') graph.values = [ len(self.emails), len(self.hosts_ips), len(self.vhost), len(self.dns_tld_results), len(self.dns_brute_results), len(self.dns_reverse_results), len(self.shodan_results) ] graph.labels = [ 'Emails', 'hosts', 'Vhost', 'TLD', 'Brute', 'Reverse', 'Shodan' ] graph.showValues = 1 page.body(graph.create()) page.h3("E-mails names found:") if self.emails != []: page.ul(class_="emaillist") page.li(self.emails, class_="emailitem") page.ul.close() else: page.h2("No emails found") page.h3("Hosts found:") if self.hosts_ips != []: page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.hosts_ips.iteritems(): page.addcontent("<tr><td>" + ip + "</td><td>" + host + "</td></tr>") page.table.close() else: page.h2("No hosts found") if len(self.people) > 0: page.h3("People found:") page.ul(class_="peoplelist") page.li(self.people, class_="peopleitem") page.ul.close() if len(self.dns_tld_results) > 0: page.h3("TLD domains found in TLD expansion:") page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.dns_tld_results.iteritems(): page.addcontent("<tr><td>" + ip + "</td><td>" + host + "</td></tr>") page.table.close() if len(self.dns_brute_results) > 0: page.h3("Hosts found in DNS brute force:") page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.dns_brute_results.iteritems(): page.addcontent("<tr><td>" + ip + "</td><td>" + host + "</td></tr>") page.table.close() if len(self.dns_reverse_results) > 0: page.h3("Hosts found with reverse lookup :") page.table(class_="HarvesterTable") page.addcontent("<tr><td>IP</td><td>Host</td></tr>") for host, ip in self.dns_reverse_results.iteritems(): page.addcontent("<tr class='dnsrevitem'><td>" + ip + "</td><td>" + host + "</td></tr>") page.table.close() if len(self.vhost) > 0: page.h3("Virtual hosts found:") page.ul(class_="pathslist") page.li(self.vhost, class_="pathitem") page.ul.close() if len(self.shodan_results) > 0: shodanalysis = [] page.h3("Shodan results:") for shodan_result in self.shodan_results: page.h3(shodan_result.ip + ":" + shodan_result.host + ' - Updated: ' + shodan_result.last_update) page.a("Port :" + shodan_result.port) page.pre(shodan_result.banner) page.pre.close() banner = shodan_result.banner reg_server = re.compile('Server:.*') temp = reg_server.findall(banner) if temp != []: shodanalysis.append(shodan_result.ip + ":" + shodan_result.host + " - " + temp[0]) if shodanalysis != []: page.h3("Server technologies:") repeated = [] for x in shodanalysis: if x not in repeated: page.pre(x) page.pre.close() repeated.append(x) page.body.close() page.html.close() file = open(self.html_filename, 'w') for x in page.content: try: file.write(x) except: print "Exception" + x # send to logs pass file.close() return "ok"
def writehtml(self): page = markup.page() page.html() self.styler() page.head(self.style) page.body() page.h1('theHarvester results') page.h2('for :' + self.domain) page.h3('Dashboard:') graph = graphs.BarGraph('vBar') graph.values = [ len(self.users), len(self.hosts), len(self.vhost), len(self.tldres), len(self.shodan) ] graph.labels = ['Emails', 'hosts', 'Vhost', 'TLD', 'Shodan'] graph.showValues = 1 page.body(graph.create()) page.h3('Emails found:') if self.users != []: page.ul(class_='userslist') page.li(self.users, class_='useritem') page.ul.close() else: page.h2('No emails found.') page.h3('Hosts found:') if self.hosts != []: page.ul(class_='softlist') page.li(self.hosts, class_='softitem') page.ul.close() else: page.h2('No hosts found.') if self.tldres != []: page.h3('TLD domains found in TLD expansion:') page.ul(class_='tldlist') page.li(self.tldres, class_='tlditem') page.ul.close() if self.dnsres != []: page.h3('Hosts found in DNS brute force:') page.ul(class_='dnslist') page.li(self.dnsres, class_='dnsitem') page.ul.close() if self.dnsrev != []: page.h3('Hosts found with reverse lookup:') page.ul(class_='dnsrevlist') page.li(self.dnsrev, class_='dnsrevitem') page.ul.close() if self.vhost != []: page.h3('Virtual hosts found:') page.ul(class_='pathslist') page.li(self.vhost, class_='pathitem') page.ul.close() if self.shodan != []: shodanalysis = [] page.h3('Shodan results:') for x in self.shodan: res = x.split('SAPO') page.h3(res[0]) page.a('Port:' + res[2]) page.pre(res[1]) page.pre.close() ban = res[1] reg_server = re.compile('Server:.*') temp = reg_server.findall(res[1]) if temp != []: shodanalysis.append(res[0] + ':' + temp[0]) if shodanalysis != []: page.h3('Server technologies:') repeated = [] for x in shodanalysis: if x not in repeated: page.pre(x) page.pre.close() repeated.append(x) page.body.close() page.html.close() file = open(self.fname, 'w') for x in page.content: try: file.write(x) except: print('Exception' + x) # Send to logs. pass file.close() return 'ok'