metasploit_data_models 0.22.8 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +0 -2
- data/CONTRIBUTING.md +1 -1
- data/app/models/mdm/service.rb +8 -0
- data/db/migrate/20150212214222_remove_duplicate_services2.rb +12 -0
- data/lib/metasploit_data_models/version.rb +2 -2
- data/metasploit_data_models.gemspec +2 -0
- data/spec/app/models/mdm/service_spec.rb +8 -0
- data/spec/dummy/db/structure.sql +9 -0
- metadata +39 -38
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YjllYjA5Zjk5NTdlMmQ0OTU2YzUyZjc1NGNjMmQxMzA2Yjg3MDI4Zg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5e8bc2e148729867ec972b74493e62d471823696
|
4
|
+
data.tar.gz: 56c14fa5d0c88baf42f3c57482b0e0de09bf6bb9
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Y2EyNjNiMmNjODVmYTgyMTY1Njg3YjRiNWIzNTQ4OWYwOTRjYWE3NzUyNzc2
|
11
|
-
NjAwOWM5OTVlMWFlMjg2NjYxZTliYTdiMzY0ODNiZDMxZTc3Mzk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OGYzZDU3ZGRiYjEwYjg5NDRkZmM4YWZmMjcyZDk0M2QyY2Q0YjVhYzgxYjhi
|
14
|
-
ZGJhODU4NmU4ZjgzOTIzOGVkZTNlZjg1NzM4N2IzNzE0MjhmYzcwODM1YWVh
|
15
|
-
MjdlMDEwNjczNGQ3YTFhZTNlNDFiNDNmZDBlMjQyMWNjMzY2MTk=
|
6
|
+
metadata.gz: 9f3f0d5d0bd3ad985783b7af153ed18a5b40eb77a028efc4d385c485f80eb212221093440d18912d10d49e1e81cd1e26105af841fdc59914e3daf8d48773a038
|
7
|
+
data.tar.gz: ed3459352d3b161d487db7afa170ddae756192f3ddc2563a2dd3c73f0c0ac514def03d48c162612e2fddcddd4d58550f81f8741c823c1950f66a98cb7c6c6c86
|
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -148,7 +148,7 @@ If your changes are incompatible with the previous branch's API, then increment
|
|
148
148
|
- [ ] `rake release`
|
149
149
|
|
150
150
|
## MRI Ruby
|
151
|
-
- [ ] `rvm use ruby-1
|
151
|
+
- [ ] `rvm use ruby-2.1@metasploit_data_models`
|
152
152
|
- [ ] `rm Gemfile.lock`
|
153
153
|
- [ ] `bundle install`
|
154
154
|
- [ ] `rake release`
|
data/app/models/mdm/service.rb
CHANGED
@@ -217,6 +217,14 @@ class Mdm::Service < ActiveRecord::Base
|
|
217
217
|
numericality: {
|
218
218
|
only_integer: true
|
219
219
|
}
|
220
|
+
validates :port,
|
221
|
+
uniqueness: {
|
222
|
+
message: 'already exists on this host and protocol',
|
223
|
+
scope: [
|
224
|
+
:host_id,
|
225
|
+
:proto
|
226
|
+
]
|
227
|
+
}
|
220
228
|
validates :proto,
|
221
229
|
inclusion: {
|
222
230
|
in: PROTOS
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RemoveDuplicateServices2 < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
duplicate_keys = Mdm::Service.count(group: [:host_id, :port, :proto]).select { |k,v| v >1 }.keys
|
4
|
+
duplicate_keys.each do |keys|
|
5
|
+
duplicate_services = Mdm::Service.where(host_id: keys[0], port: keys[1], proto: keys[2]).order(:created_at)
|
6
|
+
duplicate_services.pop
|
7
|
+
duplicate_services.each(&:destroy)
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :services, [:host_id, :port, :proto], unique: true
|
11
|
+
end
|
12
|
+
end
|
@@ -4,9 +4,9 @@ module MetasploitDataModels
|
|
4
4
|
# The major version number.
|
5
5
|
MAJOR = 0
|
6
6
|
# The minor version number, scoped to the {MAJOR} version number.
|
7
|
-
MINOR =
|
7
|
+
MINOR = 23
|
8
8
|
# The patch number, scoped to the {MINOR} version number.
|
9
|
-
PATCH =
|
9
|
+
PATCH = 0
|
10
10
|
|
11
11
|
# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the `PRERELEASE` in the
|
12
12
|
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
|
@@ -154,5 +154,13 @@ describe Mdm::Service do
|
|
154
154
|
it { should validate_numericality_of(:port).only_integer }
|
155
155
|
it { should ensure_inclusion_of(:proto).in_array(described_class::PROTOS) }
|
156
156
|
|
157
|
+
context 'when a duplicate service already exists' do
|
158
|
+
let(:service1) { FactoryGirl.create(:mdm_service)}
|
159
|
+
let(:service2) { FactoryGirl.build(:mdm_service, :host => service1.host, :port => service1.port, :proto => service1.proto )}
|
160
|
+
it 'is not valid' do
|
161
|
+
expect(service2).to_not be_valid
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
157
165
|
end
|
158
166
|
end
|
data/spec/dummy/db/structure.sql
CHANGED
@@ -2686,6 +2686,13 @@ CREATE INDEX index_notes_on_ntype ON notes USING btree (ntype);
|
|
2686
2686
|
CREATE INDEX index_refs_on_name ON refs USING btree (name);
|
2687
2687
|
|
2688
2688
|
|
2689
|
+
--
|
2690
|
+
-- Name: index_services_on_host_id_and_port_and_proto; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2691
|
+
--
|
2692
|
+
|
2693
|
+
CREATE UNIQUE INDEX index_services_on_host_id_and_port_and_proto ON services USING btree (host_id, port, proto);
|
2694
|
+
|
2695
|
+
|
2689
2696
|
--
|
2690
2697
|
-- Name: index_services_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2691
2698
|
--
|
@@ -2991,6 +2998,8 @@ INSERT INTO schema_migrations (version) VALUES ('20150112203945');
|
|
2991
2998
|
|
2992
2999
|
INSERT INTO schema_migrations (version) VALUES ('20150205192745');
|
2993
3000
|
|
3001
|
+
INSERT INTO schema_migrations (version) VALUES ('20150212214222');
|
3002
|
+
|
2994
3003
|
INSERT INTO schema_migrations (version) VALUES ('21');
|
2995
3004
|
|
2996
3005
|
INSERT INTO schema_migrations (version) VALUES ('22');
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metasploit_data_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Huckins
|
@@ -11,180 +11,180 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-02-
|
14
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: yard
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- - <
|
34
|
+
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 0.8.7.4
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - <
|
41
|
+
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.8.7.4
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: pry
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: activerecord
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 3.2.13
|
65
|
-
- - <
|
65
|
+
- - "<"
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 4.0.0
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 3.2.13
|
75
|
-
- - <
|
75
|
+
- - "<"
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 4.0.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: activesupport
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: recog
|
94
94
|
requirement: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- - ~>
|
96
|
+
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '1.0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- - ~>
|
103
|
+
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '1.0'
|
106
106
|
- !ruby/object:Gem::Dependency
|
107
107
|
name: metasploit-concern
|
108
108
|
requirement: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - ~>
|
110
|
+
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 0.3.0
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - ~>
|
117
|
+
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: 0.3.0
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
121
|
name: metasploit-model
|
122
122
|
requirement: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- - ~>
|
124
|
+
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: 0.29.0
|
127
127
|
type: :runtime
|
128
128
|
prerelease: false
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- - ~>
|
131
|
+
- - "~>"
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: 0.29.0
|
134
134
|
- !ruby/object:Gem::Dependency
|
135
135
|
name: railties
|
136
136
|
requirement: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- - <
|
138
|
+
- - "<"
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: 4.0.0
|
141
141
|
type: :runtime
|
142
142
|
prerelease: false
|
143
143
|
version_requirements: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- - <
|
145
|
+
- - "<"
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: 4.0.0
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
149
|
name: arel-helpers
|
150
150
|
requirement: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- -
|
152
|
+
- - ">="
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
type: :runtime
|
156
156
|
prerelease: false
|
157
157
|
version_requirements: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: '0'
|
162
162
|
- !ruby/object:Gem::Dependency
|
163
163
|
name: redcarpet
|
164
164
|
requirement: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- -
|
166
|
+
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
type: :development
|
170
170
|
prerelease: false
|
171
171
|
version_requirements: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
|
-
- -
|
173
|
+
- - ">="
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
- !ruby/object:Gem::Dependency
|
177
177
|
name: pg
|
178
178
|
requirement: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
|
-
- -
|
180
|
+
- - ">="
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
type: :runtime
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- -
|
187
|
+
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
description: Implements minimal ActiveRecord models and database helper code used
|
@@ -199,12 +199,12 @@ executables:
|
|
199
199
|
extensions: []
|
200
200
|
extra_rdoc_files: []
|
201
201
|
files:
|
202
|
-
- .coveralls.yml
|
203
|
-
- .gitignore
|
204
|
-
- .rspec
|
205
|
-
- .simplecov
|
206
|
-
- .travis.yml
|
207
|
-
- .yardopts
|
202
|
+
- ".coveralls.yml"
|
203
|
+
- ".gitignore"
|
204
|
+
- ".rspec"
|
205
|
+
- ".simplecov"
|
206
|
+
- ".travis.yml"
|
207
|
+
- ".yardopts"
|
208
208
|
- CONTRIBUTING.md
|
209
209
|
- Gemfile
|
210
210
|
- LICENSE
|
@@ -395,6 +395,7 @@ files:
|
|
395
395
|
- db/migrate/20140905031549_add_detected_arch_to_host.rb
|
396
396
|
- db/migrate/20150112203945_remove_duplicate_services.rb
|
397
397
|
- db/migrate/20150205192745_drop_service_uniqueness_index.rb
|
398
|
+
- db/migrate/20150212214222_remove_duplicate_services2.rb
|
398
399
|
- lib/mdm.rb
|
399
400
|
- lib/mdm/host/operating_system_normalization.rb
|
400
401
|
- lib/mdm/module.rb
|
@@ -593,17 +594,17 @@ require_paths:
|
|
593
594
|
- lib
|
594
595
|
required_ruby_version: !ruby/object:Gem::Requirement
|
595
596
|
requirements:
|
596
|
-
- -
|
597
|
+
- - ">="
|
597
598
|
- !ruby/object:Gem::Version
|
598
|
-
version: '
|
599
|
+
version: '2.1'
|
599
600
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
600
601
|
requirements:
|
601
|
-
- -
|
602
|
+
- - ">="
|
602
603
|
- !ruby/object:Gem::Version
|
603
604
|
version: '0'
|
604
605
|
requirements: []
|
605
606
|
rubyforge_project:
|
606
|
-
rubygems_version: 2.4.
|
607
|
+
rubygems_version: 2.4.3
|
607
608
|
signing_key:
|
608
609
|
specification_version: 4
|
609
610
|
summary: Database code for MSF and Metasploit Pro
|