metasploit_data_models 0.24.1.pre.rspec.pre.3.pre.1 → 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -3
- data/Gemfile +3 -1
- data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +1 -1
- data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
- data/app/validators/password_is_strong_validator.rb +1 -1
- data/lib/mdm/host/operating_system_normalization.rb +10 -0
- data/lib/metasploit_data_models/version.rb +1 -2
- data/metasploit_data_models.gemspec +1 -1
- data/spec/app/models/mdm/api_key_spec.rb +3 -1
- data/spec/app/models/mdm/client_spec.rb +11 -9
- data/spec/app/models/mdm/cred_spec.rb +54 -42
- data/spec/app/models/mdm/event_spec.rb +23 -21
- data/spec/app/models/mdm/exploit_attempt_spec.rb +21 -19
- data/spec/app/models/mdm/exploited_host_spec.rb +13 -11
- data/spec/app/models/mdm/host_detail_spec.rb +17 -15
- data/spec/app/models/mdm/host_spec.rb +260 -261
- data/spec/app/models/mdm/host_tag_spec.rb +8 -6
- data/spec/app/models/mdm/listener_spec.rb +32 -30
- data/spec/app/models/mdm/loot_spec.rb +23 -21
- data/spec/app/models/mdm/macro_spec.rb +3 -1
- data/spec/app/models/mdm/mod_ref_spec.rb +3 -1
- data/spec/app/models/mdm/module/action_spec.rb +12 -10
- data/spec/app/models/mdm/module/arch_spec.rb +12 -10
- data/spec/app/models/mdm/module/author_spec.rb +17 -22
- data/spec/app/models/mdm/module/detail_spec.rb +75 -184
- data/spec/app/models/mdm/module/mixin_spec.rb +12 -10
- data/spec/app/models/mdm/module/platform_spec.rb +12 -10
- data/spec/app/models/mdm/module/ref_spec.rb +12 -10
- data/spec/app/models/mdm/module/target_spec.rb +15 -13
- data/spec/app/models/mdm/nexpose_console_spec.rb +37 -35
- data/spec/app/models/mdm/note_spec.rb +25 -23
- data/spec/app/models/mdm/profile_spec.rb +3 -1
- data/spec/app/models/mdm/ref_spec.rb +12 -10
- data/spec/app/models/mdm/route_spec.rb +8 -6
- data/spec/app/models/mdm/service_spec.rb +40 -38
- data/spec/app/models/mdm/session_event_spec.rb +12 -10
- data/spec/app/models/mdm/session_spec.rb +15 -13
- data/spec/app/models/mdm/tag_spec.rb +29 -29
- data/spec/app/models/mdm/task_cred_spec.rb +11 -9
- data/spec/app/models/mdm/task_host_spec.rb +11 -9
- data/spec/app/models/mdm/task_service_spec.rb +11 -9
- data/spec/app/models/mdm/task_session_spec.rb +9 -7
- data/spec/app/models/mdm/task_spec.rb +29 -27
- data/spec/app/models/mdm/user_spec.rb +19 -17
- data/spec/app/models/mdm/vuln_attempt_spec.rb +16 -14
- data/spec/app/models/mdm/vuln_detail_spec.rb +28 -26
- data/spec/app/models/mdm/vuln_ref_spec.rb +10 -8
- data/spec/app/models/mdm/vuln_spec.rb +26 -24
- data/spec/app/models/mdm/web_form_spec.rb +13 -11
- data/spec/app/models/mdm/web_page_spec.rb +21 -19
- data/spec/app/models/mdm/web_site_spec.rb +23 -21
- data/spec/app/models/mdm/web_vuln_spec.rb +65 -63
- data/spec/app/models/mdm/wmap_request_spec.rb +3 -1
- data/spec/app/models/mdm/wmap_target_spec.rb +3 -1
- data/spec/app/models/mdm/workspace_spec.rb +100 -97
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +5 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +15 -13
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +12 -10
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +23 -21
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +11 -9
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +23 -21
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +15 -22
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +20 -18
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +8 -6
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +4 -2
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +8 -6
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +11 -9
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +7 -5
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +19 -17
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +7 -5
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +23 -61
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +10 -8
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +46 -54
- data/spec/factories/mdm/module/details.rb +1 -1
- data/spec/lib/base64_serializer_spec.rb +19 -19
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +12 -18
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +6 -4
- data/spec/lib/metasploit_data_models/match/child_spec.rb +4 -2
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +6 -4
- data/spec/lib/metasploit_data_models/version_spec.rb +5 -3
- data/spec/spec_helper.rb +6 -72
- data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +2 -2
- data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +4 -4
- data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +2 -2
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +3 -3
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +6 -7
- metadata +7 -7
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mdm::Workspace do
|
2
4
|
subject(:workspace) do
|
3
5
|
FactoryGirl.build(:mdm_workspace)
|
4
6
|
end
|
@@ -12,7 +14,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
12
14
|
context 'factory' do
|
13
15
|
it 'should be valid' do
|
14
16
|
workspace = FactoryGirl.build(:mdm_workspace)
|
15
|
-
|
17
|
+
workspace.should be_valid
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -38,27 +40,27 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
38
40
|
end
|
39
41
|
|
40
42
|
context 'associations' do
|
41
|
-
it {
|
42
|
-
it {
|
43
|
-
it {
|
44
|
-
it {
|
45
|
-
it {
|
46
|
-
it {
|
47
|
-
it {
|
48
|
-
it {
|
49
|
-
it {
|
50
|
-
it {
|
51
|
-
it {
|
52
|
-
it {
|
53
|
-
it {
|
54
|
-
it {
|
43
|
+
it { should have_many(:clients).class_name('Mdm::Client').through(:hosts) }
|
44
|
+
it { should have_many(:creds).class_name('Mdm::Cred').through(:services) }
|
45
|
+
it { should have_many(:events).class_name('Mdm::Event') }
|
46
|
+
it { should have_many(:exploited_hosts).class_name('Mdm::ExploitedHost').through(:hosts) }
|
47
|
+
it { should have_many(:hosts).class_name('Mdm::Host') }
|
48
|
+
it { should have_many(:listeners).class_name('Mdm::Listener').dependent(:destroy) }
|
49
|
+
it { should have_many(:loots).class_name('Mdm::Loot').through(:hosts) }
|
50
|
+
it { should have_many(:notes).class_name('Mdm::Note') }
|
51
|
+
it { should belong_to(:owner).class_name('Mdm::User').with_foreign_key('owner_id') }
|
52
|
+
it { should have_many(:services).class_name('Mdm::Service').through(:hosts).with_foreign_key('service_id') }
|
53
|
+
it { should have_many(:sessions).class_name('Mdm::Session').through(:hosts) }
|
54
|
+
it { should have_many(:tasks).class_name('Mdm::Task').dependent(:destroy).order('created_at DESC') }
|
55
|
+
it { should have_and_belong_to_many(:users).class_name('Mdm::User') }
|
56
|
+
it { should have_many(:vulns).class_name('Mdm::Vuln').through(:hosts) }
|
55
57
|
end
|
56
58
|
|
57
59
|
context 'callbacks' do
|
58
60
|
context 'before_save' do
|
59
61
|
context '#normalize' do
|
60
62
|
it 'should be called' do
|
61
|
-
|
63
|
+
workspace.should_receive(:normalize)
|
62
64
|
workspace.run_callbacks(:save, false)
|
63
65
|
end
|
64
66
|
end
|
@@ -66,21 +68,21 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
66
68
|
end
|
67
69
|
|
68
70
|
context 'columns' do
|
69
|
-
it {
|
70
|
-
it {
|
71
|
-
it {
|
72
|
-
it {
|
73
|
-
it {
|
71
|
+
it { should have_db_column(:boundary).of_type(:string).with_options(:limit => 4 * (2 ** 10)) }
|
72
|
+
it { should have_db_column(:description).of_type(:string).with_options(:limit => 4 * (2 ** 10)) }
|
73
|
+
it { should have_db_column(:limit_to_network).of_type(:boolean).with_options(:default => false, :null => false) }
|
74
|
+
it { should have_db_column(:name).of_type(:string) }
|
75
|
+
it { should have_db_column(:owner_id).of_type(:integer) }
|
74
76
|
|
75
77
|
context 'timestamps' do
|
76
|
-
it {
|
77
|
-
it {
|
78
|
+
it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
|
79
|
+
it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
81
83
|
context 'CONSTANTS' do
|
82
84
|
it 'should define the DEFAULT name' do
|
83
|
-
|
85
|
+
described_class::DEFAULT.should == default
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
@@ -99,8 +101,8 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
99
101
|
workspace.valid?
|
100
102
|
end
|
101
103
|
|
102
|
-
it 'should validate using #valid_ip_or_range?' do
|
103
|
-
|
104
|
+
it 'should validate using #valid_ip_or_range?', :pending => 'https://www.pivotaltracker.com/story/show/43244445' do
|
105
|
+
workspace.should_receive(:valid_ip_or_range?).with(boundary).and_return(false)
|
104
106
|
|
105
107
|
workspace.valid?
|
106
108
|
end
|
@@ -111,7 +113,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
111
113
|
end
|
112
114
|
|
113
115
|
it 'should not record an error' do
|
114
|
-
|
116
|
+
workspace.errors[:boundary].should_not include(error)
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
@@ -121,7 +123,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
121
123
|
end
|
122
124
|
|
123
125
|
it 'should not record an error' do
|
124
|
-
|
126
|
+
workspace.errors[:boundary].should_not include(error)
|
125
127
|
end
|
126
128
|
end
|
127
129
|
|
@@ -131,20 +133,20 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
131
133
|
end
|
132
134
|
|
133
135
|
it 'should record error that boundary must be a valid IP range', :pending => 'https://www.pivotaltracker.com/story/show/43171927' do
|
134
|
-
|
135
|
-
|
136
|
+
workspace.should_not be_valid
|
137
|
+
workkspace.errors[:boundary].should include(error)
|
136
138
|
end
|
137
139
|
end
|
138
140
|
end
|
139
141
|
|
140
142
|
context 'description' do
|
141
|
-
it {
|
143
|
+
it { should ensure_length_of(:description).is_at_most(4 * (2 ** 10)) }
|
142
144
|
end
|
143
145
|
|
144
146
|
context 'name' do
|
145
|
-
it {
|
146
|
-
it {
|
147
|
-
it {
|
147
|
+
it { should ensure_length_of(:name).is_at_most(2**8 - 1) }
|
148
|
+
it { should validate_presence_of :name }
|
149
|
+
it { should validate_uniqueness_of :name }
|
148
150
|
end
|
149
151
|
end
|
150
152
|
|
@@ -210,25 +212,27 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
210
212
|
# to_a to make query return instances
|
211
213
|
found_creds = workspace.creds.to_a
|
212
214
|
|
213
|
-
|
215
|
+
found_creds.length.should > 0
|
216
|
+
found_cred = found_creds.first
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
it 'should include hosts' do
|
221
|
+
found_creds = workspace.creds.to_a
|
214
222
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
}
|
219
|
-
).to eq(true)
|
223
|
+
found_creds.length.should > 0
|
224
|
+
found_cred = found_creds.first
|
225
|
+
service = found_cred.service
|
220
226
|
end
|
221
227
|
|
222
228
|
it 'should return only Mdm::Creds from hosts in workspace' do
|
223
229
|
found_creds = workspace.creds
|
224
230
|
|
225
|
-
|
231
|
+
found_creds.length.should == creds.length
|
226
232
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
}
|
231
|
-
).to eq(true)
|
233
|
+
found_creds.all? { |cred|
|
234
|
+
cred.service.host.workspace == workspace
|
235
|
+
}.should be_true
|
232
236
|
end
|
233
237
|
end
|
234
238
|
|
@@ -248,7 +252,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
248
252
|
workspace = described_class.default
|
249
253
|
}.to change(Mdm::Workspace, :count).by(0)
|
250
254
|
|
251
|
-
|
255
|
+
workspace.should be_default
|
252
256
|
end
|
253
257
|
end
|
254
258
|
|
@@ -260,7 +264,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
260
264
|
workspace = described_class.default
|
261
265
|
}.to change(Mdm::Workspace, :count).by(1)
|
262
266
|
|
263
|
-
|
267
|
+
workspace.should be_default
|
264
268
|
end
|
265
269
|
end
|
266
270
|
end
|
@@ -275,18 +279,20 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
275
279
|
workspace.name = default
|
276
280
|
end
|
277
281
|
|
278
|
-
it {
|
282
|
+
it {
|
283
|
+
should be_true
|
284
|
+
}
|
279
285
|
end
|
280
286
|
|
281
287
|
context 'without DEFAULT name' do
|
282
|
-
it {
|
288
|
+
it { should be_false }
|
283
289
|
end
|
284
290
|
end
|
285
291
|
|
286
292
|
context '#each_cred' do
|
287
293
|
it 'should pass each of the #creds to the block' do
|
288
294
|
creds = FactoryGirl.create_list(:mdm_cred, 2)
|
289
|
-
|
295
|
+
workspace.stub(:creds => creds)
|
290
296
|
|
291
297
|
expect { |block|
|
292
298
|
workspace.each_cred(&block)
|
@@ -297,7 +303,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
297
303
|
context '#each_host_tag' do
|
298
304
|
it 'should pass each of the #host_tags to the block' do
|
299
305
|
tags = FactoryGirl.create_list(:mdm_tag, 2)
|
300
|
-
|
306
|
+
workspace.stub(:host_tags => tags)
|
301
307
|
|
302
308
|
expect { |block|
|
303
309
|
workspace.each_host_tag(&block)
|
@@ -306,14 +312,6 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
306
312
|
end
|
307
313
|
|
308
314
|
context '#host_tags' do
|
309
|
-
subject(:host_tags) do
|
310
|
-
workspace.host_tags
|
311
|
-
end
|
312
|
-
|
313
|
-
#
|
314
|
-
# lets
|
315
|
-
#
|
316
|
-
|
317
315
|
let(:other_tags) do
|
318
316
|
FactoryGirl.create_list(
|
319
317
|
:mdm_tag,
|
@@ -328,11 +326,15 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
328
326
|
)
|
329
327
|
end
|
330
328
|
|
329
|
+
subject(:host_tags) do
|
330
|
+
workspace.host_tags
|
331
|
+
end
|
332
|
+
|
331
333
|
#
|
332
334
|
# Let!s (let + before(:each))
|
333
335
|
#
|
334
336
|
|
335
|
-
let!(:
|
337
|
+
let!(:host_tags) do
|
336
338
|
host_tags = []
|
337
339
|
|
338
340
|
hosts.zip(tags) do |host, tag|
|
@@ -344,7 +346,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
344
346
|
host_tags
|
345
347
|
end
|
346
348
|
|
347
|
-
let!(:
|
349
|
+
let!(:other_host_tags) do
|
348
350
|
host_tags = []
|
349
351
|
|
350
352
|
other_hosts.zip(other_tags) do |host, tag|
|
@@ -360,16 +362,24 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
360
362
|
should be_a ActiveRecord::Relation
|
361
363
|
end
|
362
364
|
|
365
|
+
it 'should include hosts' do
|
366
|
+
found_tags = workspace.host_tags.to_a
|
367
|
+
|
368
|
+
found_tags.length.should > 0
|
369
|
+
|
370
|
+
tag = found_tags.first
|
371
|
+
end
|
372
|
+
|
363
373
|
it 'should return only Mdm::Tags from hosts in the workspace' do
|
364
|
-
|
374
|
+
found_tags = workspace.host_tags
|
365
375
|
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
376
|
+
found_tags.length.should == tags.length
|
377
|
+
|
378
|
+
found_tags.all? { |tag|
|
379
|
+
tag.hosts.any? { |host|
|
380
|
+
host.workspace == workspace
|
381
|
+
}
|
382
|
+
}.should be_true
|
373
383
|
end
|
374
384
|
end
|
375
385
|
|
@@ -394,7 +404,7 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
394
404
|
it "should remove spaces" do
|
395
405
|
normalize
|
396
406
|
|
397
|
-
|
407
|
+
workspace.boundary.should == stripped_boundary
|
398
408
|
end
|
399
409
|
end
|
400
410
|
|
@@ -441,13 +451,11 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
441
451
|
it 'should return only Mdm::WebPages from hosts in the workspace' do
|
442
452
|
found_web_forms = workspace.web_forms
|
443
453
|
|
444
|
-
|
454
|
+
found_web_forms.length.should == web_forms.length
|
445
455
|
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
}
|
450
|
-
).to eq(true)
|
456
|
+
found_web_forms.all? { |web_form|
|
457
|
+
web_form.web_site.service.host.workspace == workspace
|
458
|
+
}.should be_true
|
451
459
|
end
|
452
460
|
end
|
453
461
|
|
@@ -472,17 +480,15 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
472
480
|
|
473
481
|
it 'should return only Mdm::WebVulns from hosts in the workspace' do
|
474
482
|
# there are more web sites than those in the workspace
|
475
|
-
|
483
|
+
Mdm::WebSite.count.should > web_sites.count
|
476
484
|
|
477
485
|
found_web_sites = workspace.web_sites
|
478
486
|
|
479
|
-
|
487
|
+
found_web_sites.length.should == web_sites.count
|
480
488
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
}
|
485
|
-
).to eq(true)
|
489
|
+
found_web_sites.all? { |web_site|
|
490
|
+
web_site.service.host.workspace == workspace
|
491
|
+
}.should be_true
|
486
492
|
end
|
487
493
|
end
|
488
494
|
|
@@ -513,17 +519,16 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
513
519
|
end
|
514
520
|
|
515
521
|
it 'should return only Mdm::WebVulns from hosts in the workspace' do
|
516
|
-
|
522
|
+
Mdm::WebVuln.count.should > web_vulns.length
|
517
523
|
|
518
524
|
found_web_vulns = workspace.web_vulns
|
519
525
|
|
520
|
-
|
526
|
+
found_web_vulns.length.should == web_vulns.length
|
527
|
+
|
528
|
+
found_web_vulns.all? { |web_vuln|
|
529
|
+
web_vuln.web_site.service.host.workspace == workspace
|
530
|
+
}.should be_true
|
521
531
|
|
522
|
-
expect(
|
523
|
-
found_web_vulns.all? { |web_vuln|
|
524
|
-
web_vuln.web_site.service.host.workspace == workspace
|
525
|
-
}
|
526
|
-
).to eq(true)
|
527
532
|
end
|
528
533
|
end
|
529
534
|
|
@@ -544,11 +549,9 @@ RSpec.describe Mdm::Workspace, type: :model do
|
|
544
549
|
it "should reject #unique_web_forms from host addresses that aren't in addresses" do
|
545
550
|
web_forms = workspace.web_unique_forms([selected_address])
|
546
551
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
}
|
551
|
-
).to eq(true)
|
552
|
+
web_forms.all? { |web_form|
|
553
|
+
web_form.web_site.service.host.address.should == selected_address
|
554
|
+
}.should be_true
|
552
555
|
end
|
553
556
|
end
|
554
557
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::AutomaticExploitation::MatchResult do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
6
|
context "database" do
|
@@ -9,8 +11,8 @@ RSpec.describe MetasploitDataModels::AutomaticExploitation::MatchResult, type: :
|
|
9
11
|
end
|
10
12
|
|
11
13
|
context 'associations' do
|
12
|
-
it {
|
13
|
-
it {
|
14
|
+
it { should belong_to(:match).class_name('MetasploitDataModels::AutomaticExploitation::Match') }
|
15
|
+
it { should belong_to(:run).class_name('MetasploitDataModels::AutomaticExploitation::Run') }
|
14
16
|
end
|
15
17
|
|
16
18
|
context 'scopes' do
|
@@ -1,25 +1,27 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::AutomaticExploitation::MatchSet do
|
2
4
|
describe "database" do
|
3
5
|
describe "foreign_keys" do
|
4
|
-
it {
|
5
|
-
it {
|
6
|
+
it { should have_db_column(:workspace_id).of_type(:integer) }
|
7
|
+
it { should have_db_column(:user_id).of_type(:integer) }
|
6
8
|
end
|
7
9
|
|
8
10
|
describe "indices" do
|
9
|
-
it {
|
10
|
-
it {
|
11
|
+
it { should have_db_index(:user_id) }
|
12
|
+
it { should have_db_index(:workspace_id) }
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
describe "associations" do
|
15
|
-
it {
|
16
|
-
it {
|
17
|
-
it {
|
18
|
-
it {
|
19
|
-
it {
|
20
|
-
it {
|
21
|
-
it {
|
22
|
-
it {
|
17
|
+
it { should have_many(:matches).class_name('MetasploitDataModels::AutomaticExploitation::Match') }
|
18
|
+
it { should have_many(:matches).inverse_of(:match_set) }
|
19
|
+
it { should have_many(:runs).class_name('MetasploitDataModels::AutomaticExploitation::Run') }
|
20
|
+
it { should have_many(:runs).inverse_of(:match_set) }
|
21
|
+
it { should belong_to(:user).class_name('Mdm::User') }
|
22
|
+
it { should belong_to(:user).inverse_of(:automatic_exploitation_match_sets) }
|
23
|
+
it { should belong_to(:workspace).class_name('Mdm::Workspace') }
|
24
|
+
it { should belong_to(:workspace).inverse_of(:automatic_exploitation_match_sets) }
|
23
25
|
end
|
24
26
|
|
25
27
|
describe "validations" do
|