Class: HiddenHippo::Extractors::MdnsHostnameExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/hidden_hippo/extractors/mdns_hostname_extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ MdnsHostnameExtractor

Returns a new instance of MdnsHostnameExtractor.



6
7
8
# File 'lib/hidden_hippo/extractors/mdns_hostname_extractor.rb', line 6

def initialize(queue)
  @queue = queue
end

Instance Method Details

#call(packet) ⇒ Object



10
11
12
13
14
15
# File 'lib/hidden_hippo/extractors/mdns_hostname_extractor.rb', line 10

def call(packet)
  return unless packet.udp_dest_port == 5353
  return unless packet.response?

  @queue << Update.new(packet.mac_src, {hostname: packet.ptr})
end