Personal tools

pyrad

Pyrad is a full-featured RADIUS implementation for python. It provides a pythonic interface for RADIUS packets and includes RADIUS client, server and proxy code.

Here is an example of doing a authentication request:

import pyrad.packet
from pyrad.client import Client
from pyrad.dictionary import Dictionary

srv=Client(server="radius.my.domain", secret="s3cr3t",
dict=Dictionary("dicts/dictionary", "dictionary.acc"))

req=srv.CreateAuthPacket(code=pyrad.packet.AccessRequest,
User_Name="wichert", NAS_Identifier="localhost")
req["User-Password"]=req.PwCrypt("password")

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])

Requirements & Installation

pyrad requires Python 2.4 or later.

Pyrad is available as an egg i the python package index. You can install it from there by using  theeasy_install tool or download it manually from its cheeseshop page.

Document Actions

© 2007-2009 Simplon

Design and Plone theme by Web Couturier