Check proxies by c0ax

ljuskaArchive
//archivePosts: 37Member, Moderator in Perl / Python / Shell scripting
#!/usr/bin/env python
#Check proxies ~ script by Illsuionist aka c0ax
#Visit ljuska.org
#Usage: checkproxy.py filename-with-proxies
import sys, urllib2, time

try:
   fajl = sys.argv[1]
   file = open(fajl)
   lines = file.readlines()
   file.close()
   print "Proxies that works:"
   for proxy in lines:
      proxy = proxy.rstrip('n').strip()
      if proxy == "":
         continue
      try:
         proksiji = {"http":"http://%s" % proxy}
         url = "http://www.google.com/search?q=ljuska"
         usrheaders={'User-agent' : 'Mozilla/5.0'}
         proksi = urllib2.ProxyHandler(proksiji)
         openns = urllib2.build_opener(proksi, urllib2.HTTPHandler(debuglevel=0))
         urllib2.install_opener(openns)
         zaht = urllib2.Request(url, None, usrheaders)
         html = urllib2.urlopen(zaht).read()
         print proxy
      except:
         continue

except:
   print "Read the usage..."
   time.sleep(2)
   sys.exit(1)
Sign In or Register to comment.

Welcome

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions