From 08fd9d7eba9d1aa5c64be0a0ecd50e1d151ea894 Mon Sep 17 00:00:00 2001 From: Pau Rodriguez Date: Sat, 13 Feb 2016 12:56:21 +0100 Subject: [PATCH] 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 --- theHarvester.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) mode change 100644 => 100755 theHarvester.py diff --git a/theHarvester.py b/theHarvester.py old mode 100644 new mode 100755 index 215c6e48..f23ff8ff --- a/theHarvester.py +++ b/theHarvester.py @@ -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('') for x in all_emails: file.write('' + x + '') - for x in all_hosts: - file.write('' + x + '') + + for x in full: + x = x.split(":") + if len(x) == 2: + file.write('' + '' + x[0] + '' + x[1] + '' + '') + else: + file.write('' + x + '') for x in vhost: - file.write('' + x + '') + x = x.split(":") + if len(x) == 2: + file.write('' + '' + x[0] + '' + x[1] + '' + '') + else: + file.write('' + x + '') + + 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('') + #page.h3(res[0]) + file.write('' + res[0] + '') + #page.a("Port :" + res[2]) + file.write('' + res[2] + '') + #page.pre(res[1]) + file.write('') + + + reg_server = re.compile('Server:.*') + temp = reg_server.findall(res[1]) + if temp != []: + shodanalysis.append(res[0] + ":" + temp[0]) + + file.write('') + if shodanalysis != []: + shodanalysis=sorted(set(shodanalysis)) + file.write('') + for x in shodanalysis: + #page.pre(x) + file.write('' + x + '') + file.write('') + + file.write('') file.close print "Files saved!"