aboutsummaryrefslogtreecommitdiffstats
path: root/csci5271/ho2/crack2.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--csci5271/ho2/crack2.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/csci5271/ho2/crack2.py b/csci5271/ho2/crack2.py
new file mode 100644
index 0000000..5322917
--- /dev/null
+++ b/csci5271/ho2/crack2.py
@@ -0,0 +1,20 @@
+# HTTP Digest Authentication cracker
+import hashlib
+
+username = "Mufasa"
+realm = "testrealm@host.com"
+password="Circle Of Life"
+nonce = "dcd98b7102dd2f0e8b11d0f600bfb0c093"
+uri = "/dir/index.html"
+qop = "auth"
+nc = 1
+cnonce = "0a4f113b"
+response = "6629fae49393a05397450978507c4ef1"
+opaque = "5ccc069c403ebaf9f0171e9517f40e41"
+
+# Calculate the response
+ha1 = hashlib.md5((username + ":" + realm + ":" + password).encode('utf-8')).hexdigest()
+ha2 = hashlib.md5(("GET" + ":" + uri).encode('utf-8')).hexdigest()
+response = hashlib.md5((ha1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2).encode('utf-8')).hexdigest()
+
+print("Response: " + response) \ No newline at end of file