Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions digestive
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
#
# ./digest.py --username conrad --wordlist /opt/john/run/password.lst --method GET --uri /digest/ --nc 00000001 --qop auth --realm Security542 --cnonce 90755b083034b34a --nonce es3UMKyKBQA=14c0d9850599ab3d69ad238ae68e7ca167ced5a2 --response f4be8f052a172cce14d8c4ab2340f25c
#
import sys,itertools,md5,argparse
import sys, itertools, md5, argparse

parser = argparse.ArgumentParser()
parser.add_argument("--username", help="Username",required=True)
parser.add_argument("--wordlist", help="Path to the wordlist",required=True)
parser.add_argument("--method", help="HTTP method,required=True")
parser.add_argument("--nonce", help="nonce",required=True)
parser.add_argument("--cnonce", help="cnonce",required=True)
parser.add_argument("--uri", help="uri",required=True)
parser.add_argument("--qop", help="qop",required=True)
parser.add_argument("--response", help="response",required=True)
parser.add_argument("--nc", help="nc",required=True)
parser.add_argument("--realm", help="realm",required=True)
parser.add_argument("--username", help="Username", required=True)
parser.add_argument("--wordlist", help="Path to the wordlist", required=True)
parser.add_argument("--method", help="HTTP method", required=True)
parser.add_argument("--nonce", help="nonce", required=True)
parser.add_argument("--cnonce", help="cnonce", required=True)
parser.add_argument("--uri", help="uri", required=True)
parser.add_argument("--qop", help="qop", required=True)
parser.add_argument("--response", help="response", required=True)
parser.add_argument("--nc", help="nc", required=True)
parser.add_argument("--realm", help="realm", required=True)
args = parser.parse_args()

wordlist=args.wordlist
wordlist = args.wordlist
nonce = args.nonce
uri = args.uri
username = args.username
Expand All @@ -40,21 +40,21 @@ nc = args.nc
qop = args.qop
cnonce = args.cnonce
response = args.response
realm=args.realm
realm = args.realm

with open(args.wordlist) as f:
with open(args.wordlist) as f:
dictionary = f.read().splitlines()

for password in dictionary:
h1 = (username+":"+realm+":"+password)
h1 = (username + ":" + realm + ":" + password)
ha1 = (md5.md5(h1).hexdigest())

h2 = (method+":"+uri)
h2 = (method + ":" + uri)
ha2 = (md5.md5(h2).hexdigest())

resp = (ha1+":"+nonce+":"+nc+":"+cnonce+":"+qop+":"+ha2)
resp = (ha1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2)
response2 = (md5.md5(resp).hexdigest())

if response2 == response:
print "Username = " + username
print "Password = " + password
print("Username = " + username)
print("Password = " + password)