Buenos días, tardes o noches, compañerxs!
Hacía ya un tiempo que no escribía ningún post en el foro por culpa de los estudios. Pero es lo que toca jeje
Hoy os traigo un script que permite encontrar directorios interesantes de una web. Sólo se necesitan dos cosas, el script y un diccionario.
#!/usr/bin/python
import os, sys
try:
import requests
except:
print "[!]Requests module not found. Try to (re)install it.\n[!]pip install requests"
try:
from termcolor import colored
except:
print "[!]Termcolor module not found. Try to (re)install it.\n[!]pip install termcolor"
oks = []
print("EASY DIRBUSTER!")
def parser():
#URL
flag = False
while ( flag == False ):
url = raw_input("Insert an URL (with HTTP:// or HTTPS://)\n\tURL: ")
if (url.startswith("http://")):
flag = True
elif (url.startswith("https://")):
flag = True
else:
pass
#PATH
flag = False
while ( flag == False ):
path = raw_input("Insert path to File (ex: /root/wordlists/list.txt)\n\tPATH: ")
if (os.path.isfile(path)):
flag = True
else:
pass
return url, path
def requester(url, fpath):
if (requests.get(url).status_code != 200):
return 0
else:
with open(fpath) as f:
for path in f:
temp = url + "/" + str(path).replace("\n","") + "/"
r = requests.get(temp)
if (r.status_code == 200):
print colored(("[!] " + str(r.status_code) + " OK!! -> " + temp), 'green')
oks.append(str(temp))
elif (r.status_code == 403):
print colored(("[!] " + str(r.status_code) + " Forb -> " + temp), 'yellow')
else:
print colored(("[!] " + str(r.status_code) + " NotF -> " + temp), 'red')
return 1
url, path = parser()
#print url + path
if (requester(url, path) == 0):
print "Error. URL not available."
else:
print "200 OK Requested sites: "
for ok in oks:
print "\t" + ok
print "Finished Successfully!"
PoC:
(http://preview.ibb.co/ePaC7x/01.png)
No es muy complicado pero es bastante útil. Y tampoco creo que sea necesario explicarlo en detalle.
Para más información visitad este enlace https://en.wikipedia.org/wiki/List_of_HTTP_status_codes (https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
Pd: El otro día me recomendaron Siddhartha, de Hermann Hesse. Es muy interesante el libro. Os lo recomiendo si tenéis un rato :)