Class: Dap::Filter::FilterDecodeMDNSSrvReply

Inherits:
Object
  • Object
show all
Includes:
BaseDecoder
Defined in:
lib/dap/filter/udp.rb

Overview

Decode a MDNS Services probe response ( zmap: mdns_5353.pkt )

Instance Attribute Summary

Attributes included from Base

#name, #opts

Instance Method Summary collapse

Methods included from BaseDecoder

#process

Methods included from Base

#initialize, #process

Instance Method Details

#decode(data) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/dap/filter/udp.rb', line 21

def decode(data)
  begin
    r = Net::DNS::Packet.parse(data)
    return if not r

    # XXX: This can throw an exception on bad data
    svcs = r.answer.map {|x| (x.value.to_s) }
    svcs.delete('')
    return if not (svcs and svcs.length > 0)
    return { "mdns_services" => svcs }
  rescue ::Exception
    { }
  end
  nil
end