-
Notifications
You must be signed in to change notification settings - Fork 0
/
openvpn-connector.sh
171 lines (131 loc) · 7.04 KB
/
openvpn-connector.sh
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/usr/bin/env bash
# Openvpn Connector Script written by VGrol
# Configured with ProtonVPN in mind.
# This is about as much as of a hack-job as it can get.
# Since wiregaurd should be the next logical upgrade, I do not care for improving it.
# If the tools lack for WireGuard, I'll write something more dynamic when the time comes.
# This is the initial prompt, countries represent their top-level domains.
# Any change here is purely cosmetic, actual input is decided below.
printf "
ProtonVPN Connector started,
Welcome.
"
# This bit checks for arguments, so that input can be provided on the same line that calls the script.
# If any arguments are provided it'll route to that, else it'll prompt for input.
if [ $@ ]
then
input=$@
else
printf "
Viable servers
CA, CH, CZ, DE, DK, ES, FR, HK, IT, IS, NL, JP, US, SE, SG.
Viable Secure-core servers
IS-DE, IS-US, SE-FR.
Viable P2P and TOR servers
SE-P2P, NL-P2P, CH-TOR.
To Disconnect and Exit
please enter DC.
"
read -p "
Please enter the desired VPN Server:
" input
fi
# The main loop, initial two digits, like ca) decides the input and tries to run openvpn with the config file in the default location. This script assumes the basic Protonvpn configuration files are present in /etc/openvpn/client.
# Changing the line after --config will allow for alternate profiles
# Copying a segment, from XX) to ;break will allow for a larger selection of items.
# The brackets surrounding two letters incidate that both the are considered valid. The current implementation results in case-insensitive input.
# Remember to add the corresponding XX) to the printf statement up above!
while true
do
case $input in
[cC][aA]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/ca.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Canada selected, Connecting now."
break;;
[cC][hH]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/ch.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Switzerland selected, Connecting now."
break;;
[cC][hH]-[tT][oO][rR]tor) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/ch-09-tor.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Swiss TOR Server selected, Connecting now."
break;;
[cC][zZ]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/cz.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Czech Republic selected, Connecting now."
break;;
[dD][eE]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/de.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Germany selected, Connecting now."
break;;
[dD][kK]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/dk.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Denmark selected, Connecting now."
break;;
[eE][sS]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/es.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Spain selected, Connecting now."
break;;
[fF][rR]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/fr.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "France selected, Connecting now."
break;;
[hH][kK]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/hk.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Hong Kong selected, Connecting now."
break;;
[iI][tT]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/it.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Italy selected, Connecting now."
break;;
[iI][sS]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/is.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Iceland selected, Connecting now."
break;;
[iI][sS]-[dD][eE]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/is-de-01.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Secure-Core Iceland-Germany selected, Connecting now."
break;;
[iI][sS]-[uU][sS]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/is-us-01.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Secure-Core Iceland-United States selected, Connecting now."
break;;
[nN][lL]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/nl.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Netherlands selected, Connecting now."
break;;
[nN][lL]-[pP]2[pP]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/nl-12.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Dutch P2P server selected, Connecting now."
break;;
[jJ][pP]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/jp.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Japan selected, Connecting now."
break;;
[uU][sS]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/us.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "United States selected, Connecting now."
break;;
[sS][eE]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/se.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Sweden selected, Connecting now."
break;;
[sS][eE]-[pP]2[pP]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/se-03.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Swedish P2P Server selected, Connecting now."
break;;
[sS][eE]-[fF][rR]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/se-fr-01.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Secure Core Sweden-France selected, Connecting now."
break;;
[sS][gG]) killall -SIGINT openvpn &
openvpn --config /etc/openvpn/client/sg.protonvpn.com.udp1194.conf --mute-replay-warnings &
printf "Singapore selected, Connecting now."
break;;
[dD][cC]) killall -SIGINT openvpn &
printf "Disconnection selected, Disabling VPN."
break;;
* ) printf "Invalid input, Closing ProtonVPN Connector."
break;;
esac
done