NET-SNMP + Python Mac Address shows as \x00\ -
hey im trying mac-address via ipnettomediaphysaddress works fine when using netsnmp.snmpget command when saving variable(tuple?) , printing out via "print" mac-address looks this.
('\x00\n\xb7\x9c\x93\x80',)
code looks this,
mac = netsnmp.varbind("ipnettomediaphysaddress."+i+"."+ipadd) macadd = netsnmp.snmpget(mac, version = 2, desthost = ip, community = comm) print '%-15s' % macadd
so need do? want normal mac address.
maybe call hexlify enough
from binascii import hexlify mac = netsnmp.varbind("ipnettomediaphysaddress."+i+"."+ipadd) macadd = netsnmp.snmpget(mac, version = 2, desthost = ip, community = comm) print hexlify(macadd[0])
Comments
Post a Comment