From 80c537906617c1bf93eb4af0a34ad4fb54b4411e Mon Sep 17 00:00:00 2001 From: Christopher Truncer Date: Wed, 13 Jul 2022 13:59:23 -0600 Subject: [PATCH] Added wrapper around user agent within selenium module, thanks to #575 --- Python/modules/selenium_module.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Python/modules/selenium_module.py b/Python/modules/selenium_module.py index 1839310f..3819b123 100644 --- a/Python/modules/selenium_module.py +++ b/Python/modules/selenium_module.py @@ -195,10 +195,13 @@ def capture_host(cli_parsed, http_object, driver, ua=None): context = None pass - try: - tempua = driver.execute_script("return navigator.userAgent") - except: - tempua = '' + if cli_parsed.user_agent: + tempua = cli_parsed.user_agent + else: + try: + tempua = driver.execute_script("return navigator.userAgent") + except: + tempua = '' try: req = urllib.request.Request(http_object.remote_system, headers={'User-Agent': tempua}) if cli_parsed.proxy_ip is not None: