metasploit_data_models 0.21.3 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/app/models/mdm/service.rb +9 -0
- data/app/models/mdm/task.rb +0 -4
- data/db/migrate/20150112203945_remove_duplicate_services.rb +12 -0
- data/lib/metasploit_data_models/version.rb +2 -2
- data/spec/app/models/mdm/service_spec.rb +8 -0
- data/spec/app/models/mdm/task_spec.rb +1 -10
- data/spec/dummy/db/structure.sql +9 -0
- metadata +38 -37
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Mjg5MGZlNTczYjViYjg4ZGU5Y2E3ZDA2MjZlNzAwZTk5ZmNmNjA2ZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9c10785a13c01bc2f665452025f6e3760c2ae461
|
4
|
+
data.tar.gz: c2347bc23c46c2220837dbed38dcfafd667da197
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZjI3Y2E2NWM5YTM5NzkwMmEwYTIxYmExYjBkNmU3NTFhYjc4ZDM2NDUwNmI3
|
11
|
-
NGI1OGMzN2ZjZDQyYTQwZDdjZWI1MTcwNzk0YWY3MGVlZTIwZjE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzEwZGJkNDVhMWEzMzBjMDRkMWM0MTFiMGJkZjc0M2FkNjU0MjgxNWY0MzQz
|
14
|
-
NjQ3YzJmMmY3NmFhMzg0ZjIyNjY1MTQ2MzZlYzYxOWE1ZjgzYWY2YTc4Mzhj
|
15
|
-
NmUxMzlkMzViYjU4OWY1MDM0OTY3OTBmYzIxODU4MWNlN2YzZmY=
|
6
|
+
metadata.gz: 88988f1f7348f8e3472265becac4ddd3f3fecc00eb6ba696e4f6ca9e03ae95b427f91a16e8e91f4d1cf53e88fa6a474e96d3832e65eb1aa3bec9ded553d4ae85
|
7
|
+
data.tar.gz: c1461576f9e91b6f70bb0029b6673d07aaf03877bc4e011030b989e651adc478cedf5c54c69c69aac96f0338af3204fa382c47770dad29a8c526607d966ee518
|
data/app/models/mdm/service.rb
CHANGED
@@ -222,6 +222,15 @@ class Mdm::Service < ActiveRecord::Base
|
|
222
222
|
in: PROTOS
|
223
223
|
}
|
224
224
|
|
225
|
+
validates :host_id,
|
226
|
+
uniqueness: {
|
227
|
+
message: 'already has a service with this port and proto',
|
228
|
+
scope: [
|
229
|
+
:port,
|
230
|
+
:proto
|
231
|
+
]
|
232
|
+
}
|
233
|
+
|
225
234
|
#
|
226
235
|
# Class Methods
|
227
236
|
#
|
data/app/models/mdm/task.rb
CHANGED
@@ -103,11 +103,7 @@ class Mdm::Task < ActiveRecord::Base
|
|
103
103
|
has_many :sessions, :through => :task_sessions, :class_name => 'Mdm::Session'
|
104
104
|
|
105
105
|
|
106
|
-
#
|
107
|
-
# Scopes
|
108
|
-
#
|
109
106
|
|
110
|
-
scope :running, order( "created_at DESC" ).where("completed_at IS NULL")
|
111
107
|
|
112
108
|
#
|
113
109
|
# Serializations
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RemoveDuplicateServices < 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 = 22
|
8
8
|
# The patch number, scoped to the {MINOR} version number.
|
9
|
-
PATCH =
|
9
|
+
PATCH = 1
|
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.
|
@@ -153,5 +153,13 @@ describe Mdm::Service do
|
|
153
153
|
|
154
154
|
it { should validate_numericality_of(:port).only_integer }
|
155
155
|
it { should ensure_inclusion_of(:proto).in_array(described_class::PROTOS) }
|
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
|
156
164
|
end
|
157
165
|
end
|
@@ -59,15 +59,6 @@ describe Mdm::Task do
|
|
59
59
|
|
60
60
|
end
|
61
61
|
|
62
|
-
context 'scopes' do
|
63
|
-
context "running" do
|
64
|
-
it "should exclude completed tasks" do
|
65
|
-
task = FactoryGirl.create(:mdm_task, :completed_at => Time.now)
|
66
|
-
Mdm::Task.running.should_not include(task)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
62
|
context 'callbacks' do
|
72
63
|
context 'before_destroy' do
|
73
64
|
it 'should call #delete_file' do
|
@@ -79,4 +70,4 @@ describe Mdm::Task do
|
|
79
70
|
end
|
80
71
|
|
81
72
|
|
82
|
-
end
|
73
|
+
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
|
--
|
@@ -2987,6 +2994,8 @@ INSERT INTO schema_migrations (version) VALUES ('20130717150737');
|
|
2987
2994
|
|
2988
2995
|
INSERT INTO schema_migrations (version) VALUES ('20140905031549');
|
2989
2996
|
|
2997
|
+
INSERT INTO schema_migrations (version) VALUES ('20150112203945');
|
2998
|
+
|
2990
2999
|
INSERT INTO schema_migrations (version) VALUES ('21');
|
2991
3000
|
|
2992
3001
|
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.22.1
|
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:
|
14
|
+
date: 2015-01-16 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.28.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.28.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
|
@@ -393,6 +393,7 @@ files:
|
|
393
393
|
- db/migrate/20130604145732_create_task_sessions.rb
|
394
394
|
- db/migrate/20130717150737_remove_pname_validation.rb
|
395
395
|
- db/migrate/20140905031549_add_detected_arch_to_host.rb
|
396
|
+
- db/migrate/20150112203945_remove_duplicate_services.rb
|
396
397
|
- lib/mdm.rb
|
397
398
|
- lib/mdm/host/operating_system_normalization.rb
|
398
399
|
- lib/mdm/module.rb
|
@@ -591,17 +592,17 @@ require_paths:
|
|
591
592
|
- lib
|
592
593
|
required_ruby_version: !ruby/object:Gem::Requirement
|
593
594
|
requirements:
|
594
|
-
- -
|
595
|
+
- - ">="
|
595
596
|
- !ruby/object:Gem::Version
|
596
597
|
version: '0'
|
597
598
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
598
599
|
requirements:
|
599
|
-
- -
|
600
|
+
- - ">="
|
600
601
|
- !ruby/object:Gem::Version
|
601
602
|
version: '0'
|
602
603
|
requirements: []
|
603
604
|
rubyforge_project:
|
604
|
-
rubygems_version: 2.4.
|
605
|
+
rubygems_version: 2.4.3
|
605
606
|
signing_key:
|
606
607
|
specification_version: 4
|
607
608
|
summary: Database code for MSF and Metasploit Pro
|