patronus_fati 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/patronus_fati/data_models/access_point.rb +0 -12
- data/lib/patronus_fati/data_models/client.rb +0 -11
- data/lib/patronus_fati/data_models/connection.rb +1 -1
- data/lib/patronus_fati/message_processor/bssid.rb +0 -15
- data/lib/patronus_fati/message_processor/client.rb +0 -13
- data/lib/patronus_fati/version.rb +1 -1
- data/spec/data_models/connection_spec.rb +26 -30
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07f850ac1cb0f1dd2f7dfb513bd4ce335fbbf6a4
|
4
|
+
data.tar.gz: fb8c5272dca78ebf66d505ccb899fc2de44637dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a3e594dea7679cf076e53fbd762d0387a34f81e9d94e7ced43d79045fae10f1b96a8ed85fb7cb9b5e0440917be279e9c04f9b841c0c868d84cf76bdcce0496
|
7
|
+
data.tar.gz: f723d26a1a9e1f143612efc29322a268d67f6a8cc7ba30d38280043b81d03e312052469ac672a4fa571b4f8e2ba3eb593ec8080b5df26e910e137ebde4f35d4f
|
@@ -15,18 +15,6 @@ module PatronusFati::DataModels
|
|
15
15
|
property :max_seen_rate, Integer
|
16
16
|
property :type, String, :required => true
|
17
17
|
|
18
|
-
property :duplicate_iv_pkts, Integer, :default => 0
|
19
|
-
property :crypt_packets, Integer, :default => 0
|
20
|
-
property :data_packets, Integer, :default => 0
|
21
|
-
property :data_size, Integer, :default => 0
|
22
|
-
|
23
|
-
property :fragments, Integer, :default => 0
|
24
|
-
property :retries, Integer, :default => 0
|
25
|
-
|
26
|
-
property :range_ip, String
|
27
|
-
property :netmask, String
|
28
|
-
property :gateway_ip, String
|
29
|
-
|
30
18
|
has n, :clients, :through => :connections
|
31
19
|
has n, :connections, :constraint => :destroy,
|
32
20
|
:child_key => :access_point_id
|
@@ -8,19 +8,8 @@ module PatronusFati::DataModels
|
|
8
8
|
property :id, Serial
|
9
9
|
property :bssid, String, :length => 17, :unique_index => true
|
10
10
|
property :channel, Integer
|
11
|
-
|
12
|
-
property :crypt_packets, Integer, :default => 0
|
13
|
-
property :data_packets, Integer, :default => 0
|
14
|
-
property :data_size, Integer, :default => 0
|
15
|
-
property :fragments, Integer, :default => 0
|
16
|
-
property :retries, Integer, :default => 0
|
17
|
-
|
18
11
|
property :max_seen_rate, Integer
|
19
12
|
|
20
|
-
property :ip, String
|
21
|
-
property :gateway_ip, String
|
22
|
-
property :dhcp_host, String, :length => 64
|
23
|
-
|
24
13
|
has n, :connections, :constraint => :destroy
|
25
14
|
has n, :access_points, :through => :connections
|
26
15
|
|
@@ -7,7 +7,7 @@ module PatronusFati::DataModels
|
|
7
7
|
property :id, Serial
|
8
8
|
|
9
9
|
property :connected_at, Integer, :default => Proc.new { Time.now.to_i }
|
10
|
-
property :disconnected_at, Integer
|
10
|
+
property :disconnected_at, Integer
|
11
11
|
property :duration, Integer
|
12
12
|
|
13
13
|
belongs_to :access_point
|
@@ -23,21 +23,6 @@ module PatronusFati::MessageProcessor::Bssid
|
|
23
23
|
bssid: attrs[:bssid],
|
24
24
|
type: attrs[:type],
|
25
25
|
channel: attrs[:channel],
|
26
|
-
|
27
|
-
crypt_packets: attrs[:cryptpackets],
|
28
|
-
data_packets: attrs[:datapackets],
|
29
|
-
data_size: attrs[:datasize],
|
30
|
-
|
31
|
-
fragments: attrs[:fragments],
|
32
|
-
retries: attrs[:retries],
|
33
|
-
|
34
|
-
max_seen_rate: attrs[:maxseenrate],
|
35
|
-
duplicate_iv_pkts: attrs[:dupeivpackets],
|
36
|
-
|
37
|
-
range_ip: attrs[:rangeip],
|
38
|
-
netmask: attrs[:netmaskip],
|
39
|
-
gateway_ip: attrs[:gatewayip],
|
40
|
-
|
41
26
|
last_seen_at: Time.now.to_i
|
42
27
|
}.reject { |_, v| v.nil? }
|
43
28
|
end
|
@@ -31,20 +31,7 @@ module PatronusFati::MessageProcessor::Client
|
|
31
31
|
{
|
32
32
|
bssid: attrs[:mac],
|
33
33
|
channel: attrs[:channel],
|
34
|
-
|
35
|
-
crypt_packets: attrs[:cryptpackets],
|
36
|
-
data_packets: attrs[:datapackets],
|
37
|
-
data_size: attrs[:datasize],
|
38
|
-
|
39
|
-
fragments: attrs[:fragments],
|
40
|
-
retries: attrs[:retries],
|
41
|
-
|
42
34
|
max_seen_rate: attrs[:maxseenrate],
|
43
|
-
|
44
|
-
ip: attrs[:ip],
|
45
|
-
gateway_ip: attrs[:gatewayip],
|
46
|
-
dhcp_host: attrs[:dhcphost],
|
47
|
-
|
48
35
|
last_seen_at: Time.now.to_i
|
49
36
|
}.reject { |_, v| v.nil? }
|
50
37
|
end
|
@@ -1,86 +1,82 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
4
|
-
|
5
|
-
|
3
|
+
RSpec.describe PatronusFati::DataModels::Connection do
|
4
|
+
let(:ap_model) { PatronusFati::DataModels::AccessPoint }
|
6
5
|
let(:client_model) { PatronusFati::DataModels::Client }
|
7
|
-
let(:unsaved_client) { client_model.new(bssid: '11:22:33:00:00:00') }
|
8
6
|
|
9
|
-
let(:ap_model) { PatronusFati::DataModels::AccessPoint }
|
10
7
|
let(:unsaved_ap) { ap_model.new(bssid: '22:33:44:00:00:01', type: 'adhoc', channel: 6) }
|
8
|
+
let(:unsaved_client) { client_model.new(bssid: '11:22:33:00:00:00') }
|
11
9
|
|
12
|
-
let(:instance) {
|
10
|
+
let(:instance) { described_class.new(client: unsaved_client, access_point: unsaved_ap) }
|
13
11
|
|
14
|
-
it { expect(
|
12
|
+
it { expect(described_class).to have_property(:id) }
|
15
13
|
|
16
|
-
it { expect(
|
17
|
-
it { expect(
|
14
|
+
it { expect(described_class).to have_property(:connected_at) }
|
15
|
+
it { expect(described_class).to have_property(:disconnected_at) }
|
18
16
|
|
19
|
-
it { expect(
|
20
|
-
it { expect(
|
17
|
+
it { expect(described_class).to belong_to(:access_point) }
|
18
|
+
it { expect(described_class).to belong_to(:client) }
|
21
19
|
|
22
|
-
context '#
|
20
|
+
context '#connected?' do
|
23
21
|
it 'should be true when a disconnection hasn\'t been registered' do
|
24
22
|
inst = instance
|
25
23
|
inst.disconnected_at = nil
|
26
24
|
|
27
|
-
expect(inst).to
|
25
|
+
expect(inst).to be_connected
|
28
26
|
end
|
29
27
|
|
30
28
|
it 'should be false when a disconnection has been registered' do
|
31
29
|
inst = instance
|
32
30
|
inst.disconnected_at = Time.now
|
33
31
|
|
34
|
-
expect(inst).to_not
|
32
|
+
expect(inst).to_not be_connected
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
36
|
context '#disconnect!' do
|
39
|
-
it 'should change
|
37
|
+
it 'should change a connected instance to be disconnected' do
|
40
38
|
inst = instance
|
41
39
|
inst.save
|
42
40
|
|
43
|
-
expect(inst).to
|
41
|
+
expect(inst).to be_connected
|
44
42
|
inst.disconnect!
|
45
|
-
expect(inst).to_not
|
43
|
+
expect(inst).to_not be_connected
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
49
|
-
context '#
|
47
|
+
context '#connected scope' do
|
50
48
|
it 'should include active connections' do
|
51
49
|
inst = instance
|
52
50
|
inst.save
|
53
51
|
|
54
|
-
expect(
|
55
|
-
expect(subject.active).to include(inst)
|
52
|
+
expect(described_class.connected).to include(inst)
|
56
53
|
end
|
57
54
|
|
58
|
-
it 'should not include
|
55
|
+
it 'should not include disconnected connections' do
|
59
56
|
inst = instance
|
60
57
|
inst.save
|
61
58
|
inst.disconnect!
|
62
59
|
|
63
|
-
expect(
|
64
|
-
expect(subject.active).to_not include(inst)
|
60
|
+
expect(described_class.connected).to_not include(inst)
|
65
61
|
end
|
66
62
|
end
|
67
63
|
|
68
|
-
context '#
|
69
|
-
it 'should not include
|
64
|
+
context '#disconnected scope' do
|
65
|
+
it 'should not include disconnected connections' do
|
70
66
|
inst = instance
|
71
67
|
inst.save
|
72
68
|
|
73
|
-
expect(inst).to
|
74
|
-
expect(
|
69
|
+
expect(inst).to be_connected
|
70
|
+
expect(described_class.disconnected).to_not include(inst)
|
75
71
|
end
|
76
72
|
|
77
|
-
it 'should include
|
73
|
+
it 'should include disconnected connections' do
|
78
74
|
inst = instance
|
79
75
|
inst.save
|
80
76
|
inst.disconnect!
|
81
77
|
|
82
|
-
expect(inst).to_not
|
83
|
-
expect(
|
78
|
+
expect(inst).to_not be_connected
|
79
|
+
expect(described_class.disconnected).to include(inst)
|
84
80
|
end
|
85
81
|
end
|
86
82
|
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: 0.8.
|
4
|
+
version: 0.8.9
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dm-constraints
|