Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- # Stringa da decriptare, puoi inserire qualsiasi hash MD5 tu voglia
- hashDaDecriptare = "74efb8aac68e37c289dfcf260e19ab25"
- # Lista dei caratteri possibili in una password.
- listaCaratteri = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ".", ",", "-", "_", "@", "+"]
- # Funzione che verifica se la password passata come parametro
- # e' quella corretta e di conseguenza e' stata indovinata.
- def testaPassword(password):
- m = hashlib.md5()
- m.update(password)
- if (m.hexdigest() == hashDaDecriptare):
- print "Password trovata:", password
- exit()
- # Qui bisogna supporre una lunghezza massima della password,
- # ipotizziamo 12 caratteri.
- # Stabiliamo anche una lunghezza minima: 4 caratteri. Di conseguenza
- # da 4 caratteri in poi verra' testata la password (attraverso
- # la funzione testaPassword).
- for c1 in listaCaratteri:
- for c2 in listaCaratteri:
- for c3 in listaCaratteri:
- for c4 in listaCaratteri:
- psw = c1+c2+c3+c4 # La password da testare sara' composta dai caratteri
- # correnti ovvero c1, c2, c3, c4
- testaPassword(psw)
- for c5 in listaCaratteri:
- psw = c1+c2+c3+c4+c5 # La password da testare sara' composta dai
- # caratteri correntiovvero c1, c2, c3, c4
- testaPassword(psw)
- for c6 in listaCaratteri:
- psw = c1+c2+c3+c4+c5+c6
- testaPassword(psw)
- for c7 in listaCaratteri:
- psw = c1+c2+c3+c4+c5+c6+c7
- testaPassword(psw)
- for c8 in listaCaratteri:
- psw = c1+c2+c3+c4+c5+c6+c7+c8
- testaPassword(psw)
- for c9 in listaCaratteri:
- psw = c1+c2+c3+c4+c5+c6+c7+c8+c9
- testaPassword(psw)
- for c10 in listaCaratteri:
- psw = c1+c2+c3+c4+c5+c6+c7+c8+c9+c10
- testaPassword(psw)
- for c11 in listaCaratteri:
- psw = c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+c11
- testaPassword(psw)
- for c12 in listaCaratteri:
- psw = c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+c11+c12
- testaPassword(psw)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement