Class: Wifimap::Parser::Airodump

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

Overview

Parse the content of an airodump.csv file.

Instance Method Summary collapse

Methods included from Wifimap::Parsable

#dump, #dump_rows

Constructor Details

#initialize(dump) ⇒ Airodump

Returns a new instance of Airodump.



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

def initialize(dump)
  @dump = dump
end

Instance Method Details

#access_pointsArray

Get the list of access points from the dump.

Returns:

  • (Array)

    of Wifimap::AccessPoint



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/wifimap/parser/airodump.rb', line 16

def access_points
  dump_row_fields
    .filter { |row| valid_access_point?(row) }
    .map do |fields|
      AccessPoint.new(
        bssid: fields.first,
        privacy: fields[5].strip,
        essid: fields[13].strip
      )
    end
end

#stationsArray

Get the list of stations from the dump.

Returns:

  • (Array)

    of Wifimap::Station



31
32
33
34
35
36
37
38
39
40
# File 'lib/wifimap/parser/airodump.rb', line 31

def stations
  dump_row_fields
    .filter { |row| valid_station?(row) }
    .map do |fields|
      station = Station.new(mac: fields.first)
      station.associations << fields[5].strip unless fields[5].include?('(not associated)')
      station.probes << fields[6].strip unless fields[6].strip.empty?
      station
    end
end