Class: HiddenHippo::Reader

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

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Reader

Returns a new instance of Reader.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/hidden_hippo/reader.rb', line 19

def initialize(file)
  @file = file
  updator_queue = Queue.new
  @updator = Updator.new updator_queue
  @scanners = []
  @scanners << Scanner.new(file, Packets::Dns,
                           Extractors::MdnsHostnameExtractor.new(updator_queue),
                           Extractors::DnsHistoryExtractor.new(updator_queue),
                           Extractors::DnsLlmnrExtractor.new(updator_queue))
  @scanners << Scanner.new(file, Packets::Dhcp,
                           Extractors::DhcpHostnameExtractor.new(updator_queue))
  @scanners << Scanner.new(file, Packets::Http,
                           Extractors::HttpRequestUrlExtractor.new(updator_queue))
  @scanners << Scanner.new(file, Packets::Wps,
                           Extractors::WpsExtractor.new(updator_queue))
end

Instance Method Details

#callObject



36
37
38
39
40
# File 'lib/hidden_hippo/reader.rb', line 36

def call
  @updator.start
  @scanners.each &:call
  @updator.stop
end