def createPacket(self, **kwargs): vendor_id = kwargs.pop('vendor_id', 0) auth_message = message.AuthMessage(**kwargs) auth_message.vendor_id = vendor_id auth_message = mac_parse.process(auth_message) auth_message = vlan_parse.process(auth_message) return auth_message
def sendAuth(self, **kwargs): User_Password = kwargs.pop("User-Password", None) CHAP_Password = kwargs.pop("CHAP-Password", None) CHAP_Challenge = kwargs.get("CHAP-Challenge") request = message.AuthMessage(dict=self.dict, secret=self.secret, **kwargs) if User_Password: request['User-Password'] = request.PwCrypt(User_Password) if CHAP_Password: if CHAP_Challenge: request['CHAP-Challenge'] = CHAP_Challenge request['CHAP-Password'] = CHAP_Password if self.debug: log.msg("Send radius Auth Request to (%s:%s): %s" % (self.server, self.authport, request.format_str())) self.transport.write(request.RequestPacket(), (self.server, self.authport)) self.stat_push.push("requests")
def sendAuth(self, **kwargs): timeout_sec = kwargs.pop('timeout',10) User_Password = kwargs.pop("User-Password",None) CHAP_Password = kwargs.pop("CHAP-Password",None) CHAP_Password_Plaintext = kwargs.pop("CHAP-Password-Plaintext",None) CHAP_Challenge = kwargs.get("CHAP-Challenge") request = message.AuthMessage(dict=self.dict, secret=self.secret, **kwargs) if User_Password: request['User-Password'] = request.PwCrypt(User_Password) if CHAP_Password: if CHAP_Challenge: request['CHAP-Challenge'] = CHAP_Challenge request['CHAP-Password'] = CHAP_Password if CHAP_Password_Plaintext: request['CHAP-Password'] = request.ChapEcrypt(CHAP_Password_Plaintext) if self.debug: log.msg("Send radius Auth Request to (%s:%s): %s" % (self.server, self.authport, request.format_str())) self.transport.write(request.RequestPacket(), (self.server, self.authport)) self.deferrd = defer.Deferred() self.deferrd.addCallbacks(self.onResult,self.onError) reactor.callLater(timeout_sec, self.onTimeout,) return self.deferrd