4
4
import sys
5
5
import requests
6
6
import npyscreen
7
+ import configparser
8
+ from rich import print
7
9
from subprocess import Popen , PIPE
8
10
9
11
# Checking permissions
10
12
if int (os .getuid ()) != 0 :
11
- print ("[!] You need root permissions to use this tool." )
13
+ print ("[bold white on red]You need root permissions to use this tool!!" )
14
+ sys .exit (1 )
15
+
16
+ # Checking CyberGhostVPN existence
17
+ if os .path .exists ("/usr/bin/cyberghostvpn" ) is False :
18
+ print ("[bold white on red]CyberGhostVPN seems not installed on this system!!" )
12
19
sys .exit (1 )
13
20
14
21
# Available countries
15
22
vpn_country = {
23
+ "Australia" : "AU" , "Armenia" : "AM" , "Argentina" : "AR" ,
16
24
"Belgium" : "BE" , "Bulgaria" : "BG" , "Brazil" : "BR" ,
17
25
"Canada" : "CA" , "Switzerland" : "CH" , "Chile" : "CL" ,
18
26
"China" : "CN" , "Colombia" : "CO" , "Czechia" : "CZ" ,
19
- "Germany" : "DE" , "Denmark" : "DK" , "Estonia" : "EE"
27
+ "Germany" : "DE" , "Denmark" : "DK" , "Estonia" : "EE" ,
28
+ "Kazakhstan" : "KZ" , "Pakistan" : "PK" , "Qatar" : "QA" ,
29
+ "Ukraine" : "UA" , "United States" : "US"
20
30
}
21
31
22
32
# Class for main form that handles connections and country selections
@@ -41,6 +51,10 @@ def create(self):
41
51
npyscreen .ButtonPress , name = "Stop Connection" ,
42
52
when_pressed_function = self .StopConnect , relx = 20
43
53
)
54
+ self .add (
55
+ npyscreen .ButtonPress , name = "Auth Information" ,
56
+ when_pressed_function = self .AuthInfo , relx = 20
57
+ )
44
58
self .add (
45
59
npyscreen .ButtonPress , name = "Get IP Info" ,
46
60
when_pressed_function = self .GetIPInfo , relx = 20
@@ -102,6 +116,15 @@ def StopConnect(self):
102
116
pass
103
117
except :
104
118
pass
119
+ def AuthInfo (self ):
120
+ auth_conf = configparser .ConfigParser ()
121
+ username = os .getenv ("SUDO_USER" )
122
+ auth_conf .read (f"/home/{ username } /.cyberghost/config.ini" )
123
+ npyscreen .notify_confirm (
124
+ f"User: { auth_conf ['account' ]['username' ]} " ,
125
+ "INFO"
126
+ )
127
+
105
128
def GetIPInfo (self ):
106
129
try :
107
130
npyscreen .notify_wait (
@@ -124,7 +147,7 @@ def onStart(self):
124
147
125
148
# Our main application
126
149
self .addForm (
127
- "MAIN" , MainForm , name = "CyberGhostVPN TUI v0.1 " , lines = 30 , columns = 90
150
+ "MAIN" , MainForm , name = "CyberGhostVPN TUI v0.2 " , lines = 30 , columns = 90
128
151
)
129
152
130
153
# Execution area
0 commit comments