예제 #1
0
 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
예제 #2
0
    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")
예제 #3
0
파일: client.py 프로젝트: prownsix/txradius
    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