Url Fuzzer con Python para Descubrir Directorios

Iniciado por BitCde, Septiembre 16, 2019, 07:56:39 PM

Tema anterior - Siguiente tema

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

Septiembre 16, 2019, 07:56:39 PM Ultima modificación: Septiembre 16, 2019, 07:59:28 PM por BitCde
¿Como va todo chicos? Espero muy bien. Ultimamente he estado un poco descuidado con python, y ayer en modo de practica decidí hacer un script muy basiquito para descubrir directorios de una url.

Espero que sea de ayuda.

Código: php

#!/usr/bin/env python3
from colorama import init, Fore
import requests

#Colors stuffs --------------------------------------------------------------
init()
class color:
        red = Fore.RED
        blue = Fore.BLUE
        green = Fore.GREEN
        yellow = Fore.YELLOW
        cyan = Fore.CYAN
        error = Fore.RED+"["+Fore.RESET+"-"+Fore.RED+"]"+Fore.RESET+" "
        adv = Fore.YELLOW+"["+Fore.RESET+"!"+Fore.YELLOW+"]"+Fore.RESET+" "
        ble = Fore.BLUE+"["+Fore.RESET+"*"+Fore.BLUE+"]"+Fore.RESET+" "
        reset = Fore.RESET
#----------------------------------------------------------------------------

header = {'User-Agent':'Mozilla/5.0'} #Set UserAgent for Requests
file = "wordlist.txt" #Wordlist Here
fuzz_url = "https://example.com/" #url Here
found_dirs = []

#----------------------------------------------------------------------------

#FUNCTION MAIN---------------------------------------------------------------

def fuzzing(url, my_wordlist):

words = []

with open(my_wordlist, 'r', encoding="latin1") as f: #Open wordlist and read all lines

for line in f:
words.append(line.rstrip('\n')) #append all words to a List (words)

for word in words:

if word == "": #in case there is an empty line

pass

else:

fuzzing_url = url + word #Append the word to our url
response = requests.get(fuzzing_url,headers=header) #Make the requests
status = response.status_code #Get the response status code

if status in range(200, 299): #Verify that the client's request was received successfully
print(fuzzing_url + color.green+" ---- Found"+color.reset)
found_dirs.append(fuzzing_url)
else:
print(fuzzing_url + color.red+" ---- Not Found"+color.reset)

#----------------------------------------------------------------------------

#fuzzing(url,wordlist)
if __name__ == "__main__":
fuzzing(fuzz_url, file)

print("\nDISCOVERED DIRECTORS:")
for i in found_dirs:
print(i+color.green+" ---- Found"+color.reset)


de todas forma dejo esto por aqui - No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

Saludos.
La mayoría de los hombres no carecen de fuerza, sino de constancia

Gran aporte y también felicitaciones por subirlo a github.

Solo tengo tres recomendaciones:
1. Este programa puede mejorarse si se incluyen las redirecciones, los estatus 3xx.
2. Se podría agregar un lista wordlist.txt en ese mismo repositorio para ahorrar algo de tiempo en buscar un diccionario.
3. Cambiar "DISCOVERED DIRECTORS" a "Directories Discovered"

Saludos...