Search code examples
snmppysnmp

SNMP - Decode Hex String Value


This is my first question here, so hope it's correctly done.

Im trying to get some information from a ZTE C300 OLT. The thing is when i try to get the SN of one of the ONTS I get the response in HEX-String

snmpwalk -cpublic -v2c [OLTIP] 1.3.6.1.4.1.3902.1082.500.10.2.2.5.1.2

And this is the response that I get

SNMPv2-SMI::enterprises.3902.1082.500.10.2.2.5.1.2.285278736.1 = Hex-STRING: 5A 54 45 47 C8 79 9B 27

This is the SN that i have on the OLT ZTEGC8799B27, but im trying to convert the HEX-STRING into text and i don't get that SN text.

Indeed i have a python script for SNMP and the response that i get for that OID is

{'1.3.6.1.4.1.3902.1082.500.10.2.2.5.1.2.285278736.1': "ZTEGÈy\x9b'"}

Can someone give me a hand on this?. I'm new on SNMP and this is giving me some headache. Thanks in advace!


Solution

  • Indeed it was easier. The firts 4 bytes were encoded, and the other 4 is the actual serial number splitted every 2 digits. So i only need to decode the first part and concatenate the rest.