I am currently coding an SNMP trap listeners and decoder in C++. Because there is nearly no documentation on net-snmps trap listener, I have to code one myself. I am able to listen to port 162 and I get an output when I send a trap notification to my program.
My only problem now it to decode this data. I followed the following post, after getting strange results: how to decode the result of listenning to port 162 (Snmp Trap)?
Now I output the message data through the following for loop:
for (int i = 0; i < n; ++i) {
printf("%02x ", (unsigned char) buffer[i]);
}
This outputs data in ASN1 format:
30 5b 02 01 01 04 06 70 75 62 6c 69 63 a7 4e 02 04 52 d6 71 a3 02 01 00 02 01 00 30 40 30 0f 06 08 2b 06 01 02 01 01 03 00 43 03 03 1d 72 30 19 06 0a 2b 06 01 06 03 01 01 04 01 00 06 0b 2b 06 01 04 01 bf 08 02 03 00 01 30 12 06 0b 2b 06 01 04 01 bf 08 02 03 02 01 02 03 01 e2 40
So right now, I am not quite sure how to decode this data into something that is human readable.
Source: Windows Questions C++