| 1 | {{{#!python |
| 2 | |
| 3 | import urllib2 |
| 4 | import crypt |
| 5 | |
| 6 | PWDS = urllib2.urlopen("http://homes.di.unimi.it/~sisop/lucidi1516/shadow") |
| 7 | |
| 8 | passwords = [] |
| 9 | usernames = [] |
| 10 | for i in PWDS: |
| 11 | passwords.append(i.split(':')[1].strip()) |
| 12 | usernames.append(i.split(':')[0].strip()) |
| 13 | |
| 14 | p = passwords[0].split('$') |
| 15 | |
| 16 | def decritta(sale, pwd): |
| 17 | print sale, pwd |
| 18 | count = 0 |
| 19 | d = urllib2.urlopen("https://raw.githubusercontent.com/eneko/data-repository/master/data/words.txt") |
| 20 | for w in d: |
| 21 | count += 1 |
| 22 | h = crypt.crypt(w.strip().lower(), "$6$" + sale ) |
| 23 | if h.strip() == ("$6$" + sale + "$"+ pwd).strip(): |
| 24 | print "Trovata!" |
| 25 | print w |
| 26 | break |
| 27 | if count % 1000 == 0: print count, w.strip(), h |
| 28 | |
| 29 | for w in usernames: |
| 30 | wr = list(w[:]) |
| 31 | wr.reverse() |
| 32 | wr = "".join(wr) |
| 33 | for x in [w, wr]: |
| 34 | h = crypt.crypt(x.strip().lower(), "$6$" + sale ) |
| 35 | if h.strip() == ("$6$" + sale + "$"+ pwd).strip(): |
| 36 | print "Trovata!" |
| 37 | print x |
| 38 | break |
| 39 | |
| 40 | |
| 41 | salt = p[2] |
| 42 | pwd = p[3] |
| 43 | |
| 44 | decritta(salt, pwd) |
| 45 | |
| 46 | |
| 47 | }}} |