Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'string.': 0.05; 'subject:Python': 0.06; 'assignment': 0.07; 'error:': 0.07; 'lines,': 0.07; 'problem:': 0.07; 'string': 0.09; 'correct,': 0.09; 'executed': 0.09; 'thrown': 0.09; '>try:': 0.16; 'angle': 0.16; 'backslash': 0.16; 'brackets': 0.16; 'emit': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'helps.': 0.16; 'quoted': 0.16; 'simple.': 0.16; 'terminate.': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'result.': 0.19; 'value.': 0.19; 'not,': 0.20; 'work,': 0.20; 'thanks.': 0.20; 'input': 0.22; 'print': 0.22; 'please?': 0.24; '(or': 0.24; "i've": 0.25; 'second': 0.26; 'post': 0.26; 'code:': 0.26; 'skip:" 20': 0.27; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'fixed': 0.29; 'words': 0.29; "doesn't": 0.30; 'errors': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'posting': 0.31; 'catching': 0.31; 'indentation': 0.31; 'lot.': 0.31; 'file': 0.32; 'front': 0.32; 'run': 0.32; 'another': 0.32; 'quite': 0.32; 'open': 0.33; 'not.': 0.33; 'raw': 0.33; 'third': 0.33; 'maybe': 0.34; 'problem': 0.35; 'subject:with': 0.35; 'created': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'really': 0.36; 'skip:> 10': 0.36; 'wrong': 0.37; 'being': 0.38; 'skip:o 20': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'simple': 0.61; "you're": 0.61; 'first': 0.61; "you'll": 0.62; "you've": 0.63; 'more': 0.64; 'forward': 0.65; '26,': 0.68; 'online': 0.71; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tQn2ZGDIkdNY2OLX0JQdZSArhBEn56JeSsnRS7RTLdU=; b=tdfHDXWkikAmj9PPT2XA4v8CSZjAdZDTt1pBHfiLZNbPEcCyDG1MK6TB57Dwqv64Fj /eIwvtv6/6hoVTChFdPWMir4RkrxvuUlpmur5cGv92clb92m9U7i46wYU51clQW2NjvS dcpbCO87Nlv9XLfhY94z+BAt/JQnr5j5adrXuxmHLyKOEKquaRdnXZimV1oAJmqLhylE l4fLryianIOI5yg1yhKeJoPQWuR1uvTBq5TY0tWWeus8FyfXIq5vb16DXm/1SyeL8Tgo /WJQPs7TjDw8oyCGomweXV9XDHGLJYQIdijdqYpEqBtWhHPUvcCN+O1OWeR6jMhUOJMf 4oZQ== MIME-Version: 1.0 X-Received: by 10.52.98.194 with SMTP id ek2mr25324333vdb.11.1385470137857; Tue, 26 Nov 2013 04:48:57 -0800 (PST) In-Reply-To: References: <0a4ae59b-fff8-40dd-b264-823ea596ad82@googlegroups.com> <52940dbe$0$11089$c3e8da3@news.astraweb.com> <2a8225b8-da33-4db4-b83b-dcbd8a619f6c@googlegroups.com> Date: Tue, 26 Nov 2013 23:48:57 +1100 Subject: Re: Cracking hashes with Python From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385470140 news.xs4all.nl 15870 [2001:888:2000:d::a6]:57030 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60509 On Tue, Nov 26, 2013 at 10:46 PM, TheRandomPast . 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