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


Groups > comp.lang.python > #60509

Re: Cracking hashes with Python

References (1 earlier) <52940dbe$0$11089$c3e8da3@news.astraweb.com> <mailman.3215.1385438789.18130.python-list@python.org> <2a8225b8-da33-4db4-b83b-dcbd8a619f6c@googlegroups.com> <CAPTjJmqb7kvStwHAJp2_8_-dVxiCvPp5GL3_5ChdXxRYSK2DUw@mail.gmail.com> <CAMp65DUTg8iyTD6vCX1HB4xx95T+LaV_Bs4T9y9zCpA_f+Jmfw@mail.gmail.com>
Date 2013-11-26 23:48 +1100
Subject Re: Cracking hashes with Python
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3235.1385470140.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Nov 26, 2013 at 10:46 PM, TheRandomPast .
<wishingforsam@gmail.com> wrote:
> Thanks. From what I've been able to find online I've created a dictionary
> file with words and the words I know the hash values to be and I'm trying to
> get it to use that however when I run this I get no errors but it doesn't do
> anything, like ask me to input my hash value. Am i just being stupid?

The code you've pasted to us is a bit mangled. Can you try to post a
clean copy, please? No angle brackets in front of the lines, and
getting the indentation correct, because I think this might be your
problem:

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

The first part of the problem is that the sys.exit() call isn't
indented, so it's executed whether there's an exception thrown or not.

The second part of the problem is that you're catching an exception
only to emit a message and terminate. Don't. :) Just let the exception
happen; it'll... emit a message and terminate.

The third part of the problem is that you're bracketing the wrong part
of the code in the try/except. The simple assignment isn't going to
fail - the open call will. (Or maybe the readlines below it, but more
likely the open.)

So here's the fixed version of the above code:

words = open('C:/dictionary.txt', r)

Yep, it's really that simple. (Though there's another fragility in
what you had: the use of \d in a quoted string. It happens to have no
meaning, so it happens to work, but if you use "c:\textfile.txt",
you'll get quite the wrong result. You can double the backslash
"c:\\dictionary.txt", or you can use a raw string
r"c:\dictionary.txt", or you can use a forward slash, as I did above.)

See if that helps. If not, posting a clean copy of your current code
will help a lot.

ChrisA

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