forked from abdoxfox/HTTP-CUSTOM-HEADERS-VPN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runvpn.sh
83 lines (62 loc) · 1.46 KB
/
runvpn.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
#!/bin/bash
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
SCOLOR='\033[0m'
echo -e "${GREEN}Choose Connection Method:"
echo "0 - SSH Direct "
echo "1 - PAYLOAD "
echo "2 - SSL "
echo -e "3 - SSL+PAYLOAD "
read -p "Enter choice number : " mode
find=`cat settings.ini | grep "connection_mode = " |awk '{print $3}'`
sed -i "s/connection_mode = $find/connection_mode = $mode/g" settings.ini
sleep 1
killprocess() {
echo -e "${RED} vpn service stopped"
python pidkill.py >> /dev/null &
rm logs.txt
echo -e " ${SCOLOR}"
}
function connect() {
screen -AmdS nohub python3 tunnel.py
sleep 1
if [ "$mode" = '0' ] || [ "$mode" = '1' ]
then
screen -AmdS nohub python3 ssh.py 1
elif [ "$mode" = '2' ] || [ "$mode" = '3' ]
then
screen -AmdS nohub python3 ssh.py 2
else
echo -e "${RED}wrong choice\ntry again${SCOLOR}"
python3 pidkill.py
exit
fi
echo -e "${YELLOW}---logs----${SCOLOR}"
sleep 5
cat logs.txt
var=`cat logs.txt | grep "CONNECTED SUCCESSFULLY"|awk '{print $4}'`
if [ "$var" = "SUCCESSFULLY" ];then
echo -e "${GREEN}---Tunneling starts-----"
chmod +x proxification
./proxification > /dev/null
echo -e "${SCOLOR}"
iptables --flush
else
echo -e "${RED}failed! ${SCOLOR}"
fi
}
connect
for i in {1..3}
do
killprocess
echo -e "${GREEN}"
read -p "reconnect ? [y\n] " reconnect
if [ "$reconnect" = 'y' ] || [ "$reconnect" = 'Y' ]
then
echo -e "reconnecting ${SCOLOR}"
connect
else
exit
fi
done