<div dir="ltr"><div dir="ltr" style="font-family:arial,sans-serif;font-size:13px">This is my code<div><br></div><div><div>import md5</div><div>import sys</div><div class="im"><div><br></div><div>def chklength(hashes):</div>
<div>    if len(hashes) != 32:</div><div>        print '[-] Improper length for md5 hash.'</div><div>        sys.exit(1)</div></div><div>characters=range(48,57)+range(65,90)+range(97,122)</div><div>def checkPassword(password):</div>
<div>    #print password</div><div>    m = md5.new(password)</div><div>    if (m.hexdigest() == hash):</div><div>        print "match [" + password + "]"</div><div>        sys.exit()</div><div> </div><div>
def recurse(width, position, baseString):</div><div>    for char in characters:</div><div>        if (position < width - 1):</div><div>            recurse(width, position + 1, baseString + "%c" % char)</div><div>
        checkPassword(baseString + "%c" % char)</div><div>        print "Target Hash [" + hash+ " string: "+ baseString  </div><div>def brute_force():</div><div>    maxChars = 32</div><div>    for baseWidth in range(1, maxChars + 1):</div>
<div>        print "checking passwords width [" + `baseWidth` + "]" </div><div>        recurse(baseWidth, 0, "")</div><div>def dictionary():</div><div>    for line in File.readlines():</div><div>
        checkPassword(line.strip('\n'))</div><div>hash =raw_input("Input MD5 hash:")</div><div>option=input("Choose method:1=Brute Force; 0=Dictionary")</div><div>if(option==1):</div><div>    chklength()</div>
<div>    brute_force()</div><div>else:</div><div>    if(option==0):</div><div>        File=open("dict.txt")</div><div>        chklength()</div><div>        dictionary()</div><div>    else:</div><div>        print "You picked wrong!"</div>
</div><div><br></div><div>IT WORKS! ...(Almost) My chklength isn't working. Can anyone see why not? I'm stumped. </div></div><div class="" style="font-family:arial,sans-serif;font-size:13px"><div id=":yw" class="" tabindex="0">
<img class="" src="https://mail.google.com/mail/images/cleardot.gif" style=""></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 26, 2013 at 6:17 PM, Denis McMahon <span dir="ltr"><<a href="mailto:denismfmcmahon@gmail.com" target="_blank">denismfmcmahon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, 26 Nov 2013 02:30:03 -0800, TheRandomPast wrote:<br>
<br>
>>    for value in values:<br>
>         print value<br>
<br>
</div>..........^^^^^^^^^^^<br>
<br>
so change this to:<br>
          crackMD5Hash( value )<br>
<br>
>> import hashlib<br>
>> def crackMD5Hash():<br>
<br>
Nah ....<br>
<br>
def crackMD5Hash( hash ):<br>
        print "cracking hash:", hash<br>
        some code goes here ...<br>
        print "original string was:", result<br>
<br>
Algorithms for cracking md5 hashes is not a python topic, but rather a<br>
cryptography topic. When you find an algorithm to use, then if you have<br>
trouble converting it into code we may be able to help with that bit.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Denis McMahon, <a href="mailto:denismfmcmahon@gmail.com">denismfmcmahon@gmail.com</a><br>
--<br>
<a href="https://mail.python.org/mailman/listinfo/python-list" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div>