Vedbaz

Untitled

Jan 17th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. import pycurl
  2. import time
  3. import sys
  4. class Storage:
  5. def __init__(self):
  6. self.contents = ''
  7. self.line = 0
  8.  
  9. def store(self, buf):
  10. self.line = self.line + 1
  11. self.contents = "%s%i: %s" % (self.contents, self.line, buf)
  12.  
  13. def __str__(self):
  14. return self.contents
  15.  
  16. retrieved_body = Storage()
  17. retrieved_headers = Storage()
  18. link=raw_input("Enter url: ")
  19. try:
  20. link = str(link)
  21. if len(link)<=5:
  22. sys.exit()
  23. except:
  24. print "Invalid url."
  25. sys.exit()
  26. fopen=open('prox.txt','r')
  27. popen=open('port.txt','r')
  28. count=sum(1 for line in open('prox.txt'))
  29. print
  30. print "Proxy List Loaded."
  31. def view():
  32. while True:
  33. try:
  34. line=fopen.next()
  35. port=popen.next()
  36. c1=pycurl.Curl()
  37. c1.setopt(pycurl.URL, '%s'%link)
  38. c1.setopt(pycurl.WRITEFUNCTION, retrieved_body.store)
  39. c1.setopt(pycurl.HEADERFUNCTION, retrieved_headers.store)
  40. c1.setopt(pycurl.PROXY, '%s'%line)
  41. c1.setopt(pycurl.PROXYPORT, int(port))
  42. c1.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS4)
  43. c1.perform()
  44. time.sleep(2)
  45. print "View done with proxy: %s"%line
  46. except StopIteration:
  47. print
  48. print "End of proxy list."
  49. sys.exit()
  50. def start():
  51. for i in range(count):
  52. view()
  53. start()
Advertisement
Add Comment
Please, Sign In to add comment