forked from g3th/Ipvanish-Checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
91 lines (90 loc) · 4.2 KB
/
main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import time
import platform
from pathlib import Path
from subprocess import run
from subprocess import PIPE
from gui import sub_menu
from gui import text_user_interface
from browser_init import BrowserInit, get_and_split_list
from download_chromedriver import DownloadChromedriver
from requests_checker import RequestsChecker
if __name__ == '__main__':
if platform.system() != "Linux":
print("Please run this program in a Linux distribution.")
print("Other Operating Systems are not supported.")
print("Ending")
exit()
else:
chromedriver_is_installed = False
directory = "/home/roberto/Desktop/cookie.json"
page = "https://sso.ipvanish.com/"
chromedriver_directory = str(Path(__file__).parent) + '/chromedriver/chromedriver'
command_as_list = ['google-chrome-stable', '--version']
try:
open(chromedriver_directory, 'r')
chromedriver_is_installed = True
except FileNotFoundError:
pass
is_using_proxies = 0
proxy_user, proxy_password = None, None
loop_ends = False
counter = 0
while not loop_ends:
command = run(command_as_list, shell=False, stdout=PIPE)
chrome_version = str(command.stdout).split(" ")[2]
TUI = text_user_interface(is_using_proxies, chrome_version, chromedriver_is_installed)
if not chromedriver_is_installed:
download_chromeDriver = DownloadChromedriver(chrome_version)
download_chromeDriver.start()
download_chromeDriver.file_operations()
chromedriver_is_installed = True
else:
try:
match TUI:
case "1":
user, password = get_and_split_list()
while counter < len(user):
browser = BrowserInit(page)
browser.open_page_and_enter_credentials(user[counter], password[counter])
time.sleep(3)
browser.check_validity_and_store_if_valid(user[counter], password[counter])
browser.close()
counter += 1
if counter == len(user):
print("\n\nFinished Checking. Press Enter to Continue")
input()
case "2":
index = 0
while True:
fast_checker = RequestsChecker()
user, password = fast_checker.split_list()
if counter == len(user):
loop_ends = True
break
fast_checker.make_request(user[counter], password[counter], index)
counter += 1
if index == 22:
index = 0
else:
index += 1
case "3":
proxy_user, proxy_password = sub_menu()
is_using_proxies = 1
case "4":
print("\nThanks for playing.")
exit()
case _:
print("Invalid Choice.")
input("Press Enter...")
print("\x1bc")
except Exception as e:
if "Unable to obtain driver for chrome" in str(e):
print("There is a problem with your chromedriver installation:")
print("Please check all program folders are intact")
print("\nEnding")
exit()
else:
print("Encountered an unexpected error.\nYou can create an issue and include the following error:")
print(e)
print("\nEnding.")
exit()