Sha256: e5083f86243d54be36c84555522e507d7ff5525f20c7f985b655cde92fca8db1
Contents?: true
Size: 1.45 KB
Versions: 7
Compression:
Stored size: 1.45 KB
Contents
module PatronusFati::MessageProcessor::Ssid include PatronusFati::MessageProcessor def self.process(obj) # We don't care about objects that would have expired already... return if obj[:lasttime] < (Time.now.to_i - PatronusFati::SSID_EXPIRATION) ssid_info = ssid_data(obj.attributes) if %w(beacon probe_response).include?(obj[:type]) access_point = PatronusFati::DataModels::AccessPoint.first(bssid: obj[:mac]) return unless access_point # Only happens with a corrupt message ssid = PatronusFati::DataModels::Ssid.first_or_create({access_point: access_point, essid: ssid_info[:essid]}, ssid_info) ssid.update(ssid_info) access_point.seen! elsif obj[:type] == 'probe_request' client = PatronusFati::DataModels::Client.first(bssid: obj[:mac]) return if client.nil? client.seen! return if obj[:ssid].nil? || obj[:ssid].empty? client.probes.first_or_create(essid: obj[:ssid]) else # The only thing left is the 'file' type which no one seems to understand #puts ('Unknown SSID type (%s): %s' % [obj[:type], obj.inspect]) end nil end protected def self.ssid_data(attrs) { beacon_info: attrs[:beaconinfo], beacon_rate: attrs[:beaconrate], cloaked: attrs[:cloaked], crypt_set: attrs[:cryptset].map(&:to_s), essid: attrs[:ssid], max_rate: attrs[:maxrate], last_seen_at: Time.now.to_i }.reject { |_, v| v.nil? } end end
Version data entries
7 entries across 7 versions & 1 rubygems