def getResponse(self): """ Method that get Response from server :return: """ from libs.svhelper import getNonce,getCredentials,getRealm,getCID # we got stuff to read off the socket buff,srcaddr = self.sock.recvfrom(8192) if buff.startswith(self.PROXYAUTHREQ): self.dstisproxy = True elif buff.startswith(self.AUTHREQ): self.dstisproxy = False if buff.startswith(self.PROXYAUTHREQ) or buff.startswith(self.AUTHREQ): nonce = getNonce(buff) cid = getCID(buff) if self.realm is None: self.realm = getRealm(buff) if None not in (nonce,self.realm): if self.reusenonce: if len(self.challenges) > 0: return else: self.staticnonce = nonce self.staticcid = cid self.challenges.append([nonce,cid]) elif buff.startswith(self.OKEY): self.passwordcracked = True _tmp = getCredentials(buff) if (_tmp is not None) and (len(_tmp) == 2): crackeduser,crackedpasswd = _tmp self.log.info("The password for %s is %s" % (crackeduser,crackedpasswd)) self.resultpasswd[crackeduser] = crackedpasswd if self.sessionpath is not None and self.dbsyncs: self.resultpasswd.sync() else: self.log.info("Does not seem to require authentication") self.noauth = True self.resultpasswd[self.username] = '[no password]' elif buff.startswith(self.NOTFOUND): self.log.warn("User not found") self.noauth = True elif buff.startswith(self.INVALIDPASS): pass elif buff.startswith(self.TRYING): pass else: self.log.error("We got an unknown response") self.log.debug(`buff`) self.nomore = True
def getResponse(self): from libs.svhelper import getNonce, getCredentials, getRealm, getCID, getAuthHeader, getQop, getAlgorithm, getOpaque # we got stuff to read off the socket buff, srcaddr = self.sock.recvfrom(8192) if buff.startswith(self.PROXYAUTHREQ): self.dstisproxy = True elif buff.startswith(self.AUTHREQ): self.dstisproxy = False if buff.startswith(self.PROXYAUTHREQ) or buff.startswith(self.AUTHREQ): authheader = getAuthHeader(buff) nonce = getNonce(authheader) opaque = getOpaque(authheader) algorithm = getAlgorithm(authheader) qop = getQop(authheader) cid = getCID(buff) if self.realm is None: self.realm = getRealm(buff) if None not in (nonce, self.realm): if self.reusenonce: if len(self.challenges) > 0: return else: self.staticnonce = nonce self.staticcid = cid self.challenges.append([nonce, cid, qop, algorithm, opaque]) elif buff.startswith(self.OKEY): self.passwordcracked = True _tmp = getCredentials(buff) if (_tmp is not None) and (len(_tmp) == 2): crackeduser, crackedpasswd = _tmp self.log.info("The password for %s is %s" % (crackeduser, crackedpasswd)) self.resultpasswd[crackeduser] = crackedpasswd if self.sessionpath is not None and self.dbsyncs: self.resultpasswd.sync() else: self.log.info("Does not seem to require authentication") self.noauth = True self.resultpasswd[self.username] = '[no password]' elif buff.startswith(self.NOTFOUND): self.log.warn("User not found") self.noauth = True elif buff.startswith(self.INVALIDPASS): pass elif buff.startswith(self.TRYING): pass else: self.log.error("We got an unknown response") self.log.debug( ` buff `) self.nomore = True