Compare commits
2 Commits
1c22b7df2b
...
3f78de7239
| Author | SHA1 | Date | |
|---|---|---|---|
|
3f78de7239
|
|||
|
cb90ff38cd
|
8
main.py
8
main.py
@@ -48,7 +48,7 @@ errorLogger = Logger("ERROR", [ANSI.BOLD, ANSI.RED])
|
|||||||
vpnLogger = Logger("", [ANSI.ITALIC, ANSI.BLACK+60])
|
vpnLogger = Logger("", [ANSI.ITALIC, ANSI.BLACK+60])
|
||||||
|
|
||||||
def getPublicIp():
|
def getPublicIp():
|
||||||
return requests.head("https://wikipedia.org").headers["X-Client-IP"]
|
return requests.head("https://wikipedia.org", headers={"User-Agent": "HEI-VPN 1.0"}).headers["X-Client-IP"]
|
||||||
|
|
||||||
if getPublicIp() == "153.109.1.93":
|
if getPublicIp() == "153.109.1.93":
|
||||||
warningLogger.log("You are already in the HEI network. You cannot use the VPN")
|
warningLogger.log("You are already in the HEI network. You cannot use the VPN")
|
||||||
@@ -164,7 +164,7 @@ def closeBrowser(driver: Firefox, distinguishkey: str) -> None:
|
|||||||
try:
|
try:
|
||||||
driver.quit()
|
driver.quit()
|
||||||
except:
|
except:
|
||||||
pass # error expected because we killed the processe
|
pass # error expected because we killed the process
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
if os.path.isdir(realProfilePath):
|
if os.path.isdir(realProfilePath):
|
||||||
@@ -206,7 +206,7 @@ driver.get(url)
|
|||||||
wait = WebDriverWait(driver, timeout)
|
wait = WebDriverWait(driver, timeout)
|
||||||
wait.until(AnyEc(
|
wait.until(AnyEc(
|
||||||
EC.url_contains("microsoft"),
|
EC.url_contains("microsoft"),
|
||||||
EC.presence_of_element_located((By.CSS_SELECTOR, 'img[alt="app logo"]'))
|
EC.presence_of_element_located((By.CSS_SELECTOR, 'img[alt~="logo" i]'))
|
||||||
))
|
))
|
||||||
|
|
||||||
if "microsoft" in driver.current_url:
|
if "microsoft" in driver.current_url:
|
||||||
@@ -217,7 +217,7 @@ if "microsoft" in driver.current_url:
|
|||||||
driver.get(url)
|
driver.get(url)
|
||||||
wait = WebDriverWait(driver, timeout)
|
wait = WebDriverWait(driver, timeout)
|
||||||
|
|
||||||
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'img[alt="app logo"]')))
|
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'img[alt~="logo" i]')))
|
||||||
|
|
||||||
driver.implicitly_wait(0)
|
driver.implicitly_wait(0)
|
||||||
continueBtn = driver.find_elements(By.ID, "btnContinue")
|
continueBtn = driver.find_elements(By.ID, "btnContinue")
|
||||||
|
|||||||
Reference in New Issue
Block a user