Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'elif': 0.05; 'subject:Python': 0.06; 'error:': 0.07; 'great.': 0.07; 'part,': 0.09; 'sys,': 0.09; 'throws': 0.09; 'try:': 0.09; 'cc:addr:python- list': 0.11; 'def': 0.12; '"2":': 0.16; '"i': 0.16; 'better?': 0.16; 'complained': 0.16; 'guessing': 0.16; 'hashes': 0.16; 'hashlib': 0.16; 'improper': 0.16; 'kern': 0.16; 'md5': 0.16; 'sys.exit(0)': 0.16; 'sys.exit(1)': 0.16; 'typeerror:': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'trying': 0.19; '8bit%:5': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'error': 0.23; 'interpret': 0.24; 'specify': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'script': 0.25; 'second': 0.26; 'pass': 0.26; 'skip:" 20': 0.27; 'header:In-Reply- To:1': 0.27; '(this': 0.29; 'words': 0.29; '8bit%:3': 0.30; 'ignored.': 0.30; 'robert': 0.30; 'skip:@ 10': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'posting': 0.31; 'you?': 0.31; 'anyone': 0.31; 'file': 0.32; 'class': 0.32; 'selection': 0.32; 'option': 0.32; 'url:python': 0.33; 'everyone': 0.33; 'skip:& 30': 0.33; "i'd": 0.34; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'picking': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'being': 0.38; 'skip:o 20': 0.38; 'skip:& 10': 0.38; '8bit%:4': 0.38; 'nov': 0.38; 'pm,': 0.38; '8bit%:6': 0.40; 'url:mail': 0.40; 'how': 0.40; 'tell': 0.60; 'hope': 0.61; 'length': 0.61; 'skip:o 30': 0.61; 'information': 0.63; 'our': 0.64; 'more': 0.64; 'charset:windows-1252': 0.65; 'world': 0.66; 'hang': 0.67; 'believe': 0.68; '26,': 0.68; 'subject': 0.69; 'surprise': 0.74; '1:00': 0.84; 'eco': 0.84; 'terrible': 0.84; 'to:none': 0.92; 'taught': 0.96; '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:cc :content-type; bh=KnlrCxriXS6sqmDhUoZOh5u4QCo9RWH2ypmb3a6JWbs=; b=nBxXo7ItXsWjCnZh0SQzbfFyJQLFK9QPCuf3/kFDWh4jnH5Ar743LSEVKVihnRvdpK EkqomRR5XVwUtlj5h83lNoC6GJ2U+HKSlcl/1MT9UkR7H63rwqJGdBcSBfmpJnxnD9r0 gbNW2kaQilAMdOS+9Vt21yRts6qpRq/c1kOQZpI4KHpZvLYhABnu/4DehSMz5XdZ7282 haC/FM1nmrbPVjFrvBcrA9nMAArL+S2Sr2lEFy4TDOEirhg8GsksdpySKQya7odSlm/G ITvDw0y0J7mPUOr7llTXeHsgx3ifV2rwMxaQ7TVxq6lslc2zOCK0QXZcobYVV/qnSqaE Oc0Q== MIME-Version: 1.0 X-Received: by 10.180.160.212 with SMTP id xm20mr18300332wib.33.1385475513425; Tue, 26 Nov 2013 06:18:33 -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 14:18:33 +0000 Subject: Re: Cracking hashes with Python From: "TheRandomPast ." Cc: python-list@python.org Content-Type: multipart/alternative; boundary=047d7b624d34d2a64804ec152702 X-Mailman-Approved-At: Tue, 26 Nov 2013 15:19:21 +0100 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: 171 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385475562 news.xs4all.nl 15974 [2001:888:2000:d::a6]:45735 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60514 --047d7b624d34d2a64804ec152702 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable @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 =3D raw_input('\nPlease specify hash value: ') chklength(hashes) def chklength(hashes): if len(hashes) !=3D 32: print '[-] Improper length for md5 hash.' sys.exit(1) wordlist =3D open('C:/dictionary.txt') try: words =3D wordlist except(IOError): print "[-] Error: Check your path.\n" sys.exit(1) words =3D open('C:/dictionary.txt') print "\n",len(words),"words loaded=85" (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 =3D hashlib.md5(word[:-1]) value =3D hash.hexdigest() if hashes =3D=3D value: print "[+] Password is:"+word,"\n" sys.exit(0) print('\n1 =96 Dictionary Check') print('2 =96 Exit') selection =3D raw_input('\nSelect an option from above: ') sys.stdout.flush() if selection =3D=3D "1": dict_attack() pass elif selection =3D=3D "2": sys.exit(0)[/code] print "\n",len(words),"words loaded=85" (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 wrote: > On 2013-11-26 10:30, TheRandomPast wrote: > > and I've started the second part, the part to crack them. If anyone coul= d >> 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 i= t > had > an underlying truth." > -- Umberto Eco > > -- > https://mail.python.org/mailman/listinfo/python-list > --047d7b624d34d2a64804ec152702 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
@RobertKern=A0
=A0
- Teacher has taught us n= othing about MD5. This being the script he wanted us to write came as a sur= prise to everyone but complaints about projects are constantly ignored. Thi= s particular teacher is complained about for this reason every year but not= hing ever changes.=A0


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 :)=A0

[code] import sys, re, hashli= b

def dict_attack():
=A0 =A0 hashes =3D raw_inp= ut('\nPlease specify hash value: ')
=A0 =A0 chklength(has= hes)

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


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

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

for word in words:
=A0 =A0 hash =3D hashlib.m= d5(word[:-1])
=A0 =A0 value =3D hash.hexdigest()

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


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

if selection =3D=3D "1&quo= t;:
=A0 =A0 dict_attack()
=A0 =A0 pass
elif s= election =3D=3D "2":
=A0 =A0 sys.exit(0)[/code]


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


On Tue,= Nov 26, 2013 at 1:00 PM, Robert Kern <robert.kern@gmail.com> wrote:
On 2013-11-26 10:30, TheRa= ndomPast wrote:

and I've started the second part, the part to crack them. If anyone cou= ld tell me where I'd find more information on this subject and how to c= rack them that would be great.

What resources did your teacher give you? What have you been taught in clas= s about this subject?

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless = enigma
=A0that is made terrible by our own mad attempt to interpret it as though i= t had
=A0an underlying truth."
=A0 -- Umberto Eco

--
https://mail.python.org/mailman/listinfo/python-list

--047d7b624d34d2a64804ec152702--