Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 30th, 2013  |  syntax: None  |  size: 1.43 KB  |  views: 1,627  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import json
  2. import urllib2  
  3.  
  4. with open('urls.txt') as f:
  5.     urls = [line.rstrip() for line in f]
  6. with open('proxies.txt') as proxies:
  7.     for line in proxies:
  8.         proxy = json.loads(line)
  9.         proxy_handler = urllib2.ProxyHandler(proxy)
  10.         opener = urllib2.build_opener(proxy_handler)
  11.         urllib2.install_opener(opener)
  12.         for url in urls:
  13.             data = urllib2.urlopen(url).read()
  14.             print data
  15.        
  16. http://myipaddress.com
  17.        
  18. {"https": "https://87.98.216.22:3128"}
  19. {"https": "http://190.153.7.189:8080"}
  20. {"https": "http://125.39.68.181:80"}
  21.        
  22. import json
  23. import urllib2
  24.  
  25. with open('urls.txt') as f:
  26.     urls = [line.rstrip() for line in f]
  27. with open('proxies.txt') as proxies:
  28.     for line in proxies:
  29.         proxy = json.loads(line)
  30.         proxy_handler = urllib2.ProxyHandler(proxy)
  31.         opener = urllib2.build_opener(proxy_handler)
  32.         urllib2.install_opener(opener)
  33.         for url in urls:
  34.             try:
  35.                 data = urllib2.urlopen(url).read()
  36.                 print proxy, "-", data
  37.             except:
  38.                 print proxy, "- not working"
  39.        
  40. http://api.exip.org/?call=ip
  41.        
  42. {"http": "http://218.108.114.140:8080"}
  43. {"http": "http://59.47.43.93:8080"}
  44. {"http": "http://218.108.170.172:80"}
  45.        
  46. {u'http': u'http://218.108.114.140:8080'} - 218.108.114.140
  47. {u'http': u'http://59.47.43.93:8080'} - 118.207.240.161
  48. {u'http': u'http://218.108.170.172:80'} - not working
  49. [Finished in 25.4s]