-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path9
178 lines (148 loc) · 3.92 KB
/
9
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
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
random() {
tr </dev/urandom -dc A-Za-z0-9 | head -c5
echo
}
array=(1 2 3 4 5 6 7 8 9 0 a b c d e f)
gen64() {
ip64() {
echo "${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}"
}
echo "$1:$(ip64):$(ip64):$(ip64):$(ip64)"
}
install_3proxy() {
echo "Installing 3proxy..."
URL="https://github.com/z3APA3A/3proxy/archive/3proxy-0.8.6.tar.gz"
wget -qO- $URL | bsdtar -xvf-
cd 3proxy-3proxy-0.8.6
make -f Makefile.Linux
mkdir -p /usr/local/etc/3proxy/{bin,logs,stat}
cp src/3proxy /usr/local/etc/3proxy/bin/
cd $WORKDIR
}
gen_3proxy() {
cat <<EOF
daemon
maxconn 100000
nserver 1.1.1.1
nserver 8.8.4.4
nserver 2001:4860:4860::8888
nserver 2001:4860:4860::8844
nscache 65536
timeouts 1 5 30 60 180 1800 15 60
setgid 65535
setuid 65535
stacksize 6291456
flush
$(awk -F "/" '{print "\n" \
"" $1 "\n" \
"proxy -6 -n -a -p" $4 " -i" $3 " -e"$5"\n" \
"flush\n"}' ${WORKDATA})
EOF
}
gen_proxy_file_for_user() {
cat >proxy.txt <<EOF
$(awk -F "/" '{print $3 ":" $4 }' ${WORKDATA})
EOF
}
gen_data() {
seq $FIRST_PORT $LAST_PORT | while read port; do
echo "//$IP4/$port/$(gen64 $IP6)"
done
}
gen_iptables() {
cat <<EOF
$(awk -F "/" '{print "iptables -I INPUT -p tcp --dport " $4 " -m state --state NEW -j ACCEPT"}' ${WORKDATA})
EOF
}
gen_ifconfig() {
cat <<EOF
$(awk -F "/" '{print "ifconfig eth0 inet6 add " $5 "/64"}' ${WORKDATA})
EOF
}
setup_environment() {
echo "Installing necessary packages"
yum -y install gcc net-tools bsdtar zip make >/dev/null
}
# Khởi tạo biến rotate_count để lưu trữ số lần xoay IPv6
rotate_count=0
# Định nghĩa hàm rotate_ipv6 để xoay IPv6 và cập nhật số lần xoay
rotate_ipv6() {
# Hiển thị thông báo xoay IPv6
echo "Rotating IPv6 addresses..."
# Lấy IPv6 mới từ icanhazip.com và cập nhật dữ liệu
IP6=$(curl -6 -s icanhazip.com | cut -f1-4 -d':')
gen_data >$WORKDIR/data.txt
gen_ifconfig >$WORKDIR/boot_ifconfig.sh
bash $WORKDIR/boot_ifconfig.sh
# Hiển thị thông báo thành công và cập nhật số lần xoay
echo "IPv6 addresses rotated successfully."
rotate_count=$((rotate_count + 1))
# Hiển thị số lần xoay mới nhất
echo "Rotation count: $rotate_count"
}
# Vòng lặp để xoay IP sau mỗi 10 phút
while true; do
rotate_ipv6
sleep 600
done
download_proxy() {
cd $WORKDIR || exit 1
curl -F "proxy.txt" https://transfer.sh
}
echo "working folder = /home/cloudfly"
WORKDIR="/home/cloudfly"
WORKDATA="${WORKDIR}/data.txt"
mkdir $WORKDIR && cd $_
IP4=$(curl -4 -s icanhazip.com)
IP6=$(curl -6 -s icanhazip.com | cut -f1-4 -d':')
echo "Internal ip = ${IP4}. Exteranl sub for ip6 = ${IP6}"
FIRST_PORT=20000
LAST_PORT=22000
setup_environment
install_3proxy
gen_data >$WORKDIR/data.txt
gen_iptables >$WORKDIR/boot_iptables.sh
gen_ifconfig >$WORKDIR/boot_ifconfig.sh
chmod +x $WORKDIR/boot_*.sh /etc/rc.local
gen_3proxy >/usr/local/etc/3proxy/3proxy.cfg
cat >>/etc/rc.local <<EOF
bash ${WORKDIR}/boot_iptables.sh
bash ${WORKDIR}/boot_ifconfig.sh
ulimit -n 10048
/usr/local/etc/3proxy/bin/3proxy /usr/local/etc/3proxy/3proxy.cfg
EOF
chmod +x /etc/rc.local
bash /etc/rc.local
gen_proxy_file_for_user
rm -rf /root/3proxy-3proxy-0.8.6
echo "Starting Proxy"
# Menu loop
while true; do
echo "1. Install 3proxy"
echo "2. Rotate IPv6 addresses"
echo "3. Download proxy"
echo "4. Exit"
echo -n "Enter your choice: "
read choice
case $choice in
1)
install_3proxy
;;
2)
rotate_ipv6
;;
3)
download_proxy
;;
4)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid choice. Please try again."
;;
esac
done
download_proxy