forked from abdoxfox/HTTP-CUSTOM-HEADERS-VPN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runvpn.sh
95 lines (77 loc) · 1.49 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
SCOLOR='\033[0m'
cat << EOF > rSetup.sh
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
SCOLOR='\033[0m'
if command -v redsocks >/dev/null
then
echo "${GREEN}Redsocks installed ${SCOLOR}"
else
echo -e "${GREEN} COMPILLING REDSOCKS BINARY & Dns2socks ...${SCOLOR}"
sleep 1
unzip libs/redsocks
cd redsocks
make
mv redsocks ../redsocks
cp redsocks "$PREFIX"/bin
cd ..
fi
if ! command -v dns2socks >/dev/null
then
unzip libs/dns2socks.zip
cd dns2socks
make
cp dns2socks "$PREFIX"/bin
sleep 3
fi
cd ..
rm -rf redsocks/
rm -rf dns2socks/
EOF
bash rSetup.sh
rm rSetup.sh
clear
mode=$(cat cfgs/settings.ini |grep "connection_mode"| awk '{print $3}')
killprocess() {
echo -e "${RED}[+] KILLING PROCESS...."
pkill ssh
pkill redsocks
pkill dns2socks
echo -e "[+] DONE ${SCOLOR}"
}
function serverlistening() {
localport="$1"
python3 main.py $localport &
echo ""
}
function connect() {
localport="$1"
if [ $mode = 0 ]
then
python3 src/ssh.py 0
else
python3 src/ssh.py $localport
fi
}
OnExit() {
lport=$1
pid=$(sudo netstat -anp|grep "$lport" | awk '{print$7}' | grep "python3"|sed -e 's/\/python3//g'|tail -1)
kill $pid
echo -e "${RED}Disconnected ${SCOLOR}"
}
for i in {9008..9999}
do
echo -e "$GREEN ++++ LOGS ++++$SCOLOR"
rm -rf logs.txt
serverlistening $i
sleep 1
connect $i
killprocess $i
signal=$(($i+1))
trap "OnExit $signal" EXIT
done