-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdl_vpngate
More file actions
executable file
·40 lines (35 loc) · 1.22 KB
/
Copy pathdl_vpngate
File metadata and controls
executable file
·40 lines (35 loc) · 1.22 KB
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
#!/usr/bin/env python3
import base64
import os
import subprocess
import sys
import requests
dest_folder = os.environ['HOME'] + "/Downloads"
try:
conf_quantity = int(sys.argv[1])+1
except Exception:
print("No number given; defaulting to 5 configs")
print("Usage: " + sys.argv[0] + " <integer>")
conf_quantity = 6
url = "https://www.vpngate.net/api/iphone/"
get = requests.get(url)
try:
for count in range(1, conf_quantity):
ip = get.text.split('\n')[count+1].split(',')[1]
confdata = get.text.split('\n')[count+1].split(',')[6]
decode = base64.b64decode(get.text.split(',,')[count].split('\n')[0])
outputfile = confdata+"_"+ip+'.ovpn'
file_path = os.path.join(dest_folder, outputfile)
try:
with open(file_path, "wb") as f:
f.write(decode)
except Exception:
print("Could not write files.")
quit()
except IndexError:
print("Something went wrong.")
quit()
cmd = ["yad --info --height 100 --width 350 --title='Download from VPN Gate' \
--text='Task complete.\nFind OpenVPN configs in \n~/Downloads.' &"]
subprocess.call(cmd, shell=True)
print("Task complete. Find your OpenVPN configs in " + dest_folder + ".")