| | 1 | {{{#!python |
| | 2 | import urllib2 |
| | 3 | |
| | 4 | url = urllib2.urlopen('http://pastebin.com/raw.php?i=Kmnd6aPp') |
| | 5 | |
| | 6 | dizionario = urllib2.urlopen('https://raw.githubusercontent.com/eneko/data-repository/master/data/words.txt') |
| | 7 | |
| | 8 | for w in url: |
| | 9 | pwd = w.split(':')[1].strip() |
| | 10 | print 'Searching for ', pwd |
| | 11 | |
| | 12 | salt = pwd[0:2] |
| | 13 | |
| | 14 | import crypt |
| | 15 | |
| | 16 | for i in dizionario: |
| | 17 | x = crypt.crypt(i, salt) |
| | 18 | if x == pwd: |
| | 19 | print i, x |
| | 20 | break |
| | 21 | |
| | 22 | # La password non è nel dizionario, provo combinando lettere e numeri |
| | 23 | from itertools import combinations_with_replacement |
| | 24 | |
| | 25 | alpha = 'abcdefghijklmnopqrstuvwxyz0123456789' |
| | 26 | |
| | 27 | for i in xrange(1,8): |
| | 28 | for j in combinations_with_replacement(alpha, i): |
| | 29 | |
| | 30 | x = crypt.crypt(''.join(j),salt) |
| | 31 | if x == pwd: |
| | 32 | print ''.join(j), pwd |
| | 33 | break |
| | 34 | |
| | 35 | }}} |