-
Notifications
You must be signed in to change notification settings - Fork 1
/
startFirefoxSeleniumProxy.py
executable file
·51 lines (43 loc) · 1.5 KB
/
startFirefoxSeleniumProxy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.common.proxy import Proxy, ProxyType
from webdriver_manager.firefox import GeckoDriverManager
import traceback
# Documented in the Selenium documentation
# https://www.selenium.dev/documentation/webdriver/drivers/options/#proxy
PROXY="127.0.0.1:8080"
caps = webdriver.DesiredCapabilities.FIREFOX
caps['proxy'] = {
'proxyType': "manual",
'httpProxy': PROXY,
'sslProxy': PROXY,
}
try:
GeckoDriverManager().install()
except Exception as e:
traceback.print_exc()
print("[-] Error updating geckodriver. Consider manual installation.")
print (e)
driver = webdriver.Firefox()
def interact(driver):
try:
import os
import code
vars = globals()
vars.update(locals())
if os.name != 'nt':
import readline
import rlcompleter
readline.set_completer(rlcompleter.Completer(vars).complete)
readline.parse_and_bind("tab: complete")
shell = code.InteractiveConsole(vars)
shell.interact()
except:
traceback.print_exc()
print("[-] Error with python repl!")
finally:
print("[+] Done with python repl")
driver.quit()
print("[.] Any final debugging?")
interact(driver)