v2ray-agent/find_best_cdn_ip.sh

129 lines
78 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
#ip=('104.16.176.243' '104.16.176.244' '104.16.176.245' '104.16.176.246' '104.16.176.247' '104.16.176.248' '104.16.176.249' '104.16.176.250' '104.16.176.251' '104.16.176.252' '104.16.176.253' '104.16.176.254' '104.16.177.0' '104.16.177.1' '104.16.177.2' '104.16.177.3' '104.16.177.4' '104.16.177.5' '104.16.177.6' '104.16.177.7' '104.16.177.8' '104.16.177.9' '104.16.177.10' '104.16.177.11' '104.16.177.12' '104.16.177.13' '104.16.177.14' '104.16.177.15' '104.16.177.16' '104.16.177.17' '104.16.177.18' '104.16.177.19' '104.16.177.20' '104.16.177.21' '104.16.177.22' '104.16.177.23' '104.16.177.24' '104.16.177.25' '104.16.177.26' '104.16.177.27' '104.16.177.28' '104.16.177.29' '104.16.177.30' '104.16.177.31' '104.16.177.32' '104.16.177.33' '104.16.177.34' '104.16.177.35' '104.16.177.36' '104.16.177.37' '104.16.177.38' '104.16.177.39' '104.16.177.40' '104.16.177.41' '104.16.177.42' '104.16.177.43' '104.16.177.44' '104.16.177.45' '104.16.177.46' '104.16.177.47' '104.16.177.48' '104.16.177.49' '104.16.177.50' '104.16.177.51' '104.16.177.52' '104.16.177.53' '104.16.177.54' '104.16.177.55' '104.16.177.56' '104.16.177.57' '104.16.177.58' '104.16.177.59' '104.16.177.60' '104.16.177.61' '104.16.177.62' '104.16.177.63' '104.16.177.64' '104.16.177.65' '104.16.177.66' '104.16.177.67' '104.16.177.68' '104.16.177.69' '104.16.177.70' '104.16.177.71' '104.16.177.72' '104.16.177.73' '104.16.177.74' '104.16.177.75' '104.16.177.76' '104.16.177.77' '104.16.177.78' '104.16.177.79' '104.16.177.80' '104.16.177.81' '104.16.177.82' '104.16.177.83' '104.16.177.84' '104.16.177.85' '104.16.177.86' '104.16.177.87' '104.16.177.88' '104.16.177.89' '104.16.177.90' '104.16.177.91' '104.16.177.92' '104.16.177.93' '104.16.177.94' '104.16.177.95' '104.16.177.96' '104.16.177.97' '104.16.177.98' '104.16.177.99' '104.16.177.100' '104.16.177.101' '104.16.177.102' '104.16.177.103' '104.16.177.104' '104.16.177.105' '104.16.177.106' '104.16.177.107' '104.16.177.108' '104.16.177.109' '104.16.177.110' '104.16.177.111' '104.16.177.112' '104.16.177.113' '104.16.177.114' '104.16.177.115' '104.16.177.116' '104.16.177.117' '104.16.177.118' '104.16.177.119' '104.16.177.120' '104.16.177.121' '104.16.177.122' '104.16.177.123' '104.16.177.124' '104.16.177.125' '104.16.177.126' '104.16.177.127' '104.16.177.128' '104.16.177.129' '104.16.177.130' '104.16.177.131' '104.16.177.132' '104.16.177.133' '104.16.177.134' '104.16.177.135' '104.16.177.136' '104.16.177.137' '104.16.177.138' '104.16.177.139' '104.16.177.140' '104.16.177.141' '104.16.177.142' '104.16.177.143' '104.16.177.144' '104.16.177.145' '104.16.177.146' '104.16.177.147' '104.16.177.148' '104.16.177.149' '104.16.177.150' '104.16.177.151' '104.16.177.152' '104.16.177.153' '104.16.177.154' '104.16.177.155' '104.16.177.156' '104.16.177.157' '104.16.177.158' '104.16.177.159' '104.16.177.160' '104.16.177.161' '104.16.177.162' '104.16.177.163' '104.16.177.164' '104.16.177.165' '104.16.177.166' '104.16.177.167' '104.16.177.168' '104.16.177.169' '104.16.177.170' '104.16.177.171' '104.16.177.172' '104.16.177.173' '104.16.177.174' '104.16.177.175' '104.16.177.176' '104.16.177.177' '104.16.177.178' '104.16.177.179' '104.16.177.180' '104.16.177.181' '104.16.177.182' '104.16.177.183' '104.16.177.184' '104.16.177.185' '104.16.177.186' '104.16.177.187' '104.16.177.188' '104.16.177.189' '104.16.177.190' '104.16.177.191' '104.16.177.192' '104.16.177.193' '104.16.177.194' '104.16.177.195' '104.16.177.196' '104.16.177.197' '104.16.177.198' '104.16.177.199' '104.16.177.200' '104.16.177.201' '104.16.177.202' '104.16.177.203' '104.16.177.204' '104.16.177.205' '104.16.177.206' '104.16.177.207' '104.16.177.208' '104.16.177.209' '104.16.177.210' '104.16.177.211' '104.16.177.212' '104.16.177.213' '104.16.177.214' '104.16.177.215' '104.16.177.216' '104.16.177.217' '104.16.177.218' '104.16.177.219' '104.16.177.220' '104.16.177.221' '104.16.177.222' '104.16.177.223' '104.16.177.224' '104.16.177.225' '104.16.177.226' '104.16.177.227' '104.16.177.228' '104.16.177.229' '104.16.177.230' '104.16.177.231' '104.16.177.232' '104.16.177.233' '104.16.177.234' '
num=5
timeout=1000
echoType='echo -e'
trap 'onCtrlC' INT
function onCtrlC () {
statisticalContent
exit;
}
statisticalContent(){
echoContent red "============================================="
echoContent yellow '计算中--->'
# 排序计算
echoContent red "排序规则:丢包率>波动>平均延迟,只展示最优的三十条"
echoContent red "依次展示为:[ ip 丢包率 最小延迟 平均延迟 最大延迟 波动 ]"
cat /tmp/ping.log|sort -t ' ' -k 2n -k 6n -k 4n|head -30
echoContent red "============================================="
}
echoContent(){
case $1 in
# 红色
"red")
${echoType} "\033[31m$2 \033[0m"
;;
# 天蓝色
"skyBlue")
${echoType} "\033[36m$2 \033[0m"
;;
# 绿色
"green")
${echoType} "\033[32m$2 \033[0m"
;;
# 白色
"white")
${echoType} "\033[37m$2 \033[0m"
;;
"magenta")
${echoType} "\033[31m$2 \033[0m"
;;
"skyBlue")
${echoType} "\033[36m$2 \033[0m"
;;
# 黄色
"yellow")
${echoType} "\033[33m$2 \033[0m"
;;
esac
}
pingTool(){
echo ''>/tmp/ping.log
echoContent yellow "一共${#ip[*]}个IP每个ip测试${num}次,大约耗时`expr ${#ip[*]} \* ${num} / 60`分钟"
echoContent yellow "可以中途Ctrl+c这样只会计算、统计已经记录下来的"
for ((i=0;i<${#ip[*]};i++))
do
pingResult=`ping -c ${num} -W ${timeout} ${ip[$i]}`
packetLoss=`echo ${pingResult}|awk -F "[%]" '{print $1}'|awk -F "[p][a][c][k][e][t][s][ ][r][e][c][e][i][v][e][d][,][ ]" '{print $2}'`
roundTrip=`echo ${pingResult}|awk -F "[r][o][u][n][d][-][t][r][i][p]" '{print $2}'|awk '{print $3}'|awk -F "[/]" '{print $1"."$2"."$3"."$4}'|awk -F "[/]" '{print $1$2$3$4}'|awk -F "[.]" '{print $1" "$3" "$5" "$7}'`
2020-07-31 09:55:20 +08:00
if [[ "${release}" = "ubuntu" ]]
then
packetLoss=`echo ${pingResult}|awk -F "[%]" '{print $1}'|awk -F "[r][e][c][e][i][v][e][d][,][ ]" '{print $2}'`
roundTrip=`echo ${pingResult}|awk -F "[r][t][t]" '{print $2}'|awk '{print $3}'|awk -F "[/]" '{print $1"."$2"."$3"."$4}'|awk -F "[/]" '{print $1$2$3$4}'|awk -F "[.]" '{print $1" "$3" "$5" "$7}'`
fi
## |awk -F "[/]" '{print $1$2$3}'|awk -F "[.]" '{print $1" "$3" "$5" "$7}'
if [[ -z ${roundTrip} ]]
then
roundTrip="无"
fi
echo "ip:${ip[$i]},丢包率:${packetLoss}%,最小/平均/最大/波动:${roundTrip}"
echo "${ip[$i]} ${packetLoss} ${roundTrip}" >> /tmp/ping.log
done
statisticalContent
}
init(){
echoContent red "============================================="
echoContent green "1.联通"
echoContent green "2.电信"
echoContent green "3.移动"
echoContent yellow "请选择:"
echoContent red "============================================="
read selectType
if [[ "${selectType}" = "1" ]]
then
ip=('104.20.157.0' '104.20.157.1' '104.20.157.2' '104.20.157.3' '104.20.157.4' '104.20.157.5' '104.20.157.6' '104.20.157.7' '104.20.157.8' '104.20.157.9' '104.20.157.10' '104.20.157.11' '104.20.157.12' '104.20.157.13' '104.20.157.14' '104.20.157.15' '104.20.157.16' '104.20.157.17' '104.20.157.18' '104.20.157.19' '104.20.157.20' '104.20.157.21' '104.20.157.22' '104.20.157.23' '104.20.157.24' '104.20.157.25' '104.20.157.26' '104.20.157.27' '104.20.157.28' '104.20.157.29' '104.20.157.30' '104.20.157.31' '104.20.157.32' '104.20.157.33' '104.20.157.34' '104.20.157.35' '104.20.157.36' '104.20.157.37' '104.20.157.38' '104.20.157.39' '104.20.157.40' '104.20.157.41' '104.20.157.42' '104.20.157.43' '104.20.157.44' '104.20.157.45' '104.20.157.46' '104.20.157.47' '104.20.157.48' '104.20.157.49' '104.20.157.50' '104.20.157.51' '104.20.157.52' '104.20.157.53' '104.20.157.54' '104.20.157.55' '104.20.157.56' '104.20.157.57' '104.20.157.58' '104.20.157.59' '104.20.157.60' '104.20.157.61' '104.20.157.62' '104.20.157.63' '104.20.157.64' '104.20.157.65' '104.20.157.66' '104.20.157.67' '104.20.157.68' '104.20.157.69' '104.20.157.70' '104.20.157.71' '104.20.157.72' '104.20.157.73' '104.20.157.74' '104.20.157.75' '104.20.157.76' '104.20.157.77' '104.20.157.78' '104.20.157.79' '104.20.157.80' '104.20.157.81' '104.20.157.82' '104.20.157.83' '104.20.157.84' '104.20.157.85' '104.20.157.86' '104.20.157.87' '104.20.157.88' '104.20.157.89' '104.20.157.90' '104.20.157.91' '104.20.157.92' '104.20.157.93' '104.20.157.94' '104.20.157.95' '104.20.157.96' '104.20.157.97' '104.20.157.98' '104.20.157.99' '104.20.157.100' '104.20.157.101' '104.20.157.102' '104.20.157.103' '104.20.157.104' '104.20.157.105' '104.20.157.106' '104.20.157.107' '104.20.157.108' '104.20.157.109' '104.20.157.110' '104.20.157.111' '104.20.157.112' '104.20.157.113' '104.20.157.114' '104.20.157.115' '104.20.157.116' '104.20.157.117' '104.20.157.118' '104.20.157.119' '104.20.157.120' '104.20.157.121' '104.20.157.122' '104.20.157.123' '104.20.157.124' '104.20.157.125' '104.20.157.126' '104.20.157.127' '104.20.157.128' '104.20.157.129' '104.20.157.130' '104.20.157.131' '104.20.157.132' '104.20.157.133' '104.20.157.134' '104.20.157.135' '104.20.157.136' '104.20.157.137' '104.20.157.138' '104.20.157.139' '104.20.157.140' '104.20.157.141' '104.20.157.142' '104.20.157.143' '104.20.157.144' '104.20.157.145' '104.20.157.146' '104.20.157.147' '104.20.157.148' '104.20.157.149' '104.20.157.150' '104.20.157.151' '104.20.157.152' '104.20.157.153' '104.20.157.154' '104.20.157.155' '104.20.157.156' '104.20.157.157' '104.20.157.158' '104.20.157.159' '104.20.157.160' '104.20.157.161' '104.20.157.162' '104.20.157.163' '104.20.157.164' '104.20.157.165' '104.20.157.166' '104.20.157.167' '104.20.157.168' '104.20.157.169' '104.20.157.170' '104.20.157.171' '104.20.157.172' '104.20.157.173' '104.20.157.174' '104.20.157.175' '104.20.157.176' '104.20.157.177' '104.20.157.178' '104.20.157.179' '104.20.157.180' '104.20.157.181' '104.20.157.182' '104.20.157.183' '104.20.157.184' '104.20.157.185' '104.20.157.186' '104.20.157.187' '104.20.157.188' '104.20.157.189' '104.20.157.190' '104.20.157.191' '104.20.157.192' '104.20.157.193' '104.20.157.194' '104.20.157.195' '104.20.157.196' '104.20.157.197' '104.20.157.198' '104.20.157.199' '104.20.157.200' '104.20.157.201' '104.20.157.202' '104.20.157.203' '104.20.157.204' '104.20.157.205' '104.20.157.206' '104.20.157.207' '104.20.157.208' '104.20.157.209' '104.20.157.210' '104.20.157.211' '104.20.157.212' '104.20.157.213' '104.20.157.214' '104.20.157.215' '104.20.157.216' '104.20.157.217' '104.20.157.218' '104.20.157.219' '104.20.157.220' '104.20.157.221' '104.20.157.222' '104.20.157.223' '104.20.157.224' '104.20.157.225' '104.20.157.226' '104.20.157.227' '104.20.157.228' '104.20.157.229' '104.20.157.230' '104.20.157.231' '104.20.157.232' '104.20.157.233' '104.20.157.234' '104.20.157.235' '104.20.157.236' '104.20.157.237' '104.20.157.238' '104.20.157.239' '104.20.157.240' '104.20.157.241' '104.20.157.242' '104.20.157.243' '104.20.157.244' '104.20.157.245' '104.20.157
elif [[ "${selectType}" = "2" ]]
then
ip=('104.16.160.0' '104.16.160.1' '104.16.160.2' '104.16.160.3' '104.16.160.4' '104.16.160.5' '104.16.160.6' '104.16.160.7' '104.16.160.8' '104.16.160.9' '104.16.160.10' '104.16.160.11' '104.16.160.12' '104.16.160.13' '104.16.160.14' '104.16.160.15' '104.16.160.16' '104.16.160.17' '104.16.160.18' '104.16.160.19' '104.16.160.20' '104.16.160.21' '104.16.160.22' '104.16.160.23' '104.16.160.24' '104.16.160.25' '104.16.160.26' '104.16.160.27' '104.16.160.28' '104.16.160.29' '104.16.160.30' '104.16.160.31' '104.16.160.32' '104.16.160.33' '104.16.160.34' '104.16.160.35' '104.16.160.36' '104.16.160.37' '104.16.160.38' '104.16.160.39' '104.16.160.40' '104.16.160.41' '104.16.160.42' '104.16.160.43' '104.16.160.44' '104.16.160.45' '104.16.160.46' '104.16.160.47' '104.16.160.48' '104.16.160.49' '104.16.160.50' '104.16.160.51' '104.16.160.52' '104.16.160.53' '104.16.160.54' '104.16.160.55' '104.16.160.56' '104.16.160.57' '104.16.160.58' '104.16.160.59' '104.16.160.60' '104.16.160.61' '104.16.160.62' '104.16.160.63' '104.16.160.64' '104.16.160.65' '104.16.160.66' '104.16.160.67' '104.16.160.68' '104.16.160.69' '104.16.160.70' '104.16.160.71' '104.16.160.72' '104.16.160.73' '104.16.160.74' '104.16.160.75' '104.16.160.76' '104.16.160.77' '104.16.160.78' '104.16.160.79' '104.16.160.80' '104.16.160.81' '104.16.160.82' '104.16.160.83' '104.16.160.84' '104.16.160.85' '104.16.160.86' '104.16.160.87' '104.16.160.88' '104.16.160.89' '104.16.160.90' '104.16.160.91' '104.16.160.92' '104.16.160.93' '104.16.160.94' '104.16.160.95' '104.16.160.96' '104.16.160.97' '104.16.160.98' '104.16.160.99' '104.16.160.100' '104.16.160.101' '104.16.160.102' '104.16.160.103' '104.16.160.104' '104.16.160.105' '104.16.160.106' '104.16.160.107' '104.16.160.108' '104.16.160.109' '104.16.160.110' '104.16.160.111' '104.16.160.112' '104.16.160.113' '104.16.160.114' '104.16.160.115' '104.16.160.116' '104.16.160.117' '104.16.160.118' '104.16.160.119' '104.16.160.120' '104.16.160.121' '104.16.160.122' '104.16.160.123' '104.16.160.124' '104.16.160.125' '104.16.160.126' '104.16.160.127' '104.16.160.128' '104.16.160.129' '104.16.160.130' '104.16.160.131' '104.16.160.132' '104.16.160.133' '104.16.160.134' '104.16.160.135' '104.16.160.136' '104.16.160.137' '104.16.160.138' '104.16.160.139' '104.16.160.140' '104.16.160.141' '104.16.160.142' '104.16.160.143' '104.16.160.144' '104.16.160.145' '104.16.160.146' '104.16.160.147' '104.16.160.148' '104.16.160.149' '104.16.160.150' '104.16.160.151' '104.16.160.152' '104.16.160.153' '104.16.160.154' '104.16.160.155' '104.16.160.156' '104.16.160.157' '104.16.160.158' '104.16.160.159' '104.16.160.160' '104.16.160.161' '104.16.160.162' '104.16.160.163' '104.16.160.164' '104.16.160.165' '104.16.160.166' '104.16.160.167' '104.16.160.168' '104.16.160.169' '104.16.160.170' '104.16.160.171' '104.16.160.172' '104.16.160.173' '104.16.160.174' '104.16.160.175' '104.16.160.176' '104.16.160.177' '104.16.160.178' '104.16.160.179' '104.16.160.180' '104.16.160.181' '104.16.160.182' '104.16.160.183' '104.16.160.184' '104.16.160.185' '104.16.160.186' '104.16.160.187' '104.16.160.188' '104.16.160.189' '104.16.160.190' '104.16.160.191' '104.16.160.192' '104.16.160.193' '104.16.160.194' '104.16.160.195' '104.16.160.196' '104.16.160.197' '104.16.160.198' '104.16.160.199' '104.16.160.200' '104.16.160.201' '104.16.160.202' '104.16.160.203' '104.16.160.204' '104.16.160.205' '104.16.160.206' '104.16.160.207' '104.16.160.208' '104.16.160.209' '104.16.160.210' '104.16.160.211' '104.16.160.212' '104.16.160.213' '104.16.160.214' '104.16.160.215' '104.16.160.216' '104.16.160.217' '104.16.160.218' '104.16.160.219' '104.16.160.220' '104.16.160.221' '104.16.160.222' '104.16.160.223' '104.16.160.224' '104.16.160.225' '104.16.160.226' '104.16.160.227' '104.16.160.228' '104.16.160.229' '104.16.160.230' '104.16.160.231' '104.16.160.232' '104.16.160.233' '104.16.160.234' '104.16.160.235' '104.16.160.236' '104.16.160.237' '104.16.160.238' '104.16.160.239' '104.16.160.240' '104.16.160.241' '104.16.160.242' '104.16.160.243' '104.16.160.244' '104.16.160.245' '104.16.160
elif [[ "${selectType}" = "3" ]]
then
ip=('1.0.0.0' '1.0.0.1' '1.0.0.2' '1.0.0.3' '1.0.0.4' '1.0.0.5' '1.0.0.6' '1.0.0.7' '1.0.0.8' '1.0.0.9' '1.0.0.10' '1.0.0.11' '1.0.0.12' '1.0.0.13' '1.0.0.14' '1.0.0.15' '1.0.0.16' '1.0.0.17' '1.0.0.18' '1.0.0.19' '1.0.0.20' '1.0.0.21' '1.0.0.22' '1.0.0.23' '1.0.0.24' '1.0.0.25' '1.0.0.26' '1.0.0.27' '1.0.0.28' '1.0.0.29' '1.0.0.30' '1.0.0.31' '1.0.0.32' '1.0.0.33' '1.0.0.34' '1.0.0.35' '1.0.0.36' '1.0.0.37' '1.0.0.38' '1.0.0.39' '1.0.0.40' '1.0.0.41' '1.0.0.42' '1.0.0.43' '1.0.0.44' '1.0.0.45' '1.0.0.46' '1.0.0.47' '1.0.0.48' '1.0.0.49' '1.0.0.50' '1.0.0.51' '1.0.0.52' '1.0.0.53' '1.0.0.54' '1.0.0.55' '1.0.0.56' '1.0.0.57' '1.0.0.58' '1.0.0.59' '1.0.0.60' '1.0.0.61' '1.0.0.62' '1.0.0.63' '1.0.0.64' '1.0.0.65' '1.0.0.66' '1.0.0.67' '1.0.0.68' '1.0.0.69' '1.0.0.70' '1.0.0.71' '1.0.0.72' '1.0.0.73' '1.0.0.74' '1.0.0.75' '1.0.0.76' '1.0.0.77' '1.0.0.78' '1.0.0.79' '1.0.0.80' '1.0.0.81' '1.0.0.82' '1.0.0.83' '1.0.0.84' '1.0.0.85' '1.0.0.86' '1.0.0.87' '1.0.0.88' '1.0.0.89' '1.0.0.90' '1.0.0.91' '1.0.0.92' '1.0.0.93' '1.0.0.94' '1.0.0.95' '1.0.0.96' '1.0.0.97' '1.0.0.98' '1.0.0.99' '1.0.0.100' '1.0.0.101' '1.0.0.102' '1.0.0.103' '1.0.0.104' '1.0.0.105' '1.0.0.106' '1.0.0.107' '1.0.0.108' '1.0.0.109' '1.0.0.110' '1.0.0.111' '1.0.0.112' '1.0.0.113' '1.0.0.114' '1.0.0.115' '1.0.0.116' '1.0.0.117' '1.0.0.118' '1.0.0.119' '1.0.0.120' '1.0.0.121' '1.0.0.122' '1.0.0.123' '1.0.0.124' '1.0.0.125' '1.0.0.126' '1.0.0.127' '1.0.0.128' '1.0.0.129' '1.0.0.130' '1.0.0.131' '1.0.0.132' '1.0.0.133' '1.0.0.134' '1.0.0.135' '1.0.0.136' '1.0.0.137' '1.0.0.138' '1.0.0.139' '1.0.0.140' '1.0.0.141' '1.0.0.142' '1.0.0.143' '1.0.0.144' '1.0.0.145' '1.0.0.146' '1.0.0.147' '1.0.0.148' '1.0.0.149' '1.0.0.150' '1.0.0.151' '1.0.0.152' '1.0.0.153' '1.0.0.154' '1.0.0.155' '1.0.0.156' '1.0.0.157' '1.0.0.158' '1.0.0.159' '1.0.0.160' '1.0.0.161' '1.0.0.162' '1.0.0.163' '1.0.0.164' '1.0.0.165' '1.0.0.166' '1.0.0.167' '1.0.0.168' '1.0.0.169' '1.0.0.170' '1.0.0.171' '1.0.0.172' '1.0.0.173' '1.0.0.174' '1.0.0.175' '1.0.0.176' '1.0.0.177' '1.0.0.178' '1.0.0.179' '1.0.0.180' '1.0.0.181' '1.0.0.182' '1.0.0.183' '1.0.0.184' '1.0.0.185' '1.0.0.186' '1.0.0.187' '1.0.0.188' '1.0.0.189' '1.0.0.190' '1.0.0.191' '1.0.0.192' '1.0.0.193' '1.0.0.194' '1.0.0.195' '1.0.0.196' '1.0.0.197' '1.0.0.198' '1.0.0.199' '1.0.0.200' '1.0.0.201' '1.0.0.202' '1.0.0.203' '1.0.0.204' '1.0.0.205' '1.0.0.206' '1.0.0.207' '1.0.0.208' '1.0.0.209' '1.0.0.210' '1.0.0.211' '1.0.0.212' '1.0.0.213' '1.0.0.214' '1.0.0.215' '1.0.0.216' '1.0.0.217' '1.0.0.218' '1.0.0.219' '1.0.0.220' '1.0.0.221' '1.0.0.222' '1.0.0.223' '1.0.0.224' '1.0.0.225' '1.0.0.226' '1.0.0.227' '1.0.0.228' '1.0.0.229' '1.0.0.230' '1.0.0.231' '1.0.0.232' '1.0.0.233' '1.0.0.234' '1.0.0.235' '1.0.0.236' '1.0.0.237' '1.0.0.238' '1.0.0.239' '1.0.0.240' '1.0.0.241' '1.0.0.242' '1.0.0.243' '1.0.0.244' '1.0.0.245' '1.0.0.246' '1.0.0.247' '1.0.0.248' '1.0.0.249' '1.0.0.250' '1.0.0.251' '1.0.0.252' '1.0.0.253' '1.0.0.254' '1.1.1.0' '1.1.1.1' '1.1.1.2' '1.1.1.3' '1.1.1.4' '1.1.1.5' '1.1.1.6' '1.1.1.7' '1.1.1.8' '1.1.1.9' '1.1.1.10' '1.1.1.11' '1.1.1.12' '1.1.1.13' '1.1.1.14' '1.1.1.15' '1.1.1.16' '1.1.1.17' '1.1.1.18' '1.1.1.19' '1.1.1.20' '1.1.1.21' '1.1.1.22' '1.1.1.23' '1.1.1.24' '1.1.1.25' '1.1.1.26' '1.1.1.27' '1.1.1.28' '1.1.1.29' '1.1.1.30' '1.1.1.31' '1.1.1.32' '1.1.1.33' '1.1.1.34' '1.1.1.35' '1.1.1.36' '1.1.1.37' '1.1.1.38' '1.1.1.39' '1.1.1.40' '1.1.1.41' '1.1.1.42' '1.1.1.43' '1.1.1.44' '1.1.1.45' '1.1.1.46' '1.1.1.47' '1.1.1.48' '1.1.1.49' '1.1.1.50' '1.1.1.51' '1.1.1.52' '1.1.1.53' '1.1.1.54' '1.1.1.55' '1.1.1.56' '1.1.1.57' '1.1.1.58' '1.1.1.59' '1.1.1.60' '1.1.1.61' '1.1.1.62' '1.1.1.63' '1.1.1.64' '1.1.1.65' '1.1.1.66' '1.1.1.67' '1.1.1.68' '1.1.1.69' '1.1.1.70' '1.1.1.71' '1.1.1.72' '1.1.1.73' '1.1.1.74' '1.1.1.75' '1.1.1.76' '1.1.1.77' '1.1.1.78' '1.1.1.79' '1.1.1.80' '1.1.1.81' '1.1.1.82' '1.1.1.83' '1.1.1.84' '1.1.1.85' '1.1.1.86' '1.1.1.87' '1.1.1.88' '1.1.1.89' '1.1.1.90' '1.1.1.91' '1.1.1.92' '1.1.1.93' '1.1.1.94' '1.1.1.95' '1.1.1.96' '1.1.1.97' '1.1.1.98' '1.1.1.99' '1.1.1.100' '1.1.1.101' '1.1.1.102' '1.1.1.
else
echoContent red "错误"
exit
fi
echoContent red "============================================="
echoContent green "默认测试为五次超时为1000ms"
echoContent green "请输入单个ip的测试次数【默认为5次】"
echoContent red "============================================="
read testNum
if [[ "$testNum" =~ ^[0-9]+$ ]]
then
num=${testNum}
else
echoContent red '使用默认'
fi
pingTool
}
2020-07-31 09:55:20 +08:00
checkSystem(){
2020-07-31 10:00:49 +08:00
if [[ "`uname`" = "Darwin" ]]
2020-07-31 09:55:20 +08:00
then
2020-07-31 10:00:49 +08:00
release="Darwin"
2020-07-31 09:55:20 +08:00
elif [[ ! -z `cat /etc/issue | grep -i "ubuntu" | grep -v grep` ]] || [[ ! -z `cat /proc/version | grep -i "ubuntu" | grep -v grep` ]]
then
release="ubuntu"
fi
if [[ -z ${release} ]]
then
echoContent red "本脚本不支持此系统,请将下方日志反馈给开发者"
cat /etc/issue
cat /proc/version
killSleep > /dev/null 2>&1
exit 0;
fi
}
checkSystem
init