mirror of
https://github.com/laramies/theHarvester.git
synced 2025-02-25 15:03:01 +08:00
Doc sting updates and did a rename on a method for pep8 fix
This commit is contained in:
parent
8863ba6715
commit
d8d171874b
5 changed files with 18 additions and 12 deletions
|
@ -50,12 +50,16 @@ def filter(lst):
|
|||
return new_lst
|
||||
|
||||
|
||||
def getDelay() -> float:
|
||||
def get_delay() -> float:
|
||||
"""Method that is used to generate a random delay"""
|
||||
return random.randint(1, 3) - .5
|
||||
|
||||
|
||||
async def search(text: str) -> bool:
|
||||
# Helper function to check if Google has blocked traffic.
|
||||
"""Helper function to check if Google has blocked traffic.
|
||||
:param text: See if certain text is returned which means Google is blocking us
|
||||
:return bool:
|
||||
"""
|
||||
for line in text.strip().splitlines():
|
||||
if 'This page appears when Google automatically detects requests coming from your computer network' in line \
|
||||
or 'http://www.google.com/sorry/index' in line or 'https://www.google.com/sorry/index' in line:
|
||||
|
@ -100,7 +104,9 @@ async def google_workaround(visit_url: str) -> Union[bool, str]:
|
|||
|
||||
|
||||
class MissingKey(Exception):
|
||||
|
||||
"""
|
||||
:raise: When there is a module that has not been provided its API key
|
||||
"""
|
||||
def __init__(self, identity_flag: bool):
|
||||
if identity_flag:
|
||||
self.message = '\n\033[93m[!] Missing API key. \033[0m'
|
||||
|
|
|
@ -117,9 +117,9 @@ async def process(self, proxy=False):
|
|||
self.total_results += fragment
|
||||
self.counter = self.counter + 1
|
||||
self.page = await self.next_page_or_end(result)
|
||||
await asyncio.sleep(getDelay())
|
||||
await asyncio.sleep(get_delay())
|
||||
elif isinstance(result, RetryResult):
|
||||
sleepy_time = getDelay() + result.time
|
||||
sleepy_time = get_delay() + result.time
|
||||
print(f'\tRetrying page in {sleepy_time} seconds...')
|
||||
await asyncio.sleep(sleepy_time)
|
||||
elif isinstance(result, ErrorResult):
|
||||
|
|
|
@ -39,7 +39,7 @@ async def do_search(self):
|
|||
print(e)
|
||||
# google blocked, no useful result
|
||||
return
|
||||
await asyncio.sleep(getDelay())
|
||||
await asyncio.sleep(get_delay())
|
||||
self.totalresults += self.results
|
||||
|
||||
async def do_search_profiles(self):
|
||||
|
@ -60,7 +60,7 @@ async def do_search_profiles(self):
|
|||
except Exception:
|
||||
# google blocked, no useful result
|
||||
return
|
||||
await asyncio.sleep(getDelay())
|
||||
await asyncio.sleep(get_delay())
|
||||
self.totalresults += self.results
|
||||
|
||||
async def get_emails(self):
|
||||
|
@ -95,7 +95,7 @@ async def process(self, google_dorking, proxy=False):
|
|||
async def process_profiles(self):
|
||||
while self.counter < self.limit:
|
||||
await self.do_search_profiles()
|
||||
await asyncio.sleep(getDelay())
|
||||
await asyncio.sleep(get_delay())
|
||||
self.counter += 100
|
||||
print(f'\tSearching {self.counter} results.')
|
||||
|
||||
|
@ -158,7 +158,7 @@ async def send_dorks(self): # Helper function to minimize code reusability.
|
|||
except Exception:
|
||||
# google blocked, no useful result
|
||||
return
|
||||
await asyncio.sleep(getDelay())
|
||||
await asyncio.sleep(get_delay())
|
||||
self.totalresults += self.results
|
||||
except Exception as e:
|
||||
print(f'\tException Occurred {e}')
|
||||
|
|
|
@ -33,7 +33,7 @@ async def do_search(self):
|
|||
return
|
||||
except Exception as e:
|
||||
print(e)
|
||||
await asyncio.sleep(getDelay())
|
||||
await asyncio.sleep(get_delay())
|
||||
self.totalresults += self.results
|
||||
|
||||
async def get_people(self):
|
||||
|
@ -50,6 +50,6 @@ async def process(self, proxy=False):
|
|||
self.proxy = proxy
|
||||
while self.counter < self.limit:
|
||||
await self.do_search()
|
||||
await asyncio.sleep(getDelay())
|
||||
await asyncio.sleep(get_delay())
|
||||
self.counter += 100
|
||||
print(f'\tSearching {self.counter} results.')
|
||||
|
|
|
@ -36,7 +36,7 @@ async def do_search(self):
|
|||
except Exception as e:
|
||||
print(e)
|
||||
self.totalresults += self.results
|
||||
await asyncio.sleep(getDelay() - .5)
|
||||
await asyncio.sleep(get_delay() - .5)
|
||||
except Exception as e:
|
||||
print(f'An exception has occurred in trello: {e}')
|
||||
|
||||
|
|
Loading…
Reference in a new issue