Configuración: Windows XP Firefox 2.0.0.6
#!/usr/bin/env python # devloop 2006 import sys, socket, urllib2 if len(sys.argv)<2: print "Uso: python statsliar.py url <referer_url>" sys.exit(1) url=sys.argv[1] if not url.startswith("http://"): print "No es una url válida" sys.exit(1) if len(sys.argv)==3: if sys.argv[2].startswith("http://"): referer=sys.argv[2] else: print "No es un referer válido" sys.exit(1) else: referer="" head={'User-agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)', 'Referer' : 'http://proxy-list.org/downloadproxylist.php?sp=-1&pp=any&pt=any&pc=any&ps=any'} socket.setdefaulttimeout(10) try: req = urllib2.Request("http://proxy-list.org/downloadproxylist.php?sp=-1&pp=any&pt=any&pc=any&ps=any", headers=head) proxylist = urllib2.urlopen(req).readlines() except IOError: print "Error al leer la lista de proxies" sys.exit(1) print "Obteniendo url "+url head={'User-agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'} if referer!="": head["Referer"]=referer print "Usando referer "+referer for prox in proxylist: prox=prox.strip() try: req = urllib2.Request(url,headers=head) req.set_proxy(prox, 'http') urllib2.urlopen(req) except IOError: continue print prox
;c:\python25