Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential fix for google_search() #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions WWWE.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ def urlencode(cmd):
print('{}[x] Error:{} "{}"'.format(RD, RA, error))


# Potential fix for google_search(), there may be a few ways to check for no results.
# %22 is URL code for ", which when applied to google search explicitly searches for the entire input string
# e.g. "[email protected]" rather than [email protected]
def google_search(email):
endpoint = 'https://google.com/search?q={}'.format(email)
endpoint = 'https://google.com/search?q=%22{}%22'.format(email)
try:
with webdriver.Firefox(capabilities=cap) as d:
d.get(endpoint)
p_texts = filter(lambda _: len(_.text)!=0, d.find_elements_by_tag_name('p'))
return False if email in '\n'.join([_.text for _ in p_texts]) else True
if "No results found" or "did not match any documents" in d.page_source:
return False
else:
return True
except Exception as error:
raise(error)

Expand Down Expand Up @@ -262,7 +267,7 @@ def check(email, hibp_key):

if __name__ == '__main__':
args = console()
config = ConfigParser.RawConfigParser(allow_no_value=True)
config = configparser.RawConfigParser(allow_no_value=True)
config.readfp(open('config.cfg'))
hibp_key = config.has_option('HIBP-key','key') and config.get('HIBP-key','key') or None

Expand Down