3G上网卡使用经验(收集贴)

代码:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# From: ubuntu.org.cn Copyright: GPLv2
import urllib
import re
from datetime import datetime
import socket

def findporxy():
    f = urllib.urlopen("http://httproxy.net.ru/index.php?coun=China&type=&port=")
    html = f.read()
    p = re.compile('<td>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,4})</td>')
    ips=set(p.findall(html))
    socket.setdefaulttimeout(5)
    a={}
    for ip in ips:
        start=datetime.now()
        flag = checkproxy(ip)
        end=datetime.now()
        if flag:
            print ip,'花费',end-start,'时间';
            a[end-start]=ip
    b=sorted(a)
    print '最佳是 :',a[b[0]]
    print '其次是 :',a[b[1]]
    print '再次是 :',a[b[2]]

def checkproxy(ip):
        try:
            proxies = {'http': 'http://'+ip}
            filehandle = urllib.urlopen("http://forum.ubuntu.org.cn/download.php?id=1344", proxies=proxies)
            html=filehandle.read()
            if len(html)==316187:
                return True
            else:
                return False
        except:
            return False

if __name__ == '__main__':
    findporxy()


复制以上代码,保存为 find.py ,运行 python find.py 得到最佳代理服务器地址(都是国内地址)。
欢迎网通的朋友测试一下。
小技巧:不一定要选择最快的,其次和再次都不错的。

底下网友介绍 123.190.193.8 : 3128 不错 ,建议firefox安装 foxyproxy 插件,然后设置Ubuntu.org.cn通过代理访问。

最后由 oneleaf 编辑于 2008-03-10 13:34,总共编辑了 4 次

作者: oneleaf   发布时间: 2008-02-29

代理的速度似乎不是很稳定。连续运行两次,三个结果里只有一个是相同的。

作者: millenniumdark   发布时间: 2008-02-29

millenniumdark 写道:
代理的速度似乎不是很稳定。连续运行两次,三个结果里只有一个是相同的。

好了,修改为使用300K的文件来测速。

作者: oneleaf   发布时间: 2008-02-29

似乎用不用代理速度一样快

作者: 雄鸡起舞   发布时间: 2008-03-01

作者: skyx   发布时间: 2008-03-01

受启发,写个 shell 的,,先能凑和用,再琢磨改善
国内代理最烂,时好,时坏,时没 ... 而且不能出国,我测试的结果,澳洲的最好,其次美国,马来西亚 ,..

代码:
1 124.133.37.248 8080 transparent China 2008-02-29
2 80.190.246.141 3128 transparent Germany 2008-03-01
3 218.65.49.3 3128 transparent China 2008-02-29
4 201.25.119.178 3128 transparent Brazil 2008-02-29
5 195.248.240.210 3128 transparent Great Britain (UK) 2008-02-29
6 200.157.48.198 3128 transparent Brazil 2008-02-29
7 189.10.107.3 3128 transparent Brazil 2008-02-29
8 200.162.6.197 3128 transparent Brazil 2008-03-01
9 61.17.179.15 8080 transparent India 2008-02-29
10 201.76.181.2 3128 transparent Brazil 2008-02-29
11 201.75.202.23 80 transparent Brazil 2008-02-29
12 201.38.143.202 6588 high anonymity Brazil 2008-03-01
13 200.219.152.6 8080 transparent Brazil 2008-02-29
14 203.176.104.35 3128 transparent Australia 2008-02-29
15 69.217.73.52 8080 anonymous United States 2008-02-29
16 80.191.131.2 3128 transparent Iran 2008-02-29
17 143.233.227.71 3128 transparent Greece 2008-02-29
18 193.17.85.151 3128 transparent Switzerland 2008-02-29
19 82.208.193.11 3128 transparent Czechoslovakia 2008-02-29
20 61.133.87.226 8080 anonymous China 2008-03-01
21 220.225.196.132 80 transparent India 2008-02-29
22 85.185.11.131 3128 transparent Iran 2008-02-29
23 12.149.212.1 80 anonymous United States 2008-03-01
24 200.21.234.51 3128 transparent Colombia 2008-03-01
25 66.83.102.82 8080 high anonymity United States 2008-03-01
26 201.66.244.154 3128 transparent Brazil 2008-02-29
27 60.52.193.122 3128 transparent Malaysia 2008-02-29
28 63.149.98.2 80 high anonymity United States 2008-02-29
29 200.174.85.195 3128 transparent Brazil 2008-02-29
30 196.217.249.190 8080 anonymous Morocco 2008-02-29
31 218.64.214.110 3128 transparent China 2008-02-29
32 200.207.9.168 3128 transparent Brazil 2008-02-29
33 218.66.104.161 80 transparent China 2008-02-29
34 201.18.38.242 3128 transparent Brazil 2008-02-29
35 203.113.115.20 8080 transparent Thailand 2008-02-29
36 165.98.60.109 80 anonymous Nicaragua 2008-02-29
37 201.55.193.161 3128 transparent Brazil 2008-02-29
38 58.221.254.156 3128 high anonymity China 2008-02-29
39 203.149.32.4 3128 transparent Thailand 2008-02-29
40 212.92.23.102 3128 transparent Hungary 2008-02-29
41 195.229.236.106 80 anonymous United Arab Emirates 2008-02-29
42 203.160.1.54 80 transparent Vietnam 2008-02-29
43 61.130.11.115 80 high anonymity China 2008-02-29
44 125.16.15.72 8080 transparent India 2008-02-29
45 200.65.127.161 3128 transparent Mexico 2008-02-29
46 217.172.56.49 3128 transparent Germany 2008-02-29
47 217.91.52.155 80 high anonymity Germany 2008-02-29
48 217.41.27.254 3128 transparent Great Britain (UK) 2008-02-29
49 220.225.196.123 80 transparent India 2008-02-29
50 203.158.167.148 8080 transparent Thailand 2008-03-01


代码:
#!/bin/bash

url='http://forum.ubuntu.org.cn/index.php'
free='http://www.romanfr.com/proxy/index.php'

if [ -n "$1" ];then url=$1; fi

type curl &>/dev/null ||( echo -e "\n\033[37;41;1mwe need curl,\033[0m\nplease \"\
                                   sudo ap-get install curl\" first ^^\n"; exit 1)

curl $free >/tmp/free.html #&>/dev/null
grep "<\/td>" /tmp/free.html |grep -v "href\|script\|br" > /tmp/list
sed -ie 's/<td>\|<\/td>\|<td.>//g;s/^[ \t]*//;/^$/d' /tmp/list
cat /tmp/list|awk '{if (NR%6==0){print $0} else {printf"%s ",$0}}' >/tmp/list
sed -ie '/United\|China\|Austra\|Malay/!d' /tmp/list


MAX=`cat /tmp/list|wc -l`
echo -e "\n\033[33mwe get $MAX proxys...\033[0m\n"
if [ $MAX = 0 ]; then exit;fi

for ((i=0; i<$MAX; ++i)); do
   #export http_proxy=$PROXY:$PORT
   PROXY=`awk 'NR=='$i+1'{print $2}' /tmp/list`
   PORT=`awk 'NR=='$i+1'{print $3}' /tmp/list`
   STATE=`awk 'NR=='$i+1'{print $5}' /tmp/list`
   echo -e "\n$i# $PROXY:$PORT:  $STATE"
   curl --connect-timeout 10 -m 30  -x $PROXY:$PORT $url >/dev/null
done

作者: iblicf   发布时间: 2008-03-01

貌似这个论坛是电信的,我在河北,用网通访问太慢了。
为什么不开个双路的呢?

作者: sandylaw   发布时间: 2008-03-02

很实用的一个小程序,学习了。

作者: wwl81er   发布时间: 2008-03-02

sandylaw 写道:
貌似这个论坛是电信的,我在河北,用网通访问太慢了。
为什么不开个双路的呢?


因为不少网通访问也正常,双路价格比较高,不合算。

作者: millenniumdark   发布时间: 2008-03-02

嘿,这个好使,木樨代理 ,

下载 : http://hi.baidu.com/jrobot/blog/item/69 ... 1097b.html
自己试试哪个代理资源网站好用,感觉下边这两个比较好
http://proxy.cemsg.com/
http://www.romanfr.com/proxy/index.php

搜完了按延时排个序,
我现在用,123.190.193.8:3128 这个快如刀锋阿,感觉象夜里2,3点^^ , 可惜不出国

作者: iblicf   发布时间: 2008-03-02

在KUBUNTU的系统设置里的网络设置那里有一个选项就是提供配置代理的,很好。

作者: vigor   发布时间: 2008-03-04

怎么用 菜鸟 不会脑

作者: 夜泊枫桥   发布时间: 2008-03-06

我这里速度还可以(河南网通-南阳)
在网吧速度就不行了
也不知道为什么

作者: dogfox   发布时间: 2008-03-06

虽然不需要但还是谢谢一叶

作者: qiang_liu8183   发布时间: 2008-03-06

iblicf 写道:
受启发,写个 shell 的,,先能凑和用,再琢磨改善
国内代理最烂,时好,时坏,时没 ... 而且不能出国,我测试的结果,澳洲的最好,其次美国,马来西亚 ,..



国内代理设置来是给局部合法用户带来方便的,而不是为了方便非法用户盗用的。

作者: PhoenixJ   发布时间: 2008-03-07

good shell

作者: maven   发布时间: 2008-03-20

wo gang zhuang de .shui zhi zen me han yu shu ru fa ?
wo email:vkcroaton@yeah.net
qing fa dao wo de you xiang li

作者: vkcroaton   发布时间: 2008-05-08

学习... 收藏先.. 好帖.

作者: yj98   发布时间: 2008-05-19

有人能解释一下上面的代码吗??在学习shell,对上面代码不理解。

作者: xinchen97   发布时间: 2008-10-30

不需要这样吧,网通连台湾和主服务器都比较快的,我都是晚上连主服务器,白天连台湾的
一般都满速

作者: nubix   发布时间: 2008-11-01

我网通,这论坛速度很快啊~

作者: hubert   发布时间: 2008-11-23

我是网通的啊,访问得好好的嘛

作者: swpu_miles   发布时间: 2010-08-24

请教这是怎么回事:
附件:

Screenshot-1.png [ 72.09 KiB | 被浏览 2 次 ]

作者: yb0809   发布时间: 2011-03-18

good shell

作者: maven   发布时间: 2008-03-20

wo gang zhuang de .shui zhi zen me han yu shu ru fa ?
wo email:vkcroaton@yeah.net
qing fa dao wo de you xiang li

作者: vkcroaton   发布时间: 2008-05-08

学习... 收藏先.. 好帖.

作者: yj98   发布时间: 2008-05-19

有人能解释一下上面的代码吗??在学习shell,对上面代码不理解。

作者: xinchen97   发布时间: 2008-10-30

不需要这样吧,网通连台湾和主服务器都比较快的,我都是晚上连主服务器,白天连台湾的
一般都满速

作者: nubix   发布时间: 2008-11-01

我网通,这论坛速度很快啊~

作者: hubert   发布时间: 2008-11-23

我是网通的啊,访问得好好的嘛

作者: swpu_miles   发布时间: 2010-08-24

请教这是怎么回事:
附件:

Screenshot-1.png [ 72.09 KiB | 被浏览 3 次 ]

作者: yb0809   发布时间: 2011-03-18