elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  Buscador Exploit-Db V1.0 [Python]
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Buscador Exploit-Db V1.0 [Python]  (Leído 2,479 veces)
isseu


Desconectado Desconectado

Mensajes: 325


°º¤ø,¸¸,El conocimiento es poder°º¤ø,¸¸,ø¤º°`°º¤ø,


Ver Perfil WWW
Buscador Exploit-Db V1.0 [Python]
« en: 9 Mayo 2010, 04:51 am »

Un buscador que hice en python, gracias a la idea de otro post de este foro
Con este script puedes facilmente navegar/descargar y ejecutar exploit de exploit-db
Creo que todavia le queda mucho por mejorar.
Para  linux y windows
Pastebin: http://isseu.pastebin.com/G9xh7XDV
Download: http://isseu.pastebin.com/download.php?i=G9xh7XDV

Searchedb.PY
Código
  1. #!/usr/bin/env python
  2. import urllib2
  3. import re
  4. import os
  5. import string
  6.  
  7. def Verde(a):
  8. if os.name=="posix": #linux
  9. return "\033[32m"+a+"\033[0m"
  10. else:
  11. return a
  12. def Rojo(a):
  13. if os.name=="posix": #linux
  14. return "\33[31m"+a+"\033[0m"
  15. else:
  16. return a
  17. def Limpiar():
  18. if os.name=="posix":
  19. os.system("clear") #linux
  20. else:
  21. os.system("cls") #windows
  22. def sisalir(a):
  23. if string.upper(input) =="QUIT":
  24. exit(0)
  25. def GetWeb(web):
  26. source=string
  27. try:
  28.     source=urllib2.urlopen(web)
  29. except urllib2.HTTPError, e:  
  30.     print Rojo("[!] Error HTTP")
  31.     print Rojo(e.code)
  32.     exit(0)  
  33. except urllib2.URLError, e:  
  34.     print Rojo("[!] Error URL")
  35.     print Rojo(e.reason)
  36.     exit(0)
  37. return source.read()
  38. def extension(archivo):
  39. return archivo[archivo.rfind(".")+1:len(archivo)]
  40. def Ejecutar(path):
  41. print "";
  42. type=extension(path)
  43. if type=="py":
  44. print Rojo("[#] system(\"python "+path+")\"")
  45. os.system("python "+path);
  46. print Rojo("[#] Finish")
  47. if type=="pl":
  48. print Rojo("[#] system(\"perl "+path+")\"")
  49. os.system("perl "+path);
  50. print Rojo("[#] Finish")
  51. print ""
  52. def FileType(web):
  53. try:
  54.     web=urllib2.urlopen(urllib2.Request(web))
  55. except urllib2.HTTPError, e:  
  56.     print Rojo("[!] Error HTTP")
  57.     print Rojo(e.code)
  58.     exit(0)  
  59. except urllib2.URLError, e:  
  60.     print Rojo("[!] Error URL")
  61.     print Rojo(e.reason)
  62.     exit(0)
  63. info=str(web.info())
  64. info=re.search("filename=\d+\.(txt|py|pl|cpp|c|jar)",info).group()
  65. info=re.search("txt|py|pl|cpp|c|jar",info).group()
  66. return info
  67. def ExploitDB(input,page=0):
  68. print "";
  69. sitio = "http://www.exploit-db.com/list.php?page="+str(page)+"&description="+input+"&author=&platform=&type=&port=&osvdb=&cve="
  70. source = GetWeb(sitio)
  71. urls=re.findall("href=\'/exploits/\d+",source)
  72. numerop=re.findall("href='/list.php?page=\d+&description="+input+"&platform=&type=&port=&author=&osvdb=&cve='>\d+</a>",source)
  73. names=re.findall("target=_blank>.*</a>",source)
  74. print Verde("[+]")+" Hay "+str(len(names))+" Resultados (+"+Verde(str(len(numerop)))+" paginas):"
  75. print "";
  76. if len(names)>=1:
  77. for i in range(len(names)):
  78. name=names[i]
  79. name=name[14:len(name)-4]
  80. print "["+str(i+1)+"] "+name
  81. valor=raw_input(Verde("[?]")+" Ingrese Id exploit a ver (0 = Siguiente pagina; -1= Buscar Otra Cosa)\n-->")
  82. sisalir(valor);
  83. if string.atoi(valor)<=0:
  84. if string.atoi(valor)==0:
  85. ExploitDB(input,(page+1))
  86. if string.atoi(valor)==2:
  87. return;
  88. else:
  89. subs=urls[string.atoi(valor)-1]
  90. subs=subs[16:len(subs)]
  91. sitio="http://www.exploit-db.com/download/"+subs;
  92. tipo=FileType(sitio)
  93. name=names[i]
  94. name=name[14:len(name)-4]
  95. print "";
  96. print Verde("[+]")+" Exploit Seleccionado:";
  97. print "[ID] #" + subs + ":"
  98. print "[Nombre] " + name
  99. print "[Url] " + sitio
  100. print "[Leng] " + tipo
  101. descargado=False
  102. while (True) or ((string.atoi(valor) > 0) and (string.atoi(valor) < 4)):
  103. if descargado:
  104. valor=raw_input(Verde("[?]")+"Opciones: (1) Ver (2) Descargar (3) Volver Atras (4) Ejecutar\n-->")
  105. else:
  106. valor=raw_input(Verde("[?]")+"Opciones: (1) Ver (2) Descargar (3) Volver Atras\n-->")
  107. sisalir(input);
  108. if string.atoi(valor)==1:
  109. print ""
  110. print "";
  111. source = GetWeb(sitio)
  112. print source;
  113. if string.atoi(valor)==2:
  114. print ""
  115. source = GetWeb(sitio)
  116. subs=subs+"."+FileType(sitio)
  117. FILE = open(subs,"w")
  118. FILE.write(source);
  119. FILE.close();
  120. print Verde("[+]")+" Guardado Como: "+os.curdir+"/"+subs
  121. if (extension(subs)=="pl") or (extension(subs)=="py"):
  122. descargado=True
  123. if string.atoi(valor)==3:
  124. ExploitDB(input,page)
  125. break;
  126. if (string.atoi(valor)==4) and (descargado==True):
  127. Ejecutar(subs)
  128. break;
  129. else:
  130. print Rojo("[!]")+" No hay Resultados Para mostrar"
  131.  
  132.  
  133. if __name__ == "__main__":
  134. Limpiar()
  135. print "   ########################"
  136. print "   # "+Rojo("Buscador De Exploits")+" #"
  137. print "   # "+Rojo("De Exploit-db.com")+" ####"
  138. print "   # "+Rojo("Por Isseu")+" ############"
  139. print "   ################# "+Verde("V1.0")+" #"
  140. print ""
  141. while True:
  142. input = raw_input(Verde("[?]")+" Ingrese Nombre de la Aplicacion a Buscar ("+Rojo("Quit")+" para salir)\n-->");
  143. sisalir(input);
  144. print Verde("[+]")+" Buscando "+input+" en ExploitDB [...]";
  145. ExploitDB(input)
  146.  
  147.  
  148.  


« Última modificación: 9 Mayo 2010, 05:14 am por isseu » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Python] Buscador de sueños 0.1
Scripting
BigBear 0 1,555 Último mensaje 4 Abril 2012, 18:24 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines