patronus_fati 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/patronus_fati/data_models/access_point.rb +3 -17
- data/lib/patronus_fati/data_models/client.rb +1 -15
- data/lib/patronus_fati/data_models/ssid.rb +1 -1
- data/lib/patronus_fati/message_processor/bssid.rb +0 -3
- data/lib/patronus_fati/message_processor/client.rb +0 -3
- data/lib/patronus_fati/message_processor.rb +2 -2
- data/lib/patronus_fati/version.rb +1 -1
- data/lib/patronus_fati.rb +0 -4
- metadata +2 -6
- data/lib/patronus_fati/data_models/ap_frequency.rb +0 -14
- data/lib/patronus_fati/data_models/ap_signal.rb +0 -12
- data/lib/patronus_fati/data_models/client_frequency.rb +0 -14
- data/lib/patronus_fati/data_models/client_signal.rb +0 -12
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f846c13ed96d628de8bb8f4cc5d4db5dba18a18f
         | 
| 4 | 
            +
              data.tar.gz: 213e462efeca90304442a3cdd0567d788e0c5e44
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c01c8e041b55e645506de4c3d1004afe258d19dd8208cc3b1e1f0e3b5a175fa387491fe8420cbcfdcfacc2a78d9ecc85a9aa2af432893b8fd5f4356b09dae912
         | 
| 7 | 
            +
              data.tar.gz: 65fe59c2a5c91caa39d25c8aa1b8c7e9024a157f4e0af4159765b212ce61054baf0dbb20875db24cdd99732f6cf461649df98510aaf8444d9c810ac42b63f30d
         | 
| @@ -7,9 +7,9 @@ module PatronusFati::DataModels | |
| 7 7 |  | 
| 8 8 | 
             
                property  :id,                Serial
         | 
| 9 9 |  | 
| 10 | 
            -
                property  :bssid,             String, :length | 
| 11 | 
            -
                                                      :required | 
| 12 | 
            -
                                                      : | 
| 10 | 
            +
                property  :bssid,             String, :length       => 17,
         | 
| 11 | 
            +
                                                      :required     => true,
         | 
| 12 | 
            +
                                                      :unique_index => true
         | 
| 13 13 |  | 
| 14 14 | 
             
                property  :channel,           Integer
         | 
| 15 15 | 
             
                property  :max_seen_rate,     Integer
         | 
| @@ -31,8 +31,6 @@ module PatronusFati::DataModels | |
| 31 31 | 
             
                has n, :connections,    :constraint => :destroy,
         | 
| 32 32 | 
             
                                        :child_key  => :access_point_id
         | 
| 33 33 | 
             
                has n, :ssids,          :constraint => :destroy
         | 
| 34 | 
            -
                has n, :ap_frequencies, :constraint => :destroy
         | 
| 35 | 
            -
                has n, :ap_signals,     :constraint => :destroy
         | 
| 36 34 |  | 
| 37 35 | 
             
                belongs_to :mac, :required => false
         | 
| 38 36 | 
             
                before :save do
         | 
| @@ -63,20 +61,8 @@ module PatronusFati::DataModels | |
| 63 61 | 
             
                      active: active?,
         | 
| 64 62 | 
             
                      connected_clients: connected_clients.map(&:bssid),
         | 
| 65 63 | 
             
                      vendor: mac.vendor,
         | 
| 66 | 
            -
                      signal_dbm: (ap_signals.any? ? ap_signals.last.dbm : nil),
         | 
| 67 64 | 
             
                      ssids: current_ssids.map(&:full_state)
         | 
| 68 65 | 
             
                    )
         | 
| 69 66 | 
             
                end
         | 
| 70 | 
            -
             | 
| 71 | 
            -
                def record_signal(dbm)
         | 
| 72 | 
            -
                  PatronusFati::DataModels::ApSignal.create(access_point: self, dbm: dbm)
         | 
| 73 | 
            -
                end
         | 
| 74 | 
            -
             | 
| 75 | 
            -
                def update_frequencies(freq_hsh)
         | 
| 76 | 
            -
                  freq_hsh.each do |freq, packet_count|
         | 
| 77 | 
            -
                    f = ap_frequencies.first_or_create({mhz: freq}, {packet_count: packet_count})
         | 
| 78 | 
            -
                    f.update({packet_count: packet_count})
         | 
| 79 | 
            -
                  end
         | 
| 80 | 
            -
                end
         | 
| 81 67 | 
             
              end
         | 
| 82 68 | 
             
            end
         | 
| @@ -6,7 +6,7 @@ module PatronusFati::DataModels | |
| 6 6 | 
             
                include PatronusFati::DataModels::ReportedAttributes
         | 
| 7 7 |  | 
| 8 8 | 
             
                property  :id,              Serial
         | 
| 9 | 
            -
                property  :bssid,           String,   :length => 17, : | 
| 9 | 
            +
                property  :bssid,           String,   :length => 17, :unique_index => true
         | 
| 10 10 | 
             
                property  :channel,         Integer
         | 
| 11 11 |  | 
| 12 12 | 
             
                property  :crypt_packets,   Integer,  :default => 0
         | 
| @@ -24,8 +24,6 @@ module PatronusFati::DataModels | |
| 24 24 | 
             
                has n, :connections,    :constraint => :destroy
         | 
| 25 25 | 
             
                has n, :access_points,  :through    => :connections
         | 
| 26 26 |  | 
| 27 | 
            -
                has n, :client_frequencies, :constraint => :destroy
         | 
| 28 | 
            -
                has n, :client_signals,     :constraint => :destroy
         | 
| 29 27 | 
             
                has n, :probes,             :constraint => :destroy
         | 
| 30 28 |  | 
| 31 29 | 
             
                belongs_to :mac, :required => false
         | 
| @@ -52,20 +50,8 @@ module PatronusFati::DataModels | |
| 52 50 | 
             
                    active: active?,
         | 
| 53 51 | 
             
                    connected_access_points: connected_access_points.map(&:bssid),
         | 
| 54 52 | 
             
                    probes: probes.map(&:essid),
         | 
| 55 | 
            -
                    signal_dbm: (client_signals.any? ? client_signals.last.dbm : nil),
         | 
| 56 53 | 
             
                    vendor: mac.vendor
         | 
| 57 54 | 
             
                  )
         | 
| 58 55 | 
             
                end
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                def record_signal(dbm)
         | 
| 61 | 
            -
                  PatronusFati::DataModels::ClientSignal.create(client: self, dbm: dbm)
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                def update_frequencies(freq_hsh)
         | 
| 65 | 
            -
                  freq_hsh.each do |freq, packet_count|
         | 
| 66 | 
            -
                    f = client_frequencies.first_or_create({mhz: freq}, {packet_count: packet_count})
         | 
| 67 | 
            -
                    f.update({packet_count: packet_count})
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
                end
         | 
| 70 56 | 
             
              end
         | 
| 71 57 | 
             
            end
         | 
| @@ -11,7 +11,7 @@ module PatronusFati::DataModels | |
| 11 11 | 
             
                property :beacon_info,  String
         | 
| 12 12 |  | 
| 13 13 | 
             
                property :cloaked,      Boolean,  :default => false
         | 
| 14 | 
            -
                property :essid,        String,   :length  => 64
         | 
| 14 | 
            +
                property :essid,        String,   :length  => 64, :index => true
         | 
| 15 15 | 
             
                property :crypt_set,    CryptFlags
         | 
| 16 16 | 
             
                property :max_rate,     Integer
         | 
| 17 17 |  | 
| @@ -11,10 +11,7 @@ module PatronusFati::MessageProcessor::Bssid | |
| 11 11 |  | 
| 12 12 | 
             
                ap_info = ap_data(obj.attributes)
         | 
| 13 13 | 
             
                access_point = PatronusFati::DataModels::AccessPoint.first_or_create({bssid: obj.bssid}, ap_info)
         | 
| 14 | 
            -
             | 
| 15 14 | 
             
                access_point.update(ap_info)
         | 
| 16 | 
            -
                access_point.record_signal(obj.signal_dbm)
         | 
| 17 | 
            -
                access_point.update_frequencies(obj.freqmhz)
         | 
| 18 15 |  | 
| 19 16 | 
             
                nil
         | 
| 20 17 | 
             
              end
         | 
| @@ -7,10 +7,7 @@ module PatronusFati::MessageProcessor::Client | |
| 7 7 |  | 
| 8 8 | 
             
                client_info = client_data(obj.attributes)
         | 
| 9 9 | 
             
                client = PatronusFati::DataModels::Client.first_or_create({bssid: obj[:mac]}, client_info)
         | 
| 10 | 
            -
             | 
| 11 10 | 
             
                client.update(client_info)
         | 
| 12 | 
            -
                client.record_signal(obj.signal_dbm)
         | 
| 13 | 
            -
                client.update_frequencies(obj.freqmhz)
         | 
| 14 11 |  | 
| 15 12 | 
             
                # Don't deal in associations that are outside of our connection expiration
         | 
| 16 13 | 
             
                # time...
         | 
| @@ -3,7 +3,7 @@ module PatronusFati | |
| 3 3 | 
             
                extend FactoryBase
         | 
| 4 4 |  | 
| 5 5 | 
             
                def self.cleanup_models
         | 
| 6 | 
            -
                  @next_cleanup ||=  | 
| 6 | 
            +
                  @next_cleanup ||= Time.now.to_i + 60
         | 
| 7 7 |  | 
| 8 8 | 
             
                  if @next_cleanup <= Time.now.to_i
         | 
| 9 9 | 
             
                    @next_cleanup = Time.now.to_i + 10
         | 
| @@ -42,7 +42,7 @@ module PatronusFati | |
| 42 42 | 
             
                end
         | 
| 43 43 |  | 
| 44 44 | 
             
                def self.periodic_flush
         | 
| 45 | 
            -
                  @next_sync ||=  | 
| 45 | 
            +
                  @next_sync ||= Time.now.to_i + 60
         | 
| 46 46 |  | 
| 47 47 | 
             
                  if @next_sync <= Time.now.to_i
         | 
| 48 48 | 
             
                    # Add a variability of +/- half an hour within a day
         | 
    
        data/lib/patronus_fati.rb
    CHANGED
    
    | @@ -34,12 +34,8 @@ require 'patronus_fati/message_processor' | |
| 34 34 | 
             
            require 'patronus_fati/data_models/common'
         | 
| 35 35 |  | 
| 36 36 | 
             
            require 'patronus_fati/data_models/access_point'
         | 
| 37 | 
            -
            require 'patronus_fati/data_models/ap_frequency'
         | 
| 38 | 
            -
            require 'patronus_fati/data_models/ap_signal'
         | 
| 39 37 | 
             
            require 'patronus_fati/data_models/alert'
         | 
| 40 38 | 
             
            require 'patronus_fati/data_models/client'
         | 
| 41 | 
            -
            require 'patronus_fati/data_models/client_frequency'
         | 
| 42 | 
            -
            require 'patronus_fati/data_models/client_signal'
         | 
| 43 39 | 
             
            require 'patronus_fati/data_models/connection'
         | 
| 44 40 | 
             
            require 'patronus_fati/data_models/mac'
         | 
| 45 41 | 
             
            require 'patronus_fati/data_models/probe'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: patronus_fati
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.8. | 
| 4 | 
            +
              version: 0.8.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sam Stelfox
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-04- | 
| 11 | 
            +
            date: 2015-04-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: dm-constraints
         | 
| @@ -288,11 +288,7 @@ files: | |
| 288 288 | 
             
            - lib/patronus_fati/data_mapper/null_table_prefix.rb
         | 
| 289 289 | 
             
            - lib/patronus_fati/data_models/access_point.rb
         | 
| 290 290 | 
             
            - lib/patronus_fati/data_models/alert.rb
         | 
| 291 | 
            -
            - lib/patronus_fati/data_models/ap_frequency.rb
         | 
| 292 | 
            -
            - lib/patronus_fati/data_models/ap_signal.rb
         | 
| 293 291 | 
             
            - lib/patronus_fati/data_models/client.rb
         | 
| 294 | 
            -
            - lib/patronus_fati/data_models/client_frequency.rb
         | 
| 295 | 
            -
            - lib/patronus_fati/data_models/client_signal.rb
         | 
| 296 292 | 
             
            - lib/patronus_fati/data_models/common.rb
         | 
| 297 293 | 
             
            - lib/patronus_fati/data_models/connection.rb
         | 
| 298 294 | 
             
            - lib/patronus_fati/data_models/mac.rb
         | 
| @@ -1,14 +0,0 @@ | |
| 1 | 
            -
            module PatronusFati::DataModels
         | 
| 2 | 
            -
              class ApFrequency
         | 
| 3 | 
            -
                include DataMapper::Resource
         | 
| 4 | 
            -
             | 
| 5 | 
            -
                property :mhz,              Integer,  :key => true,
         | 
| 6 | 
            -
                                                      :required => true
         | 
| 7 | 
            -
                property :access_point_id,  Integer,  :key => true,
         | 
| 8 | 
            -
                                                      :required => true
         | 
| 9 | 
            -
                property :packet_count,     Integer,  :default => 0,
         | 
| 10 | 
            -
                                                      :required => true
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                belongs_to :access_point
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         | 
| @@ -1,12 +0,0 @@ | |
| 1 | 
            -
            module PatronusFati::DataModels
         | 
| 2 | 
            -
              class ApSignal
         | 
| 3 | 
            -
                include DataMapper::Resource
         | 
| 4 | 
            -
             | 
| 5 | 
            -
                property :id,           Serial
         | 
| 6 | 
            -
                property :timestamp,    Integer,  :default => Proc.new { Time.now.to_i },
         | 
| 7 | 
            -
                                                  :required => true
         | 
| 8 | 
            -
                property :dbm,          Integer,  :required => true
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                belongs_to :access_point
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
            end
         | 
| @@ -1,14 +0,0 @@ | |
| 1 | 
            -
            module PatronusFati::DataModels
         | 
| 2 | 
            -
              class ClientFrequency
         | 
| 3 | 
            -
                include DataMapper::Resource
         | 
| 4 | 
            -
             | 
| 5 | 
            -
                property :mhz,          Integer,  :key => true,
         | 
| 6 | 
            -
                                                  :required => true
         | 
| 7 | 
            -
                property :client_id,    Integer,  :key => true,
         | 
| 8 | 
            -
                                                  :required => true
         | 
| 9 | 
            -
                property :packet_count, Integer,  :default => 0,
         | 
| 10 | 
            -
                                                  :required => true
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                belongs_to :client
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         | 
| @@ -1,12 +0,0 @@ | |
| 1 | 
            -
            module PatronusFati::DataModels
         | 
| 2 | 
            -
              class ClientSignal
         | 
| 3 | 
            -
                include DataMapper::Resource
         | 
| 4 | 
            -
             | 
| 5 | 
            -
                property :id,           Serial
         | 
| 6 | 
            -
                property :timestamp,    Integer,  :default => Proc.new { Time.now.to_i },
         | 
| 7 | 
            -
                                                  :required => true
         | 
| 8 | 
            -
                property :dbm,          Integer,  :required => true
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                belongs_to :client
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
            end
         |