Skip to content

Commit

Permalink
refactor: only open firefox webdriver when useful
Browse files Browse the repository at this point in the history
  • Loading branch information
sundowndev committed Jun 10, 2019
1 parent 6a6f0db commit 92139ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/googlesearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@

from selenium import webdriver

browser = webdriver.Firefox()
browser = None

def search(req, stop):
global browser

if google_api_key and google_cx_id:
return searchApi(req, stop)

if browser is None:
browser = webdriver.Firefox()

try:
REQ = urlencode({ 'q': req, 'num': stop, 'hl': 'en' })
URL = 'https://www.google.com/search?tbs=li:1&{}&gws_rd=ssl&gl=us'.format(
Expand Down
3 changes: 3 additions & 0 deletions phoneinfoga.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from lib.output import *
from lib.format import *
from lib.logger import Logger
from lib.googlesearch import browser
# scanners
from scanners import numverify
from scanners import localscan
Expand Down Expand Up @@ -81,6 +82,8 @@ def main():

def signal_handler(signal, frame):
print('\n[-] You pressed Ctrl+C! Exiting.')
if browser is not None:
browser.quit()
sys.exit()


Expand Down
3 changes: 2 additions & 1 deletion scanners/footprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,6 @@ def osintScan(numberObject, rerun=False):
if retry_input.lower() == 'y' or retry_input.lower() == 'yes':
osintScan(numberObj, True)
else:
browser.quit()
if browser is not None:
browser.quit()
return -1

0 comments on commit 92139ec

Please sign in to comment.