This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
123 lines (107 loc) · 3.02 KB
/
install.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
#!/bin/bash -e
if [ "$EUID" -ne 0 ]
then echo "Please run as root."
exit
fi
if pgrep -x "RTT" > /dev/null; then
echo "Tunnel is running!. you must stop the tunnel before update. (pkill RTT)"
echo "Kiling RTT..."
sleep 5
pkill RTT
echo "Done"
fi
DISTRO="$(awk -F= '/^NAME/{print tolower($2)}' /etc/os-release|awk 'gsub(/[" ]/,x) + 1')"
DISTROVER="$(awk -F= '/^VERSION_ID/{print tolower($2)}' /etc/os-release|awk 'gsub(/[" ]/,x) + 1')"
update_os() {
apt-get -o Acquire::ForceIPv4=true update
apt-get -o Acquire::ForceIPv4=true install -y software-properties-common
add-apt-repository --yes universe
add-apt-repository --yes restricted
add-apt-repository --yes multiverse
apt-get -o Acquire::ForceIPv4=true install -y moreutils dnsutils tmux screen nano wget curl socat jq qrencode unzip lsof
}
CHS=3
IRIP=$(dig -4 +short myip.opendns.com @resolver1.opendns.com)
EXIP=0.0.0.0
IRPORT=23-65535
IRPORTTT=443
TOIP=127.0.0.1
TOPORT=multiport
iranserver() {
cat >/etc/systemd/system/tunnel.service <<-EOF
[Unit]
Description=Reverse TLS Tunnel
[Service]
Type=idle
User=root
WorkingDirectory=/root
ExecStart=/root/RTT --iran --lport:$IRPORT --sni:$SNI --password:$TOPASS
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl --now enable tunnel.service
systemctl start tunnel.service
}
externalserver() {
cat >/etc/systemd/system/tunnel.service <<-EOF
[Unit]
Description=Reverse TLS Tunnel
[Service]
Type=idle
User=root
WorkingDirectory=/root
ExecStart=/root/RTT --kharej --iran-ip:$EXIP --iran-port:$IRPORTTT --toip:$TOIP --toport:$TOPORT --password:$TOPASS --sni:$SNI --terminate:$TERM
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl --now enable tunnel.service
systemctl start tunnel.service
}
echo "Select Server Location:"
echo "1.Iran(Internal)"
echo "2.kharej(External)"
echo "3.Exit"
read -r -p "Select Number(Default is: 3):" CHS
case $CHS in
1) echo "Be carefull SSH port must under 23"
echo "Multiport is activated all ports above 22 were forwarded"
read -r -p "RTT PASS(Default is: Armani@bash): " TOPASS
TOPASS=${TOPASS:-"Armani@bash"}
read -r -p "RTT SNI(Default is: cloudflare.com): " SNI
SNI=${SNI:-"cloudflare.com"}
read -r -p "RTT Restart Time(Default is: 24): " TERM
TERM=${TERM:-"24"}
sleep 3
update_os
rtt_instller
iranserver
echo
echo "=== Finished ==="
echo
sleep 3
exit ;;
2) echo "Be carefull SSH port must under 23"
echo "Multiport is activated all ports above 22 were forwarded"
read -r -p "RTT IP(Enter Iran IP): " EXIP
read -r -p "RTT PASS(Default is: Armani@bash): " TOPASS
TOPASS=${TOPASS:-"Armani@bash"}
read -r -p "RTT SNI(Default is: cloudflare.com): " SNI
SNI=${SNI:-"cloudflare.com"}
read -r -p "RTT Restart Time(Default is: 24): " TERM
TERM=${TERM:-"24"}
sleep 3
update_os
rtt_instller
externalserver
echo
echo "=== Finished ==="
echo
sleep 3
exit ;;
3) exit_badly ;;
*) echo "Done."; exit 1 ;;
esac