edited the get_urls function to obfuscate user-agent changes

This commit is contained in:
ekultek 2017-09-08 10:12:24 -05:00
parent b22180a82d
commit 92baed3a9f
2 changed files with 15 additions and 4 deletions

View file

@ -17,7 +17,7 @@ import bin.unzip_gecko
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.0.1"
VERSION = "1.0.2.e25"
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting

View file

@ -19,7 +19,7 @@ from lib.settings import (
)
def get_urls(query, url, verbose=False, warning=True, **kwargs):
def get_urls(query, url, verbose=False, warning=True, user_agent=None, proxy=None, **kwargs):
"""
Bypass Google captchas and Google API by using selenium-webdriver to gather
the Google URL. This will open a robot controlled browser window and attempt
@ -51,7 +51,18 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs):
logger.debug(set_color(
"running selenium-webdriver and launching browser..", level=10
))
browser = webdriver.Firefox()
if user_agent is not None:
if verbose:
logger.debug(set_color(
"adjusting user-agent to '{}'...".format(user_agent)
))
profile = webdriver.FirefoxProfile()
profile.set_preference("general.useragent.override", user_agent)
browser = webdriver.Firefox(profile)
else:
browser = webdriver.Firefox()
logger.info(set_color("browser will open shortly.."))
browser.get(url)
if verbose:
@ -138,7 +149,7 @@ def parse_search_results(
"attempting to gather query URL..."
))
try:
query_url = get_urls(query, url, verbose=verbose)
query_url = get_urls(query, url, verbose=verbose, user_agent=user_agent)
except Exception as e:
if "WebDriverException" in str(e):
logger.exception(set_color(