|
@@ -10,8 +10,8 @@ profiles = []
|
|
|
choice = -1
|
|
|
listurl = "http://www.vpngate.net/api/iphone/"
|
|
|
ovpnpath = "/tmp/profile.ovpn"
|
|
|
-fmtstrhead = "{:^4} | {:^4} | {:^30} | {:^10} | {:^4}"
|
|
|
-fmtstr = "[{:>2}] | {} | {:<30} | {:^10} | {:>4}"
|
|
|
+fmtstrhead = "{:^4} | {:^4} | {:^4} | {:^30} | {:^10}"
|
|
|
+fmtstr = "[{:>2}] | {} | {:>4} | {:<30} | {:^10}"
|
|
|
|
|
|
response = urllib.request.urlopen(listurl).read().decode('utf-8').split('\n')
|
|
|
reader = csv.reader(response, delimiter=',')
|
|
@@ -20,16 +20,21 @@ reader = csv.reader(response, delimiter=',')
|
|
|
reader.__next__()
|
|
|
reader.__next__()
|
|
|
|
|
|
-print(fmtstrhead.format( "INDX", "LCTN", "Server ID", "Score", "Ping" ))
|
|
|
+print(fmtstrhead.format( "INDX", "LCTN", "Ping", "Server ID", "Score" ))
|
|
|
for i in range(serversnum):
|
|
|
current = reader.__next__()
|
|
|
- print(fmtstr.format( i, current[6], current[0], current[2], current[3] ))
|
|
|
+ print(fmtstr.format( i, current[6], current[3], current[0], current[2] ))
|
|
|
profiles.append(current[14])
|
|
|
|
|
|
while choice < 0 or choice > serversnum:
|
|
|
choice = int(input("Choose a profile: "))
|
|
|
|
|
|
+scriptdir = os.path.expanduser("~/.config/openvpn")
|
|
|
with open(ovpnpath, 'w') as f:
|
|
|
f.write(base64.b64decode(profiles[choice]).decode('ascii'))
|
|
|
+ f.write( "script-security 2\n" )
|
|
|
+ f.write( "up \"" + scriptdir + "/up.sh\"\n" )
|
|
|
+ f.write( "down \"" + scriptdir + "/down.sh\"\n" )
|
|
|
|
|
|
-os.system("sudo openvpn /tmp/profile.opvn")
|
|
|
+# os.system( "sudo openvpn " + runopts + "--config" + ovpnpath )
|
|
|
+os.system( "sudo openvpn " + ovpnpath )
|