跳至主要内容

curl获得socks5的延时、带宽、位置

#! /bin/sh

echo "" > socksresult.txt
for line in `cat socks5`
do
  #echo $line
  rtt=`curl -m 5 --socks5 $line -w %{time_total}s -o null google.com`
  if [ $? -ne 0 ]; then
    echo $line" fail"
  else
    country=`curl -m 5 --socks5 $line ipinfo.io | grep country | awk '{print $2}' | sed "s/\"//g" | sed "s/,//g"`
    loc=`curl -m 5 --socks5 $line ipinfo.io | grep region | awk '{print $2}' | sed "s/\"//g" | sed "s/,//g"`
    speed=`curl --socks5 $line -o null -w %{speed_download} -s http://speedtest.wdc01.softlayer.com/downloads/test10.zip`
    speedk=`echo "($speed+0.5)/1024" | bc`
    info=$line" "$rtt" "$country" "$loc" "$speedk"KB/s"
    echo $info  >> socksresult.txt
  fi
done


结果
1.2.2.1:1080 0.544s VN Hanoi 539KB/s
2.2.2.2:1080 3.870s IL Central 881KB/s
2.3.3.3:1080 1.713s TR Bursa 1375KB/s

评论

此博客中的热门博文

ubuntu 添加root登录

Login to your server as root. As the root user, edit the sshd_config file found in  /etc/ssh/sshd_config : vim /etc/ssh/sshd_config ( For details on working with Vim check out our article here !) Add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there. PermitRootLogin yes Save and exit the file. Restart the SSH server: systemctl restart sshd or service sshd restart