mirror of
https://github.com/laramies/theHarvester.git
synced 2024-09-20 15:26:31 +08:00
Changed print quotes to single quotes.
This commit is contained in:
parent
e36a260191
commit
2021f0f265
|
@ -29,7 +29,7 @@ def ParseResolvConf(resolv_path):
|
|||
try:
|
||||
lines = open(resolv_path).readlines()
|
||||
except:
|
||||
print("error in path" + resolv_path)
|
||||
print('error in path' + resolv_path)
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if not line or line[0] == ';' or line[0] == '#':
|
||||
|
|
|
@ -108,16 +108,16 @@ def RegistryResolve():
|
|||
break
|
||||
winreg.CloseKey(y)
|
||||
except EnvironmentError:
|
||||
# print "Key Interfaces not found, just do nothing"
|
||||
# print "Key Interfaces not found, just do nothing."
|
||||
pass
|
||||
#
|
||||
winreg.CloseKey(x)
|
||||
return nameservers
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Name servers:", RegistryResolve())
|
||||
|
||||
#
|
||||
if __name__ == "__main__":
|
||||
print('Name servers:', RegistryResolve())
|
||||
|
||||
# $Log: win32dns.py,v $
|
||||
# Revision 1.3.2.1 2007/05/22 20:26:49 customdesigned
|
||||
# Fix win32 nameserver discovery.
|
||||
|
@ -128,8 +128,7 @@ def RegistryResolve():
|
|||
# *sigh*
|
||||
#
|
||||
# Revision 1.2 2002/03/19 12:41:33 anthonybaxter
|
||||
# tabnannied and reindented everything. 4 space indent, no tabs.
|
||||
# yay.
|
||||
# tabnannied and reindented everything. 4 space indent, no tabs. yay.
|
||||
#
|
||||
# Revision 1.1 2001/08/09 09:22:28 anthonybaxter
|
||||
# added what I hope is win32 resolver lookup support. I'll need to try
|
||||
|
@ -141,7 +140,4 @@ def RegistryResolve():
|
|||
# win32dns.py from
|
||||
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66260
|
||||
#
|
||||
# Really, ParseResolvConf() should be renamed "FindNameServers" or
|
||||
# some such.
|
||||
#
|
||||
#
|
||||
# Really, ParseResolvConf() should be renamed "FindNameServers" or some such.
|
||||
|
|
|
@ -30,7 +30,7 @@ def __init__(self, host):
|
|||
|
||||
def do_take(self):
|
||||
try:
|
||||
print("\t Searching takeovers for " + self.host)
|
||||
print('\t Searching takeovers for ' + self.host)
|
||||
r = requests.get('https://' + self.host, verify=False)
|
||||
for x in self.fingerprints:
|
||||
take_reg = re.compile(x)
|
||||
|
|
|
@ -33,4 +33,4 @@ def get_hostnames(self):
|
|||
|
||||
def process(self):
|
||||
self.do_search()
|
||||
print("\tSearching Threatcrowd results.")
|
||||
print('\tSearching Threatcrowd results.')
|
||||
|
|
|
@ -33,4 +33,4 @@ def get_hostnames(self):
|
|||
|
||||
def process(self):
|
||||
self.do_search()
|
||||
print("\tSearching Virustotal results.")
|
||||
print('\tSearching Virustotal results.')
|
||||
|
|
|
@ -12,7 +12,7 @@ def __init__(self, host):
|
|||
self.totalresults = ""
|
||||
|
||||
def do_search(self):
|
||||
print("elo")
|
||||
print('elo')
|
||||
try:
|
||||
for r in wfuzz.fuzz(url="https://"+self.host+"/FUZZ", hc=[404], payloads=[("file", dict(fn="wordlists/general/common.txt"))]):
|
||||
print(r)
|
||||
|
@ -29,4 +29,4 @@ def do_check(self):
|
|||
|
||||
def process(self):
|
||||
self.do_search()
|
||||
print("\tSearching Wfuzz")
|
||||
print('\tSearching Wfuzz')
|
||||
|
|
56
lib/core.py
56
lib/core.py
|
@ -8,19 +8,19 @@
|
|||
class Core:
|
||||
@staticmethod
|
||||
def banner():
|
||||
print("\n\033[93m*******************************************************************")
|
||||
print('\n\033[93m*******************************************************************')
|
||||
print("* _ _ _ *")
|
||||
print("* | |_| |__ ___ /\ /\__ _ _ ____ _____ ___| |_ ___ _ __ *")
|
||||
print("* | __| _ \ / _ \ / /_/ / _` | '__\ \ / / _ \/ __| __/ _ \ '__| *")
|
||||
print("* | |_| | | | __/ / __ / (_| | | \ V / __/\__ \ || __/ | *")
|
||||
print("* \__|_| |_|\___| \/ /_/ \__,_|_| \_/ \___||___/\__\___|_| *")
|
||||
print("* *")
|
||||
print("* theHarvester 3.0.6 v174 *")
|
||||
print("* Coded by Christian Martorella *")
|
||||
print("* Edge-Security Research *")
|
||||
print("* cmartorella@edge-security.com *")
|
||||
print("* *")
|
||||
print("******************************************************************* \n\n \033[0m")
|
||||
print('* *')
|
||||
print('* theHarvester 3.0.6 v174 *')
|
||||
print('* Coded by Christian Martorella *')
|
||||
print('* Edge-Security Research *')
|
||||
print('* cmartorella@edge-security.com *')
|
||||
print('* *')
|
||||
print('******************************************************************* \n\n \033[0m')
|
||||
|
||||
@staticmethod
|
||||
def usage():
|
||||
|
@ -29,30 +29,30 @@ def usage():
|
|||
if os.path.dirname(sys.argv[0]) == os.getcwd():
|
||||
comm = "./" + comm
|
||||
|
||||
print("\033[94m Usage: theHarvester.py <options> \n \033[0m")
|
||||
print(" -d: company name or domain to search")
|
||||
print('\033[94m Usage: theHarvester.py <options> \n \033[0m')
|
||||
print(' -d: company name or domain to search')
|
||||
print(""" -b: source: baidu, bing, bingapi, censys, crtsh, cymon, dogpile,
|
||||
google, googleCSE, google-certificates, google-profiles,
|
||||
hunter, linkedin, netcraft, pgp, securityTrails, threatcrowd,
|
||||
trello, twitter, vhost, virustotal, yahoo, all""")
|
||||
print(" -l: limit the number of search results")
|
||||
print(" -s: start with result number X (default: 0)")
|
||||
print(" -g: use Google Dorking instead of normal Google search")
|
||||
print(" -h: use Shodan to query discovered hosts")
|
||||
print(" -e: specify DNS server")
|
||||
print(" -v: verify host name via DNS resolution and search for virtual hosts")
|
||||
print(" -n: perform a DNS reverse query on all ranges discovered")
|
||||
print(" -c: perform a DNS brute force on the domain")
|
||||
print(" -t: perform a DNS TLD expansion discovery")
|
||||
print(" -p: port scan the detected hosts and check for Takeovers (21,22,80,443,8080)")
|
||||
print(" -f: save the results to an HTML and/or XML file")
|
||||
print("\n\033[94m Examples: \033[0m")
|
||||
print((" " + comm + " -d acme.com -l 500 -b google -f myresults.html"))
|
||||
print((" " + comm + " -d acme.com -b pgp, virustotal"))
|
||||
print((" " + comm + " -d acme -l 200 -b linkedin"))
|
||||
print((" " + comm + " -d acme.com -l 200 -g -b google"))
|
||||
print((" " + comm + " -d acme.com -b googleCSE -l 500 -s 300"))
|
||||
print((" " + comm + " -d acme.edu -l 100 -b bing -h \n"))
|
||||
print(' -l: limit the number of search results')
|
||||
print(' -s: start with result number X (default: 0)')
|
||||
print(' -g: use Google Dorking instead of normal Google search')
|
||||
print(' -h: use Shodan to query discovered hosts')
|
||||
print(' -e: specify DNS server')
|
||||
print(' -v: verify host name via DNS resolution and search for virtual hosts')
|
||||
print(' -n: perform a DNS reverse query on all ranges discovered')
|
||||
print(' -c: perform a DNS brute force on the domain')
|
||||
print(' -t: perform a DNS TLD expansion discovery')
|
||||
print(' -p: port scan the detected hosts and check for Takeovers (21,22,80,443,8080)')
|
||||
print(' -f: save the results to an HTML and/or XML file')
|
||||
print('\n\033[94m Examples: \033[0m')
|
||||
print((' ' + comm + ' -d acme.com -l 500 -b google -f myresults.html'))
|
||||
print((' ' + comm + ' -d acme.com -b pgp, virustotal'))
|
||||
print((' ' + comm + ' -d acme -l 200 -b linkedin'))
|
||||
print((' ' + comm + ' -d acme.com -l 200 -g -b google'))
|
||||
print((' ' + comm + ' -d acme.com -b googleCSE -l 500 -s 300'))
|
||||
print((' ' + comm + ' -d acme.edu -l 100 -b bing -h \n'))
|
||||
|
||||
@staticmethod
|
||||
def get_user_agent():
|
||||
|
|
|
@ -162,7 +162,7 @@ def writehtml(self):
|
|||
try:
|
||||
file.write(x)
|
||||
except:
|
||||
print("Exception" + x) # Send to logs.
|
||||
print('Exception' + x) # Send to logs.
|
||||
pass
|
||||
file.close()
|
||||
return "ok"
|
||||
|
|
|
@ -40,7 +40,7 @@ def drawlatestscangraph(self,domain,latestscandata):
|
|||
}, 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))
|
||||
print('Error generating HTML bar graph code for domain: ' + str(e))
|
||||
|
||||
def drawscattergraphscanhistory(self,domain,scanhistorydomain):
|
||||
try:
|
||||
|
@ -93,7 +93,7 @@ def drawscattergraphscanhistory(self,domain,scanhistorydomain):
|
|||
"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))
|
||||
print('Error generating HTML for the historical graph for domain: ' + str(e))
|
||||
|
||||
except Exception as e:
|
||||
print("Error in the reportgraph module: " + str(e))
|
||||
print('Error in the reportgraph module: ' + str(e))
|
||||
|
|
|
@ -59,7 +59,7 @@ def generatepreviousscanresults(self, previousscanresults):
|
|||
'''
|
||||
return html
|
||||
except Exception as e:
|
||||
print("Error generating the previous scan results HTML code: " + str(e))
|
||||
print('Error generating the previous scan results HTML code: ' + str(e))
|
||||
|
||||
def generatelatestscanresults(self, latestscanresults):
|
||||
try:
|
||||
|
@ -94,7 +94,7 @@ def generatelatestscanresults(self, latestscanresults):
|
|||
'''
|
||||
return html
|
||||
except Exception as e:
|
||||
print("Error generating the latest scan results HTML code: " + str(e))
|
||||
print('Error generating the latest scan results HTML code: ' + str(e))
|
||||
|
||||
def beginhtml(self):
|
||||
html = '''
|
||||
|
@ -140,7 +140,7 @@ def generatedashboardcode(self, scanboarddata):
|
|||
'''
|
||||
return html
|
||||
except Exception as e:
|
||||
print("Error generating dashboard HTML code: " + str(e))
|
||||
print('Error generating dashboard HTML code: ' + str(e))
|
||||
|
||||
def generatepluginscanstatistics(self, scanstatistics):
|
||||
try:
|
||||
|
@ -173,4 +173,4 @@ def generatepluginscanstatistics(self, scanstatistics):
|
|||
'''
|
||||
return html
|
||||
except Exception as e:
|
||||
print("Error generating scan statistics HTML code: " + str(e))
|
||||
print('Error generating scan statistics HTML code: ' + str(e))
|
||||
|
|
|
@ -29,7 +29,7 @@ def search_hostnamesfromcerts(self):
|
|||
self.hostnamesfromcerts = matchingdomains
|
||||
return self.hostnamesfromcerts
|
||||
except Exception as e:
|
||||
print("Error occurred in the Censys module: certificate hostname parser: " + str(e))
|
||||
print('Error occurred in the Censys module: certificate hostname parser: ' + str(e))
|
||||
|
||||
def search_ipaddresses(self):
|
||||
try:
|
||||
|
@ -38,7 +38,7 @@ def search_ipaddresses(self):
|
|||
self.ipaddresses.append(ipaddressitem.text.strip())
|
||||
return self.ipaddresses
|
||||
except Exception as e:
|
||||
print("Error occurred in the Censys module: IP address parser: " + str(e))
|
||||
print('Error occurred in the Censys module: IP address parser: ' + str(e))
|
||||
|
||||
def search_totalpageshosts(self):
|
||||
try:
|
||||
|
@ -48,7 +48,7 @@ def search_totalpageshosts(self):
|
|||
self.numberofpageshosts = int(pagenumber)
|
||||
return self.numberofpageshosts
|
||||
except Exception as e:
|
||||
print("Error occurred in the Censys module IP search: page parser: " + str(e))
|
||||
print('Error occurred in the Censys module IP search: page parser: ' + str(e))
|
||||
|
||||
def search_totalpagescerts(self):
|
||||
try:
|
||||
|
@ -58,4 +58,4 @@ def search_totalpagescerts(self):
|
|||
self.numberofpagescerts = int(pagenumber)
|
||||
return self.numberofpagescerts
|
||||
except Exception as e:
|
||||
print("Error occurred in the Censys module IP search: page parser: " + str(e))
|
||||
print('Error occurred in the Censys module IP search: page parser: ' + str(e))
|
||||
|
|
|
@ -16,4 +16,4 @@ def search_ipaddresses(self):
|
|||
self.ipaddresses = set(allip)
|
||||
return self.ipaddresses
|
||||
except Exception as e:
|
||||
print("Error occurred: " + str(e))
|
||||
print('Error occurred: ' + str(e))
|
||||
|
|
6
stash.py
6
stash.py
|
@ -132,7 +132,7 @@ def getlatestscanresults(self, domain, previousday=False):
|
|||
self.previousscanresults = results
|
||||
return self.previousscanresults
|
||||
except Exception as e:
|
||||
print("Error in getting the previous scan results from the database: " + str(e))
|
||||
print('Error in getting the previous scan results from the database: ' + str(e))
|
||||
else:
|
||||
try:
|
||||
c = conn.cursor()
|
||||
|
@ -149,9 +149,9 @@ def getlatestscanresults(self, domain, previousday=False):
|
|||
self.latestscanresults = results
|
||||
return self.latestscanresults
|
||||
except Exception as e:
|
||||
print("Error in getting the latest scan results from the database: " + str(e))
|
||||
print('Error in getting the latest scan results from the database: ' + str(e))
|
||||
except Exception as e:
|
||||
print("Error connecting to theHarvester database: " + str(e))
|
||||
print('Error connecting to theHarvester database: ' + str(e))
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue