encrypting lines from file with md5 module doesn't work?
Nick Craig-Wood
nick at craig-wood.com
Sat Feb 14 11:32:00 EST 2009
Canned <user at domain.invalid> wrote:
> I write a small script that read lines from plain text file and encrypt
> each lines using md5 module. I have a small word list that contain 2000+
> words, 1 word/line. Using the code below, I can save the output to
> another file to use it with john the ripper (http://www.openwall.com).
>
> Here is the part that annoys me, john recognize the output as des and
> not as md5. Using the original wordlist, I tried to crack the list but
> nothing has come up after waiting for almost 9 hours. Can someone please
> tell me what did I wrong? Why john don't recognize the output as md5?
> I'm using python 2.5.1 and I'm python noob and also don't have any
> knowledge about encryption.
>
> import sys, md5
>
> f = open(sys.argv[1])
> obj = md5.new()
>
> for line in f:
> if line[-1:] == '\n':
> text = line[:-1]
> obj.update(text),
> print text + ':' + obj.hexdigest()
>
> f.close()
>
>
> 000000:670b14728ad9902aecba32e22fa4f6bd
> 00000000:c47532bbb1e2883c902071591ae1ec9b
> 111111:bf874003f752e86e6d6ba6d6df1f24a2
> 11111111:65a89de3000110bf37bcafdbd33df55a
> 121212:38a8eeb4dfb0f86aefea908365817c15
> 123123:f226a65a908909b83aed92661897d0c9
john cracks password files if I remember rightly.
md5 encoded password files don't look like that, they look like this
guest:$1$3nvOlOaw$vRWaitT8Ne4sMjf9NOrVZ.:13071:0:99999:7:::
(not a real password line!)
You need to work out how to write that format.
>From memory: the "$1" bit means it is an md5 hash, the next
"$3nvOlOaw$" is the salt and the final "$vRWaitT8Ne4sMjf9NOrVZ." is
the md5 hash in some encoded format or other! Some googling should
reveal the correct algorithm!
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list