-
Notifications
You must be signed in to change notification settings - Fork 11
/
decode-2endip.sh
199 lines (192 loc) · 5.07 KB
/
decode-2endip.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
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
196
197
198
199
#!/bin/bash
export LANG=en_US.UTF-8
case "$(uname -m)" in
x86_64 | x64 | amd64)
cpu=amd64
;;
i386 | i686)
cpu=386
;;
armv8 | armv8l | arm64 | aarch64)
cpu=arm64
;;
armv7l)
cpu=arm
;;
*)
echo "当前架构为$(uname -m),暂不支持"
exit
;;
esac
cfwarpreg() {
curl -sSL https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/acwarp.sh -o acwarp.sh && chmod +x acwarp.sh && ./acwarp.sh
}
warpendipv4v6() {
echo "1.IPV4优选对端IP"
echo "2.IPV6优选对端IP"
echo "0.退出"
read -p "请选择: " menu
if [ "$menu" == "1" ]; then
cfwarpIP
endipv4
endipresult
elif [ "$menu" == "2" ]; then
cfwarpIP
endipv6
endipresult
else
exit
fi
}
cfwarpIP() {
if [[ ! -f "warpendpoint" ]]; then
echo "下载warp优选程序"
if [[ -n $cpu ]]; then
curl -L -o warpendpoint -# --retry 2 https://gitlab.com/rwkgyg/CFwarp/raw/main/point/$cpu
fi
fi
}
endipv4() {
n=0
iplist=100
while true; do
temp[$n]=$(echo 162.159.192.$(($RANDOM % 256)))
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
temp[$n]=$(echo 162.159.193.$(($RANDOM % 256)))
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
temp[$n]=$(echo 162.159.195.$(($RANDOM % 256)))
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
temp[$n]=$(echo 188.114.96.$(($RANDOM % 256)))
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
temp[$n]=$(echo 188.114.97.$(($RANDOM % 256)))
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
temp[$n]=$(echo 188.114.98.$(($RANDOM % 256)))
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
temp[$n]=$(echo 188.114.99.$(($RANDOM % 256)))
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
done
while true; do
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo 162.159.192.$(($RANDOM % 256)))
n=$(($n + 1))
fi
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo 162.159.193.$(($RANDOM % 256)))
n=$(($n + 1))
fi
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo 162.159.195.$(($RANDOM % 256)))
n=$(($n + 1))
fi
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo 188.114.96.$(($RANDOM % 256)))
n=$(($n + 1))
fi
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo 188.114.97.$(($RANDOM % 256)))
n=$(($n + 1))
fi
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo 188.114.98.$(($RANDOM % 256)))
n=$(($n + 1))
fi
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo 188.114.99.$(($RANDOM % 256)))
n=$(($n + 1))
fi
done
}
endipv6() {
n=0
iplist=100
while true; do
temp[$n]=$(echo [2606:4700:d0::$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2)))])
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
temp[$n]=$(echo [2606:4700:d1::$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2)))])
n=$(($n + 1))
if [ $n -ge $iplist ]; then
break
fi
done
while true; do
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo [2606:4700:d0::$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2)))])
n=$(($n + 1))
fi
if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ]; then
break
else
temp[$n]=$(echo [2606:4700:d1::$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2))):$(printf '%x\n' $(($RANDOM * 2 + $RANDOM % 2)))])
n=$(($n + 1))
fi
done
}
endipresult() {
echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u >ip.txt
ulimit -n 102400
chmod +x warpendpoint
./warpendpoint
clear
cat result.csv | awk -F, '$3!="timeout ms" {print} ' | sort -t, -nk2 -nk3 | uniq | head -11 | awk -F, '{print "端点 "$1" 丢包率 "$2" 平均延迟 "$3}'
rm -rf ip.txt warpendpoint
exit
}
echo "------------------------------------------------------"
echo "甬哥Github项目 :github.com/yonggekkk"
echo "甬哥blogger博客 :ygkkk.blogspot.com"
echo "甬哥YouTube频道 :www.youtube.com/@ygkkk"
echo
echo "支持WARP优选对端IP、WARP配置文件生成"
echo "------------------------------------------------------"
echo
echo "1.WARP-V4V6优选对端IP"
echo "2.注册生成WARP-Wireguard配置文件、二维码"
echo "0.退出"
read -p "请选择: " menu
if [ "$menu" == "1" ]; then
warpendipv4v6
elif [ "$menu" == "2" ]; then
cfwarpreg
else
exit
fi