Skip to content

Instantly share code, notes, and snippets.

@vintersnow
Created December 30, 2016 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vintersnow/23f1c45a295eb990bccc6ec21a19d1c8 to your computer and use it in GitHub Desktop.
Save vintersnow/23f1c45a295eb990bccc6ec21a19d1c8 to your computer and use it in GitHub Desktop.
from hashlib import md5
# username = "q9"
# realm="secret"
# md5(username:realm:passwd)
a1 = b"c627e19450db746b739f41b64097d449"
# uri=b"/~q9/"
uri = b"/~q9/flag.html"
req = b"GET"
a2 = md5(req + b":" + uri).hexdigest()
# test
# nonce=b"bbKtsfbABAA=5dad3cce7a7dd2c3335c9b400a19d6ad02df299b"
# qop=b"auth"
# nc=b"00000001"
# cnonce=b"9691c249745d94fc"
#
# response="c3077454ecf09ecef1d6c1201038cfaf"
# res = md5(b':'.join([a1, nonce, nc, cnonce, qop, a2.encode('utf-8')])).hexdigest()
# print(res, res == response)
nonce=b"gi37b9VEBQA=f3dab70f87bd11e0f88d279815d920d2d4e01bc7"
qop=b"auth"
nc=b"00000001"
cnonce=b"c581303c1dbe7665"
res = md5(b':'.join([a1, nonce, nc, cnonce, qop, a2.encode('utf-8')])).hexdigest()
print(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment