This repository was archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRDT.sh
More file actions
195 lines (190 loc) · 5.13 KB
/
Copy pathRDT.sh
File metadata and controls
195 lines (190 loc) · 5.13 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
while true; do
echo "Please choose Number:"
echo "1) Iran "
echo "2) Kharej "
echo "3) Uninstall"
echo "9) Back"
read -p "Enter your choice: " choice
if [[ "$choice" -eq 1 || "$choice" -eq 2 ]]; then
apt update
sleep 0.5
SSHD_CONFIG_FILE="/etc/ssh/sshd_config"
CURRENT_PORT=$(grep -E '^(#Port |Port )' "$SSHD_CONFIG_FILE")
if [[ "$CURRENT_PORT" != "Port 22" && "$CURRENT_PORT" != "#Port 22" ]]; then
sudo sed -i -E 's/^(#Port |Port )[0-9]+/Port 22/' "$SSHD_CONFIG_FILE"
echo "SSH Port has been updated to Port 22."
sudo systemctl restart sshd
sudo service ssh restart
fi
sleep 0.5
wget https://github.com/radkesvat/WaterWall/releases/download/v0.99/Waterwall-linux-64.zip
apt install unzip -y
unzip Waterwall-linux-64.zip
sleep 0.5
chmod +x Waterwall
sleep 0.5
rm Waterwall-linux-64.zip
cat > core.json << EOF
{
"log": {
"path": "log/",
"core": {
"loglevel": "DEBUG",
"file": "core.log",
"console": true
},
"network": {
"loglevel": "DEBUG",
"file": "network.log",
"console": true
},
"dns": {
"loglevel": "SILENT",
"file": "dns.log",
"console": false
}
},
"dns": {},
"misc": {
"workers": 0,
"ram-profile": "server",
"libs-path": "libs/"
},
"configs": [
"config.json"
]
}
EOF
public_ip=$(wget -qO- https://api.ipify.org)
echo "Your Server IPv4 is: $public_ip"
fi
if [ "$choice" -eq 1 ]; then
echo "You chose Iran."
read -p "Enter Kharej IPv4: " ip_remote
read -p "Enter the SNI (default: www.speedtest.net): " input_sni
HOSTNAME=${input_sni:-www.speedtest.net}
cat > config.json << EOF
{
"name": "reality_client_multiport",
"nodes": [
{
"name": "users_inbound",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": [443,65535],
"nodelay": true
},
"next": "header"
},
{
"name": "header",
"type": "HeaderClient",
"settings": {
"data": "src_context->port"
},
"next": "my_reality_client"
},
{
"name": "my_reality_client",
"type": "RealityClient",
"settings": {
"sni":"$HOSTNAME",
"password":"passwd"
},
"next": "outbound_to_kharej"
},
{
"name": "outbound_to_kharej",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address":"$ip_remote",
"port":443
}
}
]
}
EOF
sleep 1
nohup ./Waterwall > /dev/null 2>&1 &
echo "Iran IPv4 is: $public_ip"
echo "Kharej IPv4 is: $ip_remote"
echo "SNI $HOSTNAME"
echo "Iran Setup Successfully Created"
elif [ "$choice" -eq 2 ]; then
echo "You chose Kharej."
read -p "Enter the SNI (default: www.speedtest.net): " input_sni
HOSTNAME=${input_sni:-www.speedtest.net}
cat > config.json << EOF
{
"name": "reality_server_multiport",
"nodes": [
{
"name": "main_inbound",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": 443,
"nodelay": true
},
"next": "my_reality_server"
},
{
"name": "my_reality_server",
"type": "RealityServer",
"settings": {
"destination":"reality_dest_node",
"password":"passwd"
},
"next": "header_server"
},
{
"name": "header_server",
"type": "HeaderServer",
"settings": {
"override": "dest_context->port"
},
"next": "final_outbound"
},
{
"name": "final_outbound",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address":"127.0.0.1",
"port":"dest_context->port"
}
},
{
"name": "reality_dest_node",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address":"$HOSTNAME",
"port":443
}
}
]
}
EOF
sleep 1
nohup ./Waterwall > /dev/null 2>&1 &
echo "SNI $HOSTNAME"
echo "Kharej Setup Successfully Created"
elif [ "$choice" -eq 3 ]; then
rm -rf core.json
rm -rf config.json
rm -rf Waterwall
rm -rf log
pkill -f Waterwall
echo "Removed"
elif [ "$choice" -eq 9 ]; then
echo "Exiting..."
break
else
echo "Invalid choice. Please try again."
fi
echo ""
done