예제 #1
0
 def do_start(self):
     while self.running:
         user = random.choice(self.accounts)
         reply = self.radcli.send_auth(user.account_number,utils.decrypt(user.password))
         if reply.code == packet.AccessAccept:
             reply = self.radcli.send_acct_start(user.account_number)
         
         time.sleep(random.choice(random_sleeps))
예제 #2
0
    def do_start(self):
        while self.running:
            user = random.choice(self.accounts)
            reply = self.radcli.send_auth(user.account_number,
                                          utils.decrypt(user.password))
            if reply.code == packet.AccessAccept:
                reply = self.radcli.send_acct_start(user.account_number)

            time.sleep(random.choice(random_sleeps))
예제 #3
0
 def onMessage(self, payload, isBinary):
     req_msg = None
     try:
         _msg = utils.decrypt(payload)
         req_msg = json.loads(_msg)
     except:
         log.err('decrypt message error : %s'%payload)
     
     if req_msg:
         log.msg("websocket admin request: %s"%str(req_msg))
         plugin = req_msg.get("process")
         self.radiusd.midware.process(plugin,req=req_msg,admin=self)
예제 #4
0
    def onMessage(self, payload, isBinary):
        req_msg = None
        try:
            _msg = utils.decrypt(payload)
            req_msg = json.loads(_msg)
        except:
            self.syslog.error('decrypt message error : %s' % payload)

        if req_msg:
            self.syslog.debug("websocket admin request: %s" % str(req_msg))
            plugin = req_msg.get("process")
            self.radiusd.midware.process(plugin, req=req_msg, admin=self)
def process(req=None,resp=None,user=None,radiusd=None,**kwargs):
    store = radiusd.store
    if not user:
        return error_auth(resp,'user %s not exists'%req.get_user_name())

    if not req.is_valid_pwd(utils.decrypt(user['password'])):
        return error_auth(resp,'user password not match')
        
    if user['status'] == 4:
        resp['Framed-Pool'] = store.get_param("expire_addrpool")
        return resp

    if  user['status'] in (0,2,3):
        return error_auth(resp,'user status not ok')

    return resp
예제 #6
0
def process(req=None, resp=None, user=None, radiusd=None, **kwargs):
    store = radiusd.store

    if store.is_white_roster(req.get_mac_addr()):
        return resp

    if not user:
        return error_auth(resp, "user %s not exists" % req.get_user_name())

    if store.get_param("radiusd_bypass") == "1":
        if not req.is_valid_pwd(utils.decrypt(user["password"])):
            return error_auth(resp, "user password not match")

    if user["status"] == 4:
        resp["Framed-Pool"] = store.get_param("expire_addrpool")
        return resp

    if user["status"] in (0, 2, 3):
        return error_auth(resp, "user status not ok")

    return resp
예제 #7
0
def test_encrypt_decrypt():
    utils.aescipher.setup("12345678")
    a = utils.encrypt('888888')
    assert a
    b = utils.decrypt(a)
    assert b == '888888'
예제 #8
0
def test_encrypt_decrypt():
    utils.aescipher.setup("12345678")
    a = utils.encrypt('888888')
    assert a
    b = utils.decrypt(a)
    assert b == '888888'