[Python] Proxy Tester

Iniciado por BigBear, 16 Octubre 2011, 02:52 AM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Un simple programa para testear proxies

Código (python) [Seleccionar]

#!usr/bin/python
#Proxy Tester (C) Doddy Hackman 2011

import urllib2,sys


def toma(web) :
return nave.open(web).read()

def header() :
print "\n\n--== Proxy Tester ==--\n"

def copyright() :
print "\n\n(C) Doddy Hackman 2011\n"
sys.exit(1)

def sintax() :
print "\n[*] Sintax : ",sys.argv[0]," <file>"

def testar(host):
try:
  proxy = urllib2.ProxyHandler({"http":host})
  nave = urllib2.build_opener(proxy)
  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')]
  urllib2.install_opener(nave)
  urllib2.urlopen("http://127.0.0.1/sql.php")#
  print "[+] Proxy Found : "+host
except:
  pass

header()
if len(sys.argv) != 2 :
sintax()
else :
print "\n[+] Opening file\n\n"
try:
  hosts = open(sys.argv[1], "r").readlines()
except :
  print "\n[-] Error opening file\n"
for host in hosts:
  host = host.replace("\r","").replace("\n","")
  testar(host)
copyright()

#  The End