View difference between Paste ID: LuPPCpjV and PxRjXkcr
SHOW: | | - or go back to the newest paste.
1
# Lista dei caratteri possibili in una password.
2
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', ".", ",", "-", "_", "@", "+"]
3
4
# Funzione che verifica se la password passata come parametro
5
# e' quella corretta e di conseguenza e' stata indovinata.
6
def testaPassword(password):
7
    # Per ora stampera' soltanto la password (in seguito
8
    # modificheremo questa funzione
9
    print password
10
    
11
# Qui bisogna supporre una lunghezza massima della password,
12
# ipotizziamo 12 caratteri.
13
# Stabiliamo anche una lunghezza minima: 4 caratteri. Di conseguenza
14
# da 4 caratteri in poi verra' testata la password (attraverso
15
# la funzione testaPassword).
16
for c1 in listaCaratteri:
17
    for c2 in listaCaratteri:
18
        for c3 in listaCaratteri:
19
            for c4 in listaCaratteri:
20
                psw = c1+c2+c3+c4   # La password da testare sara' composta dai caratteri
21
                                    # correnti ovvero c1, c2, c3, c4
22
                testaPassword(psw)
23
                for c5 in listaCaratteri:
24
                    psw = c1+c2+c3+c4+c5    # La password da testare sara' composta dai
25
                                            # caratteri correntiovvero c1, c2, c3, c4
26
                    testaPassword(psw)
27
                    for c6 in listaCaratteri:
28
                        psw = c1+c2+c3+c4+c5+c6
29
                        testaPassword(psw)
30
                        for c7 in listaCaratteri:
31
                            psw = c1+c2+c3+c4+c5+c6+c7
32
                            testaPassword(psw)
33
                            for c8 in listaCaratteri:
34
                                psw = c1+c2+c3+c4+c5+c6+c7+c8
35
                                testaPassword(psw)
36
                                for c9 in listaCaratteri:
37
                                    psw = c1+c2+c3+c4+c5+c6+c7+c8+c9
38
                                    testaPassword(psw)
39
                                    for c10 in listaCaratteri:
40
                                        psw = c1+c2+c3+c4+c5+c6+c7+c8+c9+c10
41
                                        testaPassword(psw)
42
                                        for c11 in listaCaratteri:
43
                                            psw = c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+c11
44
                                            testaPassword(psw)
45
                                            for c12 in listaCaratteri:
46
                                                psw = c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+c11+c12
47
                                                testaPassword(psw)