Skip to content

Commit

Permalink
Create 上海组播测试.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
redrainl authored Feb 28, 2024
1 parent 4da431f commit c6d6a62
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions speedtest/上海组播测试.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

read -p "确定要运行脚本吗?(y/n): " choice

# 判断用户的选择,如果不是"y"则退出脚本,默认使用文件zubo.ip,带参数则以参数为ip文件名
if [ "$choice" != "y" ]; then
echo "脚本已取消."
exit 0
fi

time=$(date +%m%d%H%M)
i=0

if [ $# -gt 0 ]; then
filename="$1"
else
filename="zubo.ip"
fi
lines=$(cat $filename|wc -l)

echo "文件内ip共计$lines"
while read line; do
i=$(($i+1));
ip=$line
url="http://$ip/udp/239.45.3.209:5140"
echo $url
curl $url --connect-timeout 3 --max-time 10 -o /dev/null >zubo.tmp 2>&1
a=$(head -n 3 zubo.tmp|awk '{print $NF}'|tail -n 1)
echo "$i/$lines个: $ip $a"
echo "$ip $a">> speedtest_zubo$time.log
done <"$filename"

rm -f zubo.tmp
cat speedtest_zubo$time.log |grep -E 'M|k'|awk '{print $2" " $1}'|sort -n -r >result_zubo.txt
cat result_zubo.txt

0 comments on commit c6d6a62

Please sign in to comment.