Class: Dap::Filter::FilterDecodeDNSVersionReply

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

Overview

Decode a DNS bind.version probe response ( zmap: dns_53.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



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dap/filter/udp.rb', line 43

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

    # XXX: This can throw an exception on bad data
    vers = r.answer.map{|x| x.txt.strip rescue nil }.reject{|x| x.nil? }.first
    return if not vers
    return { "dns_version" => vers }
  rescue ::Exception
    { }
  end
end