Class: Wifimap::Parser::SniffProbes

Inherits:
Object
  • Object
show all
Includes:
Wifimap::Parsable
Defined in:
lib/wifimap/parser/sniff_probes.rb

Overview

Parse the content of a sniff-probes file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Wifimap::Parsable

#dump, #dump_rows

Constructor Details

#initialize(dump) ⇒ SniffProbes

Returns a new instance of SniffProbes.

Parameters:

  • dump (String)


12
13
14
15
# File 'lib/wifimap/parser/sniff_probes.rb', line 12

def initialize(dump)
  @dump = dump
  @access_points = []
end

Instance Attribute Details

#access_pointsObject (readonly)

Returns the value of attribute access_points.



9
10
11
# File 'lib/wifimap/parser/sniff_probes.rb', line 9

def access_points
  @access_points
end

Instance Method Details

#stationsArray

Get the list of stations from the dump.

Returns:

  • (Array)

    of Wifimap::Station



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wifimap/parser/sniff_probes.rb', line 20

def stations
  unique_macs.map do |mac|
    station = Station.new(mac: mac)
    dump_rows.each do |row|
      fields = row.split('"')
      unless station.probes.include?(fields[1])
        station.probes << fields[1] if fields[0].include?(mac)
      end
    end
    station
  end
end