class Wifimap::Parser::SniffProbes

Parse the content of a sniff-probes file.

Attributes

access_points[R]

Public Class Methods

new(dump) click to toggle source

@param [String] dump

# File lib/wifimap/parser/sniff_probes.rb, line 12
def initialize(dump)
  @dump = dump
  @access_points = []
end

Public Instance Methods

stations() click to toggle source

Get the list of stations from the dump.

@return [Array] of Wifimap::Station

# 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

Private Instance Methods

unique_macs() click to toggle source

Return all unique mac addresses.

@return [Array]

# File lib/wifimap/parser/sniff_probes.rb, line 36
        def unique_macs
  dump_rows.map { |row| row.split[2] }.uniq
end