-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpnbook.sh
48 lines (33 loc) · 1006 Bytes
/
vpnbook.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
#!/usr/bin/env bash
echo "Available OpenVPN Servers:"
ls -1 vpnbook-*53.ovpn | grep -P -o -e '(?<=vpnbook-)(.*?)(?=-ud)'
read -p "Choose server: " serv
printf '%s\n' "Available Protocols for Server: ${serv}"
ls -1 vpnbook-${serv}*.ovpn | grep -P -o -e '(?<=vpnbook-...-)(.*?)(?=.ovpn)'
read -p "Choose Protocol: " proto
server="vpnbook-${serv}-${proto}.ovpn"
echo $server
if test -f "$server"; then
echo "File $server exist"
else
echo "File $server does not exist. Exiting....."
exit 1
fi
url='https://mobile.twitter.com/vpnbook'
html=$( curl -# -L "${url}" 2> '/dev/null' )
username=$(
<<< "${html}" \
grep -P -o -e '(?<=Username: )(.*?)(?=Password)' |
head -n 1
)
password=$(
<<< "${html}" \
grep -P -o -e '(?<=Password: )(.{7})' |
head -n 1
)
echo "Auth data fetch from twitter"
printf '%s\n' "Username: ${username}" "Password: ${password}"
echo ${username} > auth.cfg
echo ${password} >> auth.cfg
openvpn --config ${server} --auth-user-pass auth.cfg
#rm auth.cfg