Class: Dap::Filter::FilterDecodeSNMPGetReply
- Inherits:
-
Object
- Object
- Dap::Filter::FilterDecodeSNMPGetReply
- Includes:
- BaseDecoder
- Defined in:
- lib/dap/filter/udp.rb
Overview
Decode a SNMP GET probe response ( zmap: snmp1_161.pkt )
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
Methods included from BaseDecoder
Methods included from Base
Instance Method Details
#decode(data) ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/dap/filter/udp.rb', line 146 def decode(data) asn = OpenSSL::ASN1.decode(data) rescue nil return if not asn snmp_error = asn.value[0].value rescue nil snmp_comm = asn.value[1].value rescue nil snmp_data = asn.value[2].value[3].value[0] rescue nil snmp_oid = snmp_data.value[0].value rescue nil snmp_info = snmp_data.value[1].value rescue nil return if not (snmp_error and snmp_comm and snmp_data and snmp_oid and snmp_info) snmp_info = snmp_info.to_s.gsub(/\s+/, ' ').gsub(/[\x00-\x1f]/, ' ') return if not snmp_info { 'snmp_value' => snmp_info } end |