Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60514

Re: Cracking hashes with Python

References <0a4ae59b-fff8-40dd-b264-823ea596ad82@googlegroups.com> <52940dbe$0$11089$c3e8da3@news.astraweb.com> <mailman.3215.1385438789.18130.python-list@python.org> <2a8225b8-da33-4db4-b83b-dcbd8a619f6c@googlegroups.com> <l72616$82k$1@ger.gmane.org>
Date 2013-11-26 14:18 +0000
Subject Re: Cracking hashes with Python
From "TheRandomPast ." <wishingforsam@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3240.1385475562.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

@RobertKern

- Teacher has taught us nothing about MD5. This being the script he wanted
us to write came as a surprise to everyone but complaints about projects
are constantly ignored. This particular teacher is complained about for
this reason every year but nothing ever changes.


This is my code. I hope it looks better? I'm sorry if it doesn't. I'm
trying to get the hang of posting by email :)

[code] import sys, re, hashlib

def dict_attack():
    hashes = raw_input('\nPlease specify hash value: ')
    chklength(hashes)

def chklength(hashes):
    if len(hashes) != 32:
        print '[-] Improper length for md5 hash.'
        sys.exit(1)


wordlist = open('C:/dictionary.txt')
try:
    words = wordlist
except(IOError):
    print "[-] Error: Check your  path.\n"
    sys.exit(1)

words = open('C:/dictionary.txt')
print "\n",len(words),"words loaded…" (This line now throws up an error
where it wasn't before: TypeError: object of type 'file' has no len()

for word in words:
    hash = hashlib.md5(word[:-1])
    value = hash.hexdigest()

if hashes == value:
    print "[+] Password is:"+word,"\n"
    sys.exit(0)


print('\n1 – Dictionary Check')
print('2 – Exit')
selection = raw_input('\nSelect an option from above: ')
sys.stdout.flush()

if selection == "1":
    dict_attack()
    pass
elif selection == "2":
    sys.exit(0)[/code]


print "\n",len(words),"words loaded…" (This line now throws up an error
where it wasn't before: TypeError: object of type 'file' has no len()
 - I'm guessing this is because it's not picking up my file but I can't see
why it shouldn't?


On Tue, Nov 26, 2013 at 1:00 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On 2013-11-26 10:30, TheRandomPast wrote:
>
>  and I've started the second part, the part to crack them. If anyone could
>> tell me where I'd find more information on this subject and how to crack
>> them that would be great.
>>
>
> What resources did your teacher give you? What have you been taught in
> class about this subject?
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma
>  that is made terrible by our own mad attempt to interpret it as though it
> had
>  an underlying truth."
>   -- Umberto Eco
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Cracking hashes with Python TheRandomPast <wishingforsam@gmail.com> - 2013-11-25 15:32 -0800
  Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-26 10:47 +1100
    Re: Cracking hashes with Python TheRandomPast <wishingforsam@gmail.com> - 2013-11-25 16:01 -0800
      Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-26 11:19 +1100
  Re: Cracking hashes with Python Steven D'Aprano <steve@pearwood.info> - 2013-11-26 02:55 +0000
    RE: Cracking hashes with Python Frank Cui <ycui@outlook.com> - 2013-11-25 23:46 -0300
      Re: Cracking hashes with Python TheRandomPast <wishingforsam@gmail.com> - 2013-11-26 02:30 -0800
        Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-26 21:39 +1100
        Re: Cracking hashes with Python "TheRandomPast ." <wishingforsam@gmail.com> - 2013-11-26 11:46 +0000
        Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-26 23:48 +1100
        Re: Cracking hashes with Python Robert Kern <robert.kern@gmail.com> - 2013-11-26 13:00 +0000
        Re: Cracking hashes with Python "TheRandomPast ." <wishingforsam@gmail.com> - 2013-11-26 14:18 +0000
          Re: Cracking hashes with Python Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-26 18:33 +0000
        Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-27 01:46 +1100
        Re: Cracking hashes with Python "TheRandomPast ." <wishingforsam@gmail.com> - 2013-11-26 15:13 +0000
        Re: Cracking hashes with Python Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-26 18:17 +0000
          Re: Cracking hashes with Python "TheRandomPast ." <wishingforsam@gmail.com> - 2013-11-26 23:06 +0000
          Re: Cracking hashes with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-27 01:04 +0000
          Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-27 13:28 +1100
          Re: Cracking hashes with Python Tim Delaney <timothy.c.delaney@gmail.com> - 2013-11-27 13:55 +1100
          Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-27 13:58 +1100
          Re: Cracking hashes with Python "TheRandomPast ." <wishingforsam@gmail.com> - 2013-11-27 12:40 +0000
            Re: Cracking hashes with Python Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-27 21:18 +0000
          Re: Cracking hashes with Python Chris Angelico <rosuav@gmail.com> - 2013-11-28 00:27 +1100
          Re: Cracking hashes with Python MRAB <python@mrabarnett.plus.com> - 2013-11-27 17:44 +0000

csiph-web