Class: HiddenHippo::Extractors::DnsHistoryExtractor

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

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ DnsHistoryExtractor

Returns a new instance of DnsHistoryExtractor.



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

def initialize(queue)
  @queue = queue
end

Instance Method Details

#call(packet) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hidden_hippo/extractors/dns_history_extractor.rb', line 10

def call(packet)
 return unless packet.udp_dest_port == 53
 return if packet.dns_qry_name.delete(" ") == ""

 if packet.request?
   @queue << Update.new(packet.mac_src, {history: packet.dns_qry_name})
 end

 if packet.response?
   @queue << Update.new(packet.mac_dest, {history: packet.dns_qry_name})
 end

end