From 2021f0f265ea2c4b28b334c16022a1d21640b233 Mon Sep 17 00:00:00 2001 From: Lee Baird Date: Fri, 11 Jan 2019 15:01:52 -0600 Subject: [PATCH] Changed print quotes to single quotes. --- discovery/DNS/Base.py | 2 +- discovery/DNS/win32dns.py | 16 ++++------- discovery/takeover.py | 2 +- discovery/threatcrowd.py | 2 +- discovery/virustotal.py | 2 +- discovery/wfuzz_search.py | 4 +-- lib/core.py | 56 +++++++++++++++++++------------------- lib/htmlExport.py | 2 +- lib/reportgraph.py | 6 ++-- lib/statichtmlgenerator.py | 8 +++--- parsers/censysparser.py | 8 +++--- parsers/cymonparser.py | 2 +- stash.py | 6 ++-- 13 files changed, 56 insertions(+), 60 deletions(-) diff --git a/discovery/DNS/Base.py b/discovery/DNS/Base.py index c0306c93..b4101a0e 100644 --- a/discovery/DNS/Base.py +++ b/discovery/DNS/Base.py @@ -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] == '#': diff --git a/discovery/DNS/win32dns.py b/discovery/DNS/win32dns.py index 71e67e3a..c08e111e 100644 --- a/discovery/DNS/win32dns.py +++ b/discovery/DNS/win32dns.py @@ -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. diff --git a/discovery/takeover.py b/discovery/takeover.py index 2cb53ace..b03b9748 100644 --- a/discovery/takeover.py +++ b/discovery/takeover.py @@ -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) diff --git a/discovery/threatcrowd.py b/discovery/threatcrowd.py index c8e4562d..f92dfa9c 100644 --- a/discovery/threatcrowd.py +++ b/discovery/threatcrowd.py @@ -33,4 +33,4 @@ def get_hostnames(self): def process(self): self.do_search() - print("\tSearching Threatcrowd results.") + print('\tSearching Threatcrowd results.') diff --git a/discovery/virustotal.py b/discovery/virustotal.py index b1944480..ce2dbe5c 100644 --- a/discovery/virustotal.py +++ b/discovery/virustotal.py @@ -33,4 +33,4 @@ def get_hostnames(self): def process(self): self.do_search() - print("\tSearching Virustotal results.") + print('\tSearching Virustotal results.') diff --git a/discovery/wfuzz_search.py b/discovery/wfuzz_search.py index 78975e7b..37bc73a5 100644 --- a/discovery/wfuzz_search.py +++ b/discovery/wfuzz_search.py @@ -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') diff --git a/lib/core.py b/lib/core.py index 897d2185..a3336298 100644 --- a/lib/core.py +++ b/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 \n \033[0m") - print(" -d: company name or domain to search") + print('\033[94m Usage: theHarvester.py \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(): diff --git a/lib/htmlExport.py b/lib/htmlExport.py index 3d90c90a..ef2105e5 100644 --- a/lib/htmlExport.py +++ b/lib/htmlExport.py @@ -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" diff --git a/lib/reportgraph.py b/lib/reportgraph.py index b1670536..a577ea99 100644 --- a/lib/reportgraph.py +++ b/lib/reportgraph.py @@ -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)) diff --git a/lib/statichtmlgenerator.py b/lib/statichtmlgenerator.py index db22c0c2..c94b5759 100644 --- a/lib/statichtmlgenerator.py +++ b/lib/statichtmlgenerator.py @@ -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)) diff --git a/parsers/censysparser.py b/parsers/censysparser.py index 87b77796..c6ab7bd3 100644 --- a/parsers/censysparser.py +++ b/parsers/censysparser.py @@ -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)) diff --git a/parsers/cymonparser.py b/parsers/cymonparser.py index 38703f9a..b838823e 100644 --- a/parsers/cymonparser.py +++ b/parsers/cymonparser.py @@ -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)) diff --git a/stash.py b/stash.py index 2442dcf3..2bf751c4 100644 --- a/stash.py +++ b/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()