-
Notifications
You must be signed in to change notification settings - Fork 5
/
tool_Radius_decode.py
33 lines (29 loc) · 1.06 KB
/
tool_Radius_decode.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
##################################################################
# Copyright (c) 2012, Sergej Srepfler <[email protected]>
# February 2012 -
# Version 0.3, Last change on Oct 24, 2012
# This software is distributed under the terms of BSD license.
##################################################################
# Decode radius packet into individual AVPs
from libRadius import *
import sys
if __name__ == "__main__":
# level for decoding are: DEBUG, INFO, WARNING, ERROR, CRITICAL
#logging.basicConfig(level=logging.DEBUG)
LoadDictionary("dictRadius.xml")
msg=sys.argv[1]
print "="*30
H=HDRItem()
stripHdr(H,msg)
avps=splitMsgAVPs(H.msg)
print "Code=",H.Code,"Identifier=",H.Identifier,"Authenticator=",H.Authenticator
print dictCOMMANDcode2name(H.Code)
print "-"*30
for avp in avps:
print "RAW AVP",avp
print "Decoded AVP",decodeAVP(avp)
print "-"*30
######################################################
# History
# 0.3 - Oct 24, 2012 - Radius decode initial version