patronus_fati 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f79f91a49135b01c1f848b0883de89f9bd3c2dc6
4
- data.tar.gz: 86929ed03d0bd55c48df02d70772b8308c901ae5
3
+ metadata.gz: 61ba287f4168013f92fa49e04138633d212d535a
4
+ data.tar.gz: d566e6a16567e1d3cd5d30cf82c7125b6c01549c
5
5
  SHA512:
6
- metadata.gz: 3cc136a90de07282ade2b6e050bd09799ea64978cda5d6f77cb20ffe16617c8f2271479f366782bd7c7b37f780f2b9b95eb9a2373e20f1ea92bcbd16bcd45a98
7
- data.tar.gz: 3c1aca19035a8a86d434d6a579967bc9275c42e367d30933e2d1a41e4d5375e304b2487822584afae0307887df346dc999ba3d7f071102bba24a6139436b3687
6
+ metadata.gz: a129ae80a6cf7ef9e645bf0eac7f319cae3de7bf120794c64188a91c7c8166c505969ae279c537052449ce76b1fd7bb059e5cfeadbbf58c57118cec3b94a4694
7
+ data.tar.gz: b65d3ef79d1ccebeed87355537cb57aad5a45497d0385dddff529662a69b6f6bf729c88464409a56be223cfd5a3e57c8fca179820ed0c77c79c54eed453dec51
@@ -0,0 +1,4 @@
1
+ * Multiple cloaked access points result in flapping of settings (we assume a max of 1)
2
+ * Adjust channel tracking to include breakdown of time APs spend on channels
3
+ * Adjust encryption tracking to hold down flapping changes to the largest inclusive set
4
+ * Investigate duplicate BSSIDs on multiple bands
data/bin/patronus_fati CHANGED
@@ -40,7 +40,7 @@ exception_logger('process') do
40
40
  connection.connect
41
41
 
42
42
  PatronusFati.event_handler.on(:any) do |asset_type, event_type, msg, diagnostics|
43
- PatronusFati.logger.info(JSON.generate(
43
+ STDERR.puts(JSON.generate(
44
44
  {
45
45
  asset_type: asset_type,
46
46
  event_type: event_type,
@@ -29,7 +29,7 @@ module PatronusFati
29
29
  end
30
30
 
31
31
  def announce_changes
32
- return unless dirty? && valid?
32
+ return unless dirty? && valid? && worth_syncing?
33
33
 
34
34
  if active?
35
35
  status = new? ? :new : :changed
@@ -126,9 +126,14 @@ module PatronusFati
126
126
 
127
127
  def track_ssid(ssid_data)
128
128
  self.ssids ||= {}
129
- ssids[ssid_data[:essid]] ||= DataModels::Ssid.new(ssid_data[:essid])
130
129
 
131
- ssid = ssids[ssid_data[:essid]]
130
+ ssid_key = ssid_data[:cloaked] ?
131
+ Digest::SHA256.hexdigest(ssid_data[:crypt_set].join) :
132
+ ssid_data[:essid]
133
+
134
+ ssids[ssid_key] ||= DataModels::Ssid.new(ssid_data[:essid])
135
+
136
+ ssid = ssids[ssid_key]
132
137
  ssid.presence.mark_visible
133
138
  ssid.update(ssid_data)
134
139
 
@@ -138,7 +143,7 @@ module PatronusFati
138
143
  def update(attrs)
139
144
  attrs.each do |k, v|
140
145
  next unless LOCAL_ATTRIBUTE_KEYS.include?(k)
141
- next if local_attributes[k] == v
146
+ next if v.nil? || local_attributes[k] == v
142
147
 
143
148
  set_sync_flag(:dirtyAttributes)
144
149
  local_attributes[k] = v
@@ -155,6 +160,14 @@ module PatronusFati
155
160
  result = Louis.lookup(local_attributes[:bssid])
156
161
  result['long_vendor'] || result['short_vendor']
157
162
  end
163
+
164
+ # This is a safety mechanism to check whether or not an access point is
165
+ # actually 'present'. This is intended to assist in cutting out the
166
+ # access points that are just on the edge of being visible to our sensors.
167
+ def worth_syncing?
168
+ client_macs.any? || sync_flag?(:syncedOnline) ||
169
+ (presence && presence.visible_time && presence.visible_time > INTERVAL_DURATION)
170
+ end
158
171
  end
159
172
  end
160
173
  end
@@ -90,7 +90,7 @@ module PatronusFati
90
90
  def update(attrs)
91
91
  attrs.each do |k, v|
92
92
  next unless LOCAL_ATTRIBUTE_KEYS.include?(k)
93
- next if local_attributes[k] == v
93
+ next if v.nil? || local_attributes[k] == v
94
94
 
95
95
  set_sync_flag(:dirtyAttributes)
96
96
  local_attributes[k] = v
@@ -28,7 +28,7 @@ module PatronusFati
28
28
  def update(attrs)
29
29
  attrs.each do |k, v|
30
30
  next unless LOCAL_ATTRIBUTE_KEYS.include?(k)
31
- next if local_attributes[k] == v
31
+ next if v.nil? || local_attributes[k] == v
32
32
 
33
33
  set_sync_flag(:dirtyAttributes)
34
34
  local_attributes[k] = v
@@ -22,9 +22,10 @@ module PatronusFati
22
22
  :minnoise_rssi, :maxsignal_rssi, :maxnoise_rssi,
23
23
  :bestlat, :bestlon, :bestalt, :agglat, :agglon,
24
24
  :aggalt, :aggpoints, :datasize, :turbocellnid,
25
- :turbocellmode, :turbocellsat, :carrierset, :channel,
25
+ :turbocellmode, :turbocellsat, :carrierset,
26
26
  :maxseenrate, :encodingset, :decrypted, :dupeivpackets,
27
27
  :bsstimestamp, :fragments, :retries, :newpackets) { |val| val.to_i }
28
+ Bssid.set_data_filter(:channel) { |val| val.to_i == 0 ? nil : val.to_i }
28
29
 
29
30
  # Attempt to map the returned BSSID type to one we know about it and
30
31
  # convert it to a string. In the event we don't know it will leave this as
@@ -50,8 +50,8 @@ module PatronusFati::MessageProcessor::Client
50
50
  client.announce_changes
51
51
 
52
52
  # Don't deal in associations that are outside of our connection expiration
53
- # time... or if we don't have an access point
54
- return if access_point.nil? ||
53
+ # time... or if we don't have a valid access point
54
+ return if access_point.nil? || !access_point.valid? ||
55
55
  obj[:lasttime] < PatronusFati::DataModels::Connection.current_expiration_threshold
56
56
 
57
57
  connection_key = "#{obj[:bssid]}^#{obj[:mac]}"
@@ -41,32 +41,6 @@ module PatronusFati
41
41
  DataModels::Client.instances.reject! { |_, ap| ap.presence.dead? }
42
42
  end
43
43
 
44
- def self.report_recently_seen
45
- @next_recent_msg ||= Time.now.to_i + 240
46
-
47
- if @next_recent_msg <= Time.now.to_i
48
- @next_recent_msg = Time.now.to_i + 240
49
- cutoff_time = Time.now.to_i - 300
50
-
51
- aps = DataModels::AccessPoint.instances.map do |bssid, ap|
52
- next unless ap.active? && ap.presence.visible_since?(cutoff_time)
53
- bssid
54
- end.compact
55
-
56
- clients = DataModels::Client.instances.map do |mac, client|
57
- next unless client.active? && client.presence.visible_since?(cutoff_time)
58
- mac
59
- end.compact
60
-
61
- return if clients.empty? && aps.empty?
62
- PatronusFati.event_handler.event(
63
- :sync,
64
- :recent,
65
- { access_points: aps, clients: clients }
66
- )
67
- end
68
- end
69
-
70
44
  def self.handle(message_obj)
71
45
  if !PatronusFati.past_initial_flood? && @last_msg_received && (Time.now.to_f - @last_msg_received) >= 0.8
72
46
  PatronusFati.past_initial_flood!
@@ -74,7 +48,6 @@ module PatronusFati
74
48
  @last_msg_received = Time.now.to_f
75
49
 
76
50
  periodic_flush
77
- report_recently_seen
78
51
  result = factory(class_to_name(message_obj), message_obj)
79
52
  cleanup_models
80
53
  result
@@ -106,13 +79,13 @@ module PatronusFati
106
79
  clients = []
107
80
 
108
81
  PatronusFati::DataModels::AccessPoint.instances.each do |bssid, access_point|
109
- next unless access_point.active?
82
+ next unless access_point.sync_flag?(:syncedOnline)
110
83
  PatronusFati.event_handler.event(:access_point, :sync, access_point.full_state, access_point.diagnostic_data)
111
84
  access_points << bssid
112
85
  end
113
86
 
114
87
  PatronusFati::DataModels::Client.instances.each do |mac, client|
115
- next unless client.active?
88
+ next unless client.sync_flag?(:syncedOnline)
116
89
  PatronusFati.event_handler.event(:client, :sync, client.full_state, client.diagnostic_data)
117
90
  clients << mac
118
91
  end
@@ -1,3 +1,3 @@
1
1
  module PatronusFati
2
- VERSION = '1.3.5'
2
+ VERSION = '1.3.6'
3
3
  end
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: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stelfox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-09 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: louis
@@ -133,6 +133,7 @@ files:
133
133
  - ".gitignore"
134
134
  - ".rspec"
135
135
  - ".yardopts"
136
+ - DATA_CLEANUP_TASKS.md
136
137
  - Gemfile
137
138
  - LICENSE
138
139
  - README.md