summaryrefslogtreecommitdiff
path: root/sleekxmpp/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/__init__.py')
-rw-r--r--sleekxmpp/__init__.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py
index 1cf6eac3..848fae26 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -270,22 +270,22 @@ class ClientXMPP(basexmpp, XMLStream):
#z = hashlib.md5(kd).hexdigest()
#take 3
- cnonce = "dfajoiqewoivnoeiw"
+ cnonce = ""
for i in range(12):
cnonce = cnonce + chr(random.randint(0,0xff)).decode("utf-8", "replace")
cnonce = base64.encodestring(cnonce)[0:-1]
- urp = hashlib.md5("%s:%s:%s" % (self.username, challenge["realm"], self.password) ).digest()
- a1 = "%s:%s:%s" % (urp.decode("utf-8", "replace"), challenge["nonce"], cnonce)
+ urp = md5("%s:%s:%s" % (self.username, self.domain, self.password) )
+ a1 = "%s:%s:%s" % (urp.encode, challenge["nonce"].encode(), cnonce.encode())
a2 = "AUTHENTICATE:xmpp/%s" % self.domain
responseHash = hexlify(md5("%s:%s:00000001:%s:%s:%s"
% (hexlify(md5(a1)), challenge["nonce"], cnonce, challenge["qop"], hexlify(md5(a2))) ))
print responseHash
- responseHash1 = resp(self.username, challenge["realm"], self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
- responseHash2 = resp(self.username, challenge["realm"], self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
+ responseHash1 = resp(self.username, self.domain, self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
+ responseHash2 = resp(self.username, self.domain, self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
print responseHash1
print responseHash2
- response1 = 'username="%s"%s,nonce="%s",cnonce="%s",nc=00000001,qop=auth,digest-uri="%s",response=%s' %(self.username, ',realm="%s"' % challenge['realm'], challenge["nonce"], cnonce, 'AUTHENTICATE:xmpp/%s' % self.domain, responseHash1)
- response = '''username="%s",realm="%s",nonce="%s",cnonce="%s",nc=00000001,qop=%s,digest-uri="%s",response=%s''' %(self.username, challenge["realm"], challenge["nonce"], cnonce, challenge["qop"], "AUTHENTICATE:xmpp/%s" % self.domain, responseHash1)
+ response1 = 'username="%s"%s,nonce="%s",cnonce="%s",nc=00000001,qop=auth,digest-uri="%s",response=%s' %(self.username, ',realm="%s"' % self.domain, challenge["nonce"], cnonce, 'AUTHENTICATE:xmpp/%s' % self.domain, responseHash1)
+ response = '''username="%s",realm="%s",nonce="%s",cnonce="%s",nc=00000001,qop=%s,digest-uri="%s",response=%s''' %(self.username, self.domain, challenge["nonce"], cnonce, challenge["qop"], "AUTHENTICATE:xmpp/%s" % self.domain, responseHash1)
print response
print response1
self.sendPriorityRaw("""<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>""" %base64.encodestring(response1)[:-1])