跳至主要内容

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

评论

此博客中的热门博文

ncurses与readline结合

  #define _XOPEN_SOURCE 700       /* for wcswidth and 700 is for mbsnrtowcs */ #include<wchar.h> #include<ncurses.h>       /* ncurses.h includes stdio.h */ #include<stdlib.h> #include<string.h> #include<readline/readline.h> #include<locale.h>     int mygetstr( char *str, int y, int x){    WINDOW *win;    int size, col;    int ok = 0;    int width;    wchar_t wstr[80];    char *p;        getmaxyx(stdscr, size, col);        void getaline( char *s){      str = s;      rl_callback_handler_remove();      ok = 1;    }        rl_callback_handler_install( "" , getaline);    win = newwin(1, col-x, y, x);    while (1){      rl_callback_read_char(); ...

利用yellowdns解决dns污染问题

 很多网站的dns直接被污染成了127.0.0.1,这样一般就无法访问了,很多翻墙软件也认为是局域网,所以访问不了 这时候,使用yellowdns,将dns转发到远程。然后listen本地的53端口。再将dns服务器都改成本地 vi /etc/resolv.conf windows和路由器,也可以都更改