半径工具
pyrad的Python项目详细描述
简介
pyrad是radius客户机/服务器的实现,如rfc2865所述。 它负责所有的细节,比如建立半径包,发送 它们和解码响应。
下面是执行身份验证请求的示例:
from __future__ import print_function from pyrad.client import Client from pyrad.dictionary import Dictionary import pyrad.packet srv = Client(server="localhost", secret=b"Kah3choteereethiejeimaeziecumi", dict=Dictionary("dictionary")) # create request req = srv.CreateAuthPacket(code=pyrad.packet.AccessRequest, User_Name="wichert", NAS_Identifier="localhost") req["User-Password"] = req.PwCrypt("password") # send request reply = srv.SendPacket(req) if reply.code == pyrad.packet.AccessAccept: print("access accepted") else: print("access denied") print("Attributes returned by server:") for i in reply.keys(): print("%s: %s" % (i, reply[i]))
要求和安装
Pyrad需要Python2.6或更高版本,或Python3.2或更高版本
安装很简单;pyrad使用标准distutils系统安装 python模块:
python setup.py install