Hacking 3/12

PART 1
uname = “Mufasa”
password = “Circle Of Life”
realm = “testrealm@host.com
nonce=”dcd98b7102dd2f0e8b11d0f600bfb0c093″
uri=”/dir/index.html”
nc=”00000001″ # note this is a string
cnonce=”0a4f113b”
 
ha1 = hashlib.md5((uname+’:’+realm+’:’+password).encode(‘utf-8’)).hexdigest()
ha2 = hashlib.md5((‘GET:’+uri).encode(‘utf-8’)).hexdigest()
response = hashlib.md5((ha1+’:’+nonce+’:’+nc+’:’+cnonce+’:auth:’+ha2).encode(‘utf8’)).hexdigest()
print(response)
PART 2
from string import ascii_letters, digits
import itertools
import sys
 
for len in range(1,8):
    for letters in itertools.product(ascii_letters+digits, repeat=len):
        guess=”.join(letters)
        if happy_result(guess):
            print(‘Password found:’, guess)
            sys.exit()
print(‘Epic fail! Try harder next time.’)