lgtm fixes and a few other fixes

This commit is contained in:
Jay Townsend 2019-09-15 13:32:29 +01:00
parent 94de2f6423
commit 9c9e6f2d9a

View file

@ -19,11 +19,9 @@ def __init__(self, word, limit, start):
self.counter = start self.counter = start
def do_search(self): def do_search(self):
try: # Do normal scraping. # Do normal scraping.
urly = 'http://' + self.server + '/search?num=' + self.quantity + '&start=' + str( urly = 'http://' + self.server + '/search?num=' + self.quantity + '&start=' + str(
self.counter) + '&hl=en&meta=&q=%40\"' + self.word + '\"' self.counter) + '&hl=en&meta=&q=%40\"' + self.word + '\"'
except Exception as e:
print(e)
try: try:
headers = {'User-Agent': googleUA} headers = {'User-Agent': googleUA}
r = requests.get(urly, headers=headers) r = requests.get(urly, headers=headers)
@ -37,17 +35,14 @@ def do_search(self):
return return
else: else:
self.results = google_workaround(urly) self.results = google_workaround(urly)
except BaseException: except Exception:
pass pass
time.sleep(getDelay()) time.sleep(getDelay())
self.totalresults += self.results self.totalresults += self.results
def do_search_profiles(self): def do_search_profiles(self):
try: urly = 'http://' + self.server + '/search?num=' + self.quantity + '&start=' + str(
urly = 'http://' + self.server + '/search?num=' + self.quantity + '&start=' + str( self.counter) + '&hl=en&meta=&q=site:www.google.com%20intitle:\"Google%20Profile\"%20\"Companies%20I%27ve%20worked%20for\"%20\"at%20' + self.word + '\"'
self.counter) + '&hl=en&meta=&q=site:www.google.com%20intitle:\"Google%20Profile\"%20\"Companies%20I%27ve%20worked%20for\"%20\"at%20' + self.word + '\"'
except Exception as e:
print(e)
try: try:
headers = {'User-Agent': googleUA} headers = {'User-Agent': googleUA}
r = requests.get(urly, headers=headers) r = requests.get(urly, headers=headers)
@ -61,7 +56,7 @@ def do_search_profiles(self):
return return
else: else:
self.results = google_workaround(urly) self.results = google_workaround(urly)
except BaseException: except Exception:
pass pass
time.sleep(getDelay()) time.sleep(getDelay())
self.totalresults += self.results self.totalresults += self.results
@ -155,7 +150,7 @@ def send_dorks(self): # Helper function to minimize code reusability.
return return
else: else:
self.results = google_workaround(link) self.results = google_workaround(link)
except BaseException: except Exception:
pass pass
time.sleep(getDelay()) time.sleep(getDelay())
self.totalresults += self.results self.totalresults += self.results