-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtool_EAP_decode.py
35 lines (31 loc) · 1.01 KB
/
tool_EAP_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
34
#!/usr/bin/env python
##################################################################
# Copyright (c) 2012, Sergej Srepfler <[email protected]>
# February 2012 -
# Version 0.3.2, Last change on Mar 01, 2014
# This software is distributed under the terms of BSD license.
##################################################################
# decoding EAP-Payload value into AVPs
import eap
import sys
import logging
if __name__ == "__main__":
# level for decoding are: DEBUG, INFO, WARNING, ERROR, CRITICAL
logging.basicConfig(level=logging.DEBUG)
eap.LoadEAPDictionary("dictEAP.xml")
msg=sys.argv[1]
#msg="01020014120A00000F020002000100000D010000"
print msg
E=eap.decode_EAP(msg)
print "="*30
print eap.getEAPCodeName(E.code)
(et,er)=eap.getEAPTypeName(E.type)
if er==0:
print "Type:",et
if E.stype!=0:
x=eap.dictEAPSUBtype2name(E.stype)
print "Subtype:",x
for avp in E.avps:
(code,data)=avp
print code,"=",data
print "-"*30