I'm creating a SNMP program to list interfaces (with ip, mask and mac) of devices. I'm using NetSnmp to get the macaddress but the output looks like this ('\x00PV\xaf\x00v',)
This is the SNMP request:
oidmac = netsnmp.Varbind("ifPhysAddress."+i)
mac = netsnmp.snmpget(
oidmac,
Version = 2,
DestHost = sys.argv[2],
Community = sys.argv[1])
Info about the code ...
sys.argv[1]
= Community stringsys.argv[2]
= IP of the SNMP agenti
= a variable with the interface ID.
How can I convert the string to an MAC address in format aa:bb:cc:dd:11:22
?