Update port_pure.sh

dependabot/github_actions/actions/checkout-3.1.0
fscarmen 4 years ago committed by GitHub
parent 1a780c3f87
commit 4b6f3ba987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      port_pure.sh

@ -6,7 +6,7 @@ ip=$1
NODE_ID=('CN_35' 'CN_40' 'CN_50' 'CN_90' 'CN_103' 'CN_104' 'CN_105' 'CN_150' 'CN_160' 'CN_210')
NODE_ZH=('深圳 阿里云' '北京 阿里云' '北京 腾讯云' '泉州 电信CN2' '江苏 电信' '江苏 移动' '江苏 联通' '杭州 阿里云' '青岛 阿里云' '上海 阿里云')
result0=''; result1='📛'
result0='🟢'; result1='🔴'
TOKEN=$(wget -qO- https://tcp$STACK.ping.pe/$ip | grep 'document.cookie' | sed "s/.*document.cookie=\"\([^;]\{1,\}\).*/\1/g")
STREAM_ID=$(wget -qO- --header="cookie: $TOKEN" https://tcp$STACK.ping.pe/$ip | grep 'stream_id =' | cut -d \' -f2)
@ -19,9 +19,10 @@ until [[ $ALL =~ 'TW_1' ]]; do
ALL=$(wget -qO- --header="cookie: $TOKEN" https://tcp$STACK.ping.pe/ajax_getPingResults_v2.php?stream_id=$STREAM_ID)
done
printf " %s\t\t%s\t\t%s\t\t\n" 状态 地方 ISP
[ -z "$ALL" ] && printf "获取不了数据,请输入正确的格式: IPv4:port, [IPv6]:port, 域名:port\n"
printf "%-10s %-10s %-10s\n" 状态 地方 ISP
for ((i=0;i<${#NODE_ID[@]};i++)); do
RESULT[i]=$(echo $ALL | python3 -m json.tool | grep -A 2 ${NODE_ID[i]} | grep result | sed "s#[\":, ]##g")
RESULT[i]=${RESULT[i]:-'result1'}
printf " %s\t\t%s\t\t%s\t\t\n" $(eval echo "\$${RESULT[i]}") ${NODE_ZH[i]}
printf "%-10s %-10s %-10s\n" $(eval echo "\$${RESULT[i]}") ${NODE_ZH[i]}
done

Loading…
Cancel
Save