星期六, 四月 10

批量代理测试

到 http://www.cnproxy.com/proxyedu1.html等网站把代理列表放到 ip.txt 里,要保证ip在行首,或者用默认的http://proxy.ipcn.org/proxylist.html代理列表。

#!/bin/bash
if [ -e ip.txt ];then
    echo "use ip.txt";
else
    w3m -no-proxy -dump http://proxy.ipcn.org/proxylist.html > ip.txt
fi

arg=$1
if [ $# -eq 0 ]; then
    arg="p"
fi

testurl="http://www.google.com/index.html"
if [ $arg = 's' ]; then
    testurl="https://www.dropbox.com/"
fi

iplist=`cat ip.txt|sed -e "s/[ \t].*//g" -e "/^$/d"`
for i in $iplist
do
    if [ $arg = 's' ]; then
        a=`curl --proxy $i --connect-timeout 3 $testurl 2>/dev/null |grep dropbox`
    else
        a=`curl --proxy $i --connect-timeout 3 $testurl 2>/dev/null |grep google`
    fi

    if [ "$a" != "" ]
    then
        echo $i
    fi
done
用s作参数获得支持https的代理。因为用了3 秒超时,速度有点慢,好像还不能正常终止。
试一下,得到以下可用代理:
http:

61.153.149.205:8080
211.102.90.59:80
211.138.124.197:80
211.138.124.198:80
211.138.124.199:80
211.138.124.200:80
211.138.124.210:80
211.138.124.211:80
211.138.124.232:80
211.138.124.233:80
219.238.191.96:80
221.214.27.252:808
221.214.27.253:808
221.238.17.245:8080
222.76.210.8:8080
61.155.220.243:80
218.4.205.195:808
121.14.158.76:80
121.14.158.75:80
219.139.158.59:8080
211.138.124.197:80
221.10.44.214:80
211.138.124.233:80
211.138.124.199:80
211.138.124.210:80
61.153.149.205:8080
211.138.124.200:80
211.138.124.198:80
222.76.210.8:8080
202.112.88.251:808
222.161.3.133:8080
58.19.176.200:8080
58.240.237.32:80
122.139.60.99:8080
119.161.149.239:80
218.90.171.249:8080
222.92.117.241:80
222.77.187.134:8080
211.102.90.59:80
211.138.124.211:80
211.138.124.232:80
202.116.160.89:80
221.9.255.117:80
221.12.47.4:8080
218.56.64.2:80
221.12.47.2:8080
211.152.11.30:80

https:
61.153.149.205:8080
211.103.134.39:8080
219.238.191.96:80
221.238.17.245:8080
222.73.27.232:8080
222.76.210.8:8080
218.4.205.195:808
222.161.3.146:8080
219.139.158.59:8080

没有评论:

发表评论