├── README.md └── windscribe_port.py /README.md: -------------------------------------------------------------------------------- 1 | # Windscribe-Ephemeral-Port-Script 2 | 3 | #### Original Credit: https://github.com/Mibo5354, https://gist.github.com/Mibo5354/cf265bc2108edb839e3607d9c9359dfa 4 | 5 | This script has been modified from Mibo5454's original to refresh the Windscribe Ephermeral port and set qBittorrents 6 | listening port automatically. 7 | 8 | ## Disclaimer 9 | 10 | Reports of using the script often can lead to account being temporarily disabled. Reduce usage to the minimum required timeframe 11 | 12 | ## Requirements 13 | 14 | * Python (Tested on 3.10.7) 15 | * selenium Package (Tested on 4.5.0) 16 | * qbittorrent-api Package (Tested on 2022.8.38) 17 | 18 | ## Setup 19 | 20 | Windscribe and qBittorrnet credentials are required in the following sections, as outlined in the script 21 | 22 | Replace username and password with Windscribe credentials in the lines below 23 | * user.send_keys('username') - Line 30 24 | * passw.send_keys('password') - Line 35 25 | 26 | 27 | Replace https://qbittorrent.example.com with qbittorrents URL (either reverse proxy or localhost url) 28 | 29 | Replace 'username' and 'password' with qbittorrents WEBUI credentials 30 | * client = qbittorrentapi.Client(host='https://qbittorrent.example.com', port=443, username='username', password='password') - Line 71 31 | -------------------------------------------------------------------------------- /windscribe_port.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | import selenium 3 | from selenium.webdriver.chrome.options import Options 4 | chrome_options = Options() 5 | 6 | # For using sleep function because selenium 7 | # works only when the all the elements of the 8 | # page is loaded. 9 | import time 10 | 11 | import qbittorrentapi 12 | 13 | #Required for running chromedriver headless 14 | chrome_options.add_argument("--disable-gpu") 15 | #chrome_options.add_argument("--no-sandbox") # linux only 16 | chrome_options.add_argument("--headless") #Disable to view chrome 17 | 18 | from selenium.webdriver.common.keys import Keys 19 | 20 | # Creating an instance webdriver 21 | browser = webdriver.Chrome(options=chrome_options) 22 | browser.get('https://www.windscribe.com/login') 23 | time.sleep(2) 24 | 25 | print("Login to Windscribe") 26 | 27 | user = browser.find_element("xpath", '//*[@id="username"]') 28 | 29 | # Enter User Name 30 | user.send_keys('username') 31 | 32 | passw = browser.find_element("xpath", '//*[@id="pass"]') 33 | 34 | # Enter and Submit Password 35 | passw.send_keys('password') 36 | passw.submit() 37 | 38 | print("Login Successful") 39 | 40 | time.sleep(5) 41 | browser.get('https://windscribe.com') 42 | time.sleep(5) 43 | browser.get('https://windscribe.com/myaccount#porteph') 44 | print("Load Request Ephemeral Port Page") 45 | time.sleep(5) 46 | 47 | print("") 48 | delPort = browser.find_element("xpath", '//*[@id="request-port-cont"]/button') 49 | delPort.click() 50 | print("Delete Port") 51 | time.sleep(5) 52 | 53 | reqMatchPort = browser.find_element("xpath", '//*[@id="request-port-cont"]/button[2]') 54 | reqMatchPort.click() 55 | print("Request New Port") 56 | time.sleep(5) 57 | 58 | port = browser.find_element("xpath", '//*[@id="epf-port-info"]/span[1]') 59 | 60 | 61 | print("New Port: " + port.text) 62 | aquiredPort = port.text 63 | # print("Saving to port.txt") 64 | # with open("port.txt", "w") as text_file: 65 | # print(aquiredPort, file=text_file) 66 | 67 | # closing the browser 68 | browser.close() 69 | 70 | # instantiate a Client using the appropriate WebUI configuration 71 | client = qbittorrentapi.Client(host='https://qbittorrent.example.com', port=443, username='username', password='password') 72 | # the Client will automatically acquire/maintain a logged in state in line with any request. 73 | # therefore, this is not necessary; however, you many want to test the provided login credentials. 74 | try: 75 | client.auth_log_in() 76 | except qbittorrentapi.LoginFailed as e: 77 | print(e) 78 | 79 | # display qBittorrent info 80 | # print(f'qBittorrent: {client.app.version}') 81 | # print(f'qBittorrent Web API: {client.app.web_api_version}') 82 | 83 | #Set qBittorrent listening port 84 | prefs = client.application.preferences 85 | prefs['listen_port'] = aquiredPort 86 | client.app.preferences = prefs 87 | print("Set qBittorrent listening port to " + aquiredPort) 88 | --------------------------------------------------------------------------------