Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: BigBear en 16 Octubre 2011, 02:52 am



Título: [Python] Proxy Tester
Publicado por: BigBear en 16 Octubre 2011, 02:52 am
Un simple programa para testear proxies

Código
  1. #!usr/bin/python
  2. #Proxy Tester (C) Doddy Hackman 2011
  3.  
  4. import urllib2,sys
  5.  
  6.  
  7. def toma(web) :
  8. return nave.open(web).read()
  9.  
  10. def header() :
  11. print "\n\n--== Proxy Tester ==--\n"
  12.  
  13. def copyright() :
  14. print "\n\n(C) Doddy Hackman 2011\n"
  15. sys.exit(1)
  16.  
  17. def sintax() :
  18. print "\n[*] Sintax : ",sys.argv[0]," <file>"
  19.  
  20. def testar(host):
  21. try:
  22.  proxy = urllib2.ProxyHandler({"http":host})
  23.  nave = urllib2.build_opener(proxy)
  24.  nave.add_header = [('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5')]
  25.  urllib2.install_opener(nave)
  26.  urllib2.urlopen("http://127.0.0.1/sql.php")#
  27.  print "[+] Proxy Found : "+host
  28. except:
  29.  pass
  30.  
  31. header()
  32. if len(sys.argv) != 2 :
  33. sintax()
  34. else :
  35. print "\n[+] Opening file\n\n"
  36. try:
  37.  hosts = open(sys.argv[1], "r").readlines()
  38. except :
  39.  print "\n[-] Error opening file\n"
  40. for host in hosts:
  41.  host = host.replace("\r","").replace("\n","")
  42.  testar(host)
  43. copyright()
  44.  
  45. #  The End
  46.