metasploit_data_models 2.0.17 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.travis.yml +1 -1
- data/Gemfile +3 -8
- data/lib/mdm/host/operating_system_normalization.rb +2 -1
- data/lib/metasploit_data_models/engine.rb +7 -7
- data/lib/metasploit_data_models/version.rb +1 -1
- data/metasploit_data_models.gemspec +3 -1
- data/spec/app/models/mdm/client_spec.rb +3 -3
- data/spec/app/models/mdm/cred_spec.rb +34 -34
- data/spec/app/models/mdm/event_spec.rb +9 -9
- data/spec/app/models/mdm/exploit_attempt_spec.rb +5 -5
- data/spec/app/models/mdm/exploited_host_spec.rb +3 -3
- data/spec/app/models/mdm/host_detail_spec.rb +4 -4
- data/spec/app/models/mdm/host_spec.rb +47 -47
- data/spec/app/models/mdm/host_tag_spec.rb +5 -5
- data/spec/app/models/mdm/listener_spec.rb +12 -12
- data/spec/app/models/mdm/loot_spec.rb +8 -8
- data/spec/app/models/mdm/module/action_spec.rb +2 -2
- data/spec/app/models/mdm/module/arch_spec.rb +2 -2
- data/spec/app/models/mdm/module/author_spec.rb +3 -3
- data/spec/app/models/mdm/module/detail_spec.rb +71 -71
- data/spec/app/models/mdm/module/mixin_spec.rb +2 -2
- data/spec/app/models/mdm/module/platform_spec.rb +2 -2
- data/spec/app/models/mdm/module/ref_spec.rb +5 -5
- data/spec/app/models/mdm/module/target_spec.rb +2 -2
- data/spec/app/models/mdm/nexpose_console_spec.rb +15 -15
- data/spec/app/models/mdm/note_spec.rb +11 -11
- data/spec/app/models/mdm/ref_spec.rb +6 -6
- data/spec/app/models/mdm/route_spec.rb +3 -3
- data/spec/app/models/mdm/service_spec.rb +20 -20
- data/spec/app/models/mdm/session_event_spec.rb +3 -3
- data/spec/app/models/mdm/session_spec.rb +14 -14
- data/spec/app/models/mdm/tag_spec.rb +12 -12
- data/spec/app/models/mdm/task_cred_spec.rb +6 -6
- data/spec/app/models/mdm/task_host_spec.rb +6 -6
- data/spec/app/models/mdm/task_service_spec.rb +6 -6
- data/spec/app/models/mdm/task_session_spec.rb +6 -6
- data/spec/app/models/mdm/task_spec.rb +3 -3
- data/spec/app/models/mdm/user_spec.rb +3 -3
- data/spec/app/models/mdm/vuln_attempt_spec.rb +4 -4
- data/spec/app/models/mdm/vuln_detail_spec.rb +3 -3
- data/spec/app/models/mdm/vuln_ref_spec.rb +4 -4
- data/spec/app/models/mdm/vuln_spec.rb +20 -20
- data/spec/app/models/mdm/web_form_spec.rb +3 -3
- data/spec/app/models/mdm/web_page_spec.rb +4 -4
- data/spec/app/models/mdm/web_site_spec.rb +15 -15
- data/spec/app/models/mdm/web_vuln_spec.rb +4 -4
- data/spec/app/models/mdm/workspace_spec.rb +25 -25
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +4 -4
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +2 -2
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +3 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +5 -5
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +3 -3
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +4 -8
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +12 -12
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +16 -16
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +3 -3
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/db/structure.sql +2 -2
- data/spec/factories/mdm/addresses.rb +2 -2
- data/spec/factories/mdm/clients.rb +2 -2
- data/spec/factories/mdm/creds.rb +2 -2
- data/spec/factories/mdm/events.rb +3 -3
- data/spec/factories/mdm/exploit_attempts.rb +2 -2
- data/spec/factories/mdm/exploited_hosts.rb +1 -1
- data/spec/factories/mdm/fingerprints/nessus_fingerprints.rb +2 -2
- data/spec/factories/mdm/fingerprints/nexpose_fingerprints.rb +2 -2
- data/spec/factories/mdm/fingerprints/nmap_fingerprints.rb +2 -2
- data/spec/factories/mdm/fingerprints/retina_fingerprints.rb +2 -2
- data/spec/factories/mdm/fingerprints/session_fingerprints.rb +2 -2
- data/spec/factories/mdm/host_details.rb +2 -2
- data/spec/factories/mdm/host_tags.rb +2 -2
- data/spec/factories/mdm/hosts.rb +2 -2
- data/spec/factories/mdm/listeners.rb +2 -2
- data/spec/factories/mdm/loots.rb +2 -2
- data/spec/factories/mdm/module/actions.rb +2 -2
- data/spec/factories/mdm/module/archs.rb +2 -2
- data/spec/factories/mdm/module/authors.rb +2 -2
- data/spec/factories/mdm/module/details.rb +1 -1
- data/spec/factories/mdm/module/mixins.rb +2 -2
- data/spec/factories/mdm/module/platforms.rb +2 -2
- data/spec/factories/mdm/module/refs.rb +2 -2
- data/spec/factories/mdm/module/targets.rb +2 -2
- data/spec/factories/mdm/nexpose_consoles.rb +2 -2
- data/spec/factories/mdm/notes.rb +2 -2
- data/spec/factories/mdm/refs.rb +2 -2
- data/spec/factories/mdm/routes.rb +2 -2
- data/spec/factories/mdm/services.rb +3 -3
- data/spec/factories/mdm/session_events.rb +1 -1
- data/spec/factories/mdm/sessions.rb +2 -2
- data/spec/factories/mdm/tags.rb +2 -2
- data/spec/factories/mdm/task.rb +2 -2
- data/spec/factories/mdm/task_creds.rb +2 -2
- data/spec/factories/mdm/task_hosts.rb +2 -2
- data/spec/factories/mdm/task_services.rb +2 -2
- data/spec/factories/mdm/task_sessions.rb +2 -2
- data/spec/factories/mdm/users.rb +2 -2
- data/spec/factories/mdm/vuln_attempts.rb +2 -2
- data/spec/factories/mdm/vuln_details.rb +2 -2
- data/spec/factories/mdm/vuln_refs.rb +2 -2
- data/spec/factories/mdm/vulns.rb +2 -2
- data/spec/factories/mdm/web_forms.rb +1 -1
- data/spec/factories/mdm/web_pages.rb +2 -2
- data/spec/factories/mdm/web_sites.rb +2 -2
- data/spec/factories/mdm/web_vulns.rb +2 -2
- data/spec/factories/mdm/workspaces.rb +2 -2
- data/spec/factories/metasploit_data_models/automatic_exploitation/match_results.rb +1 -1
- data/spec/factories/metasploit_data_models/automatic_exploitation/match_sets.rb +2 -2
- data/spec/factories/metasploit_data_models/automatic_exploitation/matches.rb +1 -1
- data/spec/factories/metasploit_data_models/automatic_exploitation/runs.rb +1 -1
- data/spec/factories/module_runs.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data.tar.gz.sig +0 -0
- metadata +7 -7
- metadata.gz.sig +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec.describe Mdm::Module::Detail, type: :model do
|
2
2
|
subject(:detail) do
|
3
|
-
|
3
|
+
FactoryBot.build(
|
4
4
|
:mdm_module_detail,
|
5
5
|
:mtype => mtype,
|
6
6
|
:stance => stance
|
@@ -8,7 +8,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:mtype) do
|
11
|
-
|
11
|
+
FactoryBot.generate :mdm_module_detail_mtype
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:ranks) do
|
@@ -24,7 +24,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
let(:stance) do
|
27
|
-
|
27
|
+
FactoryBot.generate :mdm_module_detail_stance
|
28
28
|
end
|
29
29
|
|
30
30
|
let(:stances) do
|
@@ -172,14 +172,14 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
172
172
|
context 'factories' do
|
173
173
|
context 'mdm_module_detail' do
|
174
174
|
subject(:mdm_module_detail) do
|
175
|
-
|
175
|
+
FactoryBot.build(:mdm_module_detail)
|
176
176
|
end
|
177
177
|
|
178
178
|
it { is_expected.to be_valid }
|
179
179
|
|
180
180
|
context 'stance' do
|
181
181
|
subject(:mdm_module_detail) do
|
182
|
-
|
182
|
+
FactoryBot.build(:mdm_module_detail, :mtype => mtype)
|
183
183
|
end
|
184
184
|
|
185
185
|
context 'with supports_stance?' do
|
@@ -236,31 +236,31 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
236
236
|
context 'scopes' do
|
237
237
|
|
238
238
|
before(:each) do
|
239
|
-
@ms12_020 =
|
239
|
+
@ms12_020 = FactoryBot.create(:mdm_module_detail,
|
240
240
|
name: "MS12-020 Microsoft Remote Desktop Use-After-Free DoS",
|
241
241
|
fullname: 'auxiliary/dos/windows/rdp/ms12_020_maxchannelids',
|
242
242
|
description: "This module exploits the MS12-020 RDP vulnerability originally discovered and\n reported by Luigi Auriemma. The flaw can be found in the way the T.125\n ConnectMCSPDU packet is handled in the maxChannelIDs field, which will result\n an invalid pointer being used, therefore causing a denial-of-service condition.",
|
243
243
|
mtype: 'auxiliary',
|
244
244
|
stance: 'aggressive')
|
245
|
-
@ms08_067 =
|
245
|
+
@ms08_067 = FactoryBot.create(:mdm_module_detail,
|
246
246
|
name: "MS08-067 Microsoft Server Service Relative Path Stack Corruption",
|
247
247
|
fullname: 'exploit/windows/smb/ms08_067_netapi',
|
248
248
|
description: "This module exploits a parsing flaw in the path canonicalization code of\n NetAPI32.dll through the Server Service. This module is capable of bypassing\n NX on some operating systems and service packs. The correct target must be\n used to prevent the Server Service (along with a dozen others in the same\n process) from crashing. Windows XP targets seem to handle multiple successful\n exploitation events, but 2003 targets will often crash or hang on subsequent\n attempts. This is just the first version of this module, full support for\n NX bypass on 2003, along with other platforms, is still in development.",
|
249
249
|
mtype: 'exploit',
|
250
250
|
stance: 'aggressive')
|
251
|
-
@ms06_040 =
|
251
|
+
@ms06_040 = FactoryBot.create(:mdm_module_detail,
|
252
252
|
name: "MS06-040 Microsoft Server Service NetpwPathCanonicalize Overflow",
|
253
253
|
fullname: 'exploit/windows/smb/ms06_040_netapi',
|
254
254
|
description: "This module exploits a stack buffer overflow in the NetApi32 CanonicalizePathName() function\n using the NetpwPathCanonicalize RPC call in the Server Service. It is likely that\n other RPC calls could be used to exploit this service. This exploit will result in\n a denial of service on Windows XP SP2 or Windows 2003 SP1. A failed exploit attempt\n will likely result in a complete reboot on Windows 2000 and the termination of all\n SMB-related services on Windows XP. The default target for this exploit should succeed\n on Windows NT 4.0, Windows 2000 SP0-SP4+, Windows XP SP0-SP1 and Windows 2003 SP0.",
|
255
255
|
mtype: 'exploit',
|
256
256
|
stance: 'aggressive')
|
257
|
-
@cve_2012_0507 =
|
257
|
+
@cve_2012_0507 = FactoryBot.create(:mdm_module_detail,
|
258
258
|
name: "Java AtomicReferenceArray Type Violation Vulnerability",
|
259
259
|
fullname: 'exploit/multi/browser/java_atomicreferencearray',
|
260
260
|
description: "This module exploits a vulnerability due to the fact that\n AtomicReferenceArray uses the Unsafe class to store a reference in an\n array directly, which may violate type safety if not used properly.\n This allows a way to escape the JRE sandbox, and load additional classes\n in order to perform malicious operations.",
|
261
261
|
mtype: 'exploit',
|
262
262
|
stance: 'passive')
|
263
|
-
@cve_2010_0425 =
|
263
|
+
@cve_2010_0425 = FactoryBot.create(:mdm_module_detail,
|
264
264
|
name: "PHP Remote File Include Generic Code Execution",
|
265
265
|
fullname: 'exploit/unix/webapp/php_include',
|
266
266
|
description: "This module can be used to exploit any generic PHP file include vulnerability,\n where the application includes code like the following:\n\n <?php include($_GET['path']); ?>",
|
@@ -272,58 +272,58 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
272
272
|
@author3 = "juan vazquez <juan.vazquez@metasploit.com>"
|
273
273
|
@author4 = "egypt <egypt@metasploit.com>"
|
274
274
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
275
|
+
FactoryBot.create(:mdm_module_author, detail: @ms12_020, name: @author2)
|
276
|
+
FactoryBot.create(:mdm_module_author, detail: @ms08_067, name: @author1)
|
277
|
+
FactoryBot.create(:mdm_module_author, detail: @ms08_067, name: @author2)
|
278
|
+
FactoryBot.create(:mdm_module_author, detail: @ms06_040, name: @author1)
|
279
|
+
FactoryBot.create(:mdm_module_author, detail: @cve_2012_0507, name: @author3)
|
280
|
+
FactoryBot.create(:mdm_module_author, detail: @cve_2012_0507, name: @author4)
|
281
|
+
|
282
|
+
FactoryBot.create(:mdm_module_platform, detail: @ms12_020, name: 'windows')
|
283
|
+
FactoryBot.create(:mdm_module_platform, detail: @ms08_067, name: 'windows')
|
284
|
+
FactoryBot.create(:mdm_module_platform, detail: @ms06_040, name: 'windows')
|
285
|
+
FactoryBot.create(:mdm_module_platform, detail: @cve_2012_0507, name: 'linux')
|
286
|
+
FactoryBot.create(:mdm_module_platform, detail: @cve_2012_0507, name: 'java')
|
287
|
+
|
288
|
+
FactoryBot.create(:mdm_module_arch, detail: @cve_2012_0507, name: '["ppc"]')
|
289
|
+
FactoryBot.create(:mdm_module_arch, detail: @cve_2012_0507, name: '["x86"]')
|
290
|
+
FactoryBot.create(:mdm_module_arch, detail: @cve_2012_0507, name: '["java"]')
|
291
|
+
FactoryBot.create(:mdm_module_arch, detail: @cve_2010_0425, name: 'php')
|
292
|
+
|
293
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms12_020, name: 'EDB-18606')
|
294
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms12_020, name: 'MSB-MS12-020')
|
295
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms12_020, name: 'CVE-2012-0002')
|
296
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms08_067, name: 'MSB-MS08-067')
|
297
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms08_067, name: 'OSVDB-49243')
|
298
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms08_067, name: 'CVE-2008-4250')
|
299
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms06_040, name: 'MSB-MS06-040')
|
300
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms06_040, name: 'BID-19409')
|
301
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms06_040, name: 'OSVDB-27845')
|
302
|
+
FactoryBot.create(:mdm_module_ref, detail: @ms06_040, name: 'CVE-2006-3439')
|
303
|
+
FactoryBot.create(:mdm_module_ref, detail: @cve_2012_0507, name: 'BID-52161')
|
304
|
+
FactoryBot.create(:mdm_module_ref, detail: @cve_2012_0507, name: 'OSVDB-80724')
|
305
|
+
FactoryBot.create(:mdm_module_ref, detail: @cve_2012_0507, name: 'CVE-2012-0507')
|
306
|
+
|
307
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP2 English (NX)')
|
308
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP2 English (NO NX)')
|
309
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP1 English (NX)')
|
310
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP1 English (NO NX)')
|
311
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP3 English (NX)')
|
312
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP3 English (AlwaysOn NX)')
|
313
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP2 English (NX)')
|
314
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP2 English (AlwaysOn NX)')
|
315
|
+
FactoryBot.create(:mdm_module_target, detail: @ms08_067, name: 'Automatic Targeting')
|
316
|
+
FactoryBot.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Windows 2003 SP0')
|
317
|
+
FactoryBot.create(:mdm_module_target, detail: @ms06_040, name: '(stack) Windows XP SP1 English')
|
318
|
+
FactoryBot.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Windows XP SP0/SP1')
|
319
|
+
FactoryBot.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Windows NT 4.0 / Windows 2000 SP0-SP4')
|
320
|
+
FactoryBot.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Automatic (NT 4.0, 2000 SP0-SP4, XP SP0-SP1)')
|
321
|
+
FactoryBot.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Linux x86 (Native Payload)')
|
322
|
+
FactoryBot.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Mac OS X x86 (Native Payload)')
|
323
|
+
FactoryBot.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Mac OS X PPC (Native Payload)')
|
324
|
+
FactoryBot.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Windows x86 (Native Payload)')
|
325
|
+
FactoryBot.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Generic (Java Payload)')
|
326
|
+
FactoryBot.create(:mdm_module_target, detail: @cve_2010_0425, name: 'Automatic')
|
327
327
|
end
|
328
328
|
|
329
329
|
context '#module_arch' do
|
@@ -473,7 +473,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
473
473
|
end
|
474
474
|
|
475
475
|
let(:name) do
|
476
|
-
|
476
|
+
FactoryBot.generate :mdm_module_action_name
|
477
477
|
end
|
478
478
|
|
479
479
|
it 'should add an Mdm::Action under the Mdm::ModuleDetail' do
|
@@ -505,7 +505,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
505
505
|
end
|
506
506
|
|
507
507
|
let(:name) do
|
508
|
-
|
508
|
+
FactoryBot.generate :mdm_module_arch_name
|
509
509
|
end
|
510
510
|
|
511
511
|
it 'should add an Mdm::ModuleArch under the Mdm::ModuleDetail' do
|
@@ -533,7 +533,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
533
533
|
|
534
534
|
context '#add_author' do
|
535
535
|
let(:name) do
|
536
|
-
|
536
|
+
FactoryBot.generate :mdm_module_author_name
|
537
537
|
end
|
538
538
|
|
539
539
|
context 'with email' do
|
@@ -542,7 +542,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
542
542
|
end
|
543
543
|
|
544
544
|
let(:email) do
|
545
|
-
|
545
|
+
FactoryBot.generate :mdm_module_author_email
|
546
546
|
end
|
547
547
|
|
548
548
|
it 'should add an Mdm::ModuleAuthor under the Mdm::ModuleDetail' do
|
@@ -617,7 +617,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
617
617
|
end
|
618
618
|
|
619
619
|
let(:name) do
|
620
|
-
|
620
|
+
FactoryBot.generate :mdm_module_mixin_name
|
621
621
|
end
|
622
622
|
|
623
623
|
it 'should add an Mdm::ModuleMixin under the Mdm::ModuleDetail' do
|
@@ -649,7 +649,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
649
649
|
end
|
650
650
|
|
651
651
|
let(:name) do
|
652
|
-
|
652
|
+
FactoryBot.generate :mdm_module_platform_name
|
653
653
|
end
|
654
654
|
|
655
655
|
it 'should add an Mdm::ModulePlatform under the Mdm::ModuleDetail' do
|
@@ -681,7 +681,7 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
681
681
|
end
|
682
682
|
|
683
683
|
let(:name) do
|
684
|
-
|
684
|
+
FactoryBot.generate :mdm_module_ref_name
|
685
685
|
end
|
686
686
|
|
687
687
|
it 'should add an Mdm::ModuleRef under the Mdm::ModuleDetail' do
|
@@ -713,11 +713,11 @@ RSpec.describe Mdm::Module::Detail, type: :model do
|
|
713
713
|
end
|
714
714
|
|
715
715
|
let(:index) do
|
716
|
-
|
716
|
+
FactoryBot.generate :mdm_module_target_index
|
717
717
|
end
|
718
718
|
|
719
719
|
let(:name) do
|
720
|
-
|
720
|
+
FactoryBot.generate :mdm_module_target_name
|
721
721
|
end
|
722
722
|
|
723
723
|
it 'should add an Mdm::ModuleTarget under the Mdm::ModuleDetail' do
|
@@ -20,7 +20,7 @@ RSpec.describe Mdm::Module::Mixin, type: :model do
|
|
20
20
|
context 'factories' do
|
21
21
|
context 'mdm_module_mixin' do
|
22
22
|
subject(:mdm_module_mixin) do
|
23
|
-
|
23
|
+
FactoryBot.build :mdm_module_mixin
|
24
24
|
end
|
25
25
|
|
26
26
|
it { is_expected.to be_valid }
|
@@ -31,4 +31,4 @@ RSpec.describe Mdm::Module::Mixin, type: :model do
|
|
31
31
|
it { is_expected.to validate_presence_of(:detail) }
|
32
32
|
it { is_expected.to validate_presence_of(:name) }
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
@@ -20,7 +20,7 @@ RSpec.describe Mdm::Module::Platform, type: :model do
|
|
20
20
|
context 'factories' do
|
21
21
|
context 'mdm_module_platform' do
|
22
22
|
subject(:mdm_module_platform) do
|
23
|
-
|
23
|
+
FactoryBot.build :mdm_module_platform
|
24
24
|
end
|
25
25
|
|
26
26
|
it { is_expected.to be_valid }
|
@@ -31,4 +31,4 @@ RSpec.describe Mdm::Module::Platform, type: :model do
|
|
31
31
|
it { is_expected.to validate_presence_of :detail }
|
32
32
|
it { is_expected.to validate_presence_of :name }
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
@@ -11,15 +11,15 @@ RSpec.describe Mdm::Module::Ref, type: :model do
|
|
11
11
|
context 'with Mdm::Refs' do
|
12
12
|
context 'with same name' do
|
13
13
|
let(:name) do
|
14
|
-
|
14
|
+
FactoryBot.generate :mdm_module_ref_name
|
15
15
|
end
|
16
16
|
|
17
17
|
let!(:module_ref) do
|
18
|
-
|
18
|
+
FactoryBot.create(:mdm_module_ref, :name => name)
|
19
19
|
end
|
20
20
|
|
21
21
|
let!(:ref) do
|
22
|
-
|
22
|
+
FactoryBot.create(:mdm_ref, :name => name)
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have refs in association' do
|
@@ -44,7 +44,7 @@ RSpec.describe Mdm::Module::Ref, type: :model do
|
|
44
44
|
context 'factories' do
|
45
45
|
context 'mdm_module_ref' do
|
46
46
|
subject(:mdm_module_ref) do
|
47
|
-
|
47
|
+
FactoryBot.build :mdm_module_ref
|
48
48
|
end
|
49
49
|
|
50
50
|
it { is_expected.to be_valid }
|
@@ -55,4 +55,4 @@ RSpec.describe Mdm::Module::Ref, type: :model do
|
|
55
55
|
it { is_expected.to validate_presence_of(:detail) }
|
56
56
|
it { is_expected.to validate_presence_of(:name) }
|
57
57
|
end
|
58
|
-
end
|
58
|
+
end
|
@@ -21,7 +21,7 @@ RSpec.describe Mdm::Module::Target, type: :model do
|
|
21
21
|
context 'factories' do
|
22
22
|
context 'mdm_module_target' do
|
23
23
|
subject(:mdm_module_target) do
|
24
|
-
|
24
|
+
FactoryBot.build :mdm_module_target
|
25
25
|
end
|
26
26
|
|
27
27
|
it { is_expected.to be_valid }
|
@@ -33,4 +33,4 @@ RSpec.describe Mdm::Module::Target, type: :model do
|
|
33
33
|
it { is_expected.to validate_presence_of(:index) }
|
34
34
|
it { is_expected.to validate_presence_of(:name) }
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
@@ -3,7 +3,7 @@ RSpec.describe Mdm::NexposeConsole, type: :model do
|
|
3
3
|
|
4
4
|
context 'factory' do
|
5
5
|
it 'should be valid' do
|
6
|
-
nexpose_console =
|
6
|
+
nexpose_console = FactoryBot.build(:mdm_nexpose_console)
|
7
7
|
expect(nexpose_console).to be_valid
|
8
8
|
end
|
9
9
|
end
|
@@ -32,7 +32,7 @@ RSpec.describe Mdm::NexposeConsole, type: :model do
|
|
32
32
|
|
33
33
|
context '#destroy' do
|
34
34
|
it 'should successfully destroy the object' do
|
35
|
-
nexpose_console =
|
35
|
+
nexpose_console = FactoryBot.create(:mdm_nexpose_console)
|
36
36
|
expect {
|
37
37
|
nexpose_console.destroy
|
38
38
|
}.to_not raise_error
|
@@ -45,49 +45,49 @@ RSpec.describe Mdm::NexposeConsole, type: :model do
|
|
45
45
|
context 'validations' do
|
46
46
|
context 'address' do
|
47
47
|
it 'should require an address' do
|
48
|
-
addressless_nexpose_console =
|
48
|
+
addressless_nexpose_console = FactoryBot.build(:mdm_nexpose_console, :address => nil)
|
49
49
|
expect(addressless_nexpose_console).not_to be_valid
|
50
50
|
expect(addressless_nexpose_console.errors[:address]).to include("can't be blank")
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should be valid for IPv4 format' do
|
54
|
-
ipv4_nexpose_console =
|
54
|
+
ipv4_nexpose_console = FactoryBot.build(:mdm_nexpose_console, :address => '192.168.1.120')
|
55
55
|
expect(ipv4_nexpose_console).to be_valid
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should be valid for IPv6 format' do
|
59
|
-
ipv6_nexpose_console =
|
59
|
+
ipv6_nexpose_console = FactoryBot.build(:mdm_nexpose_console, :address => '2001:0db8:85a3:0000:0000:8a2e:0370:7334')
|
60
60
|
expect(ipv6_nexpose_console).to be_valid
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'port' do
|
65
65
|
it 'should require a port' do
|
66
|
-
portless_nexpose_console =
|
66
|
+
portless_nexpose_console = FactoryBot.build(:mdm_nexpose_console, :port => nil)
|
67
67
|
expect(portless_nexpose_console).not_to be_valid
|
68
68
|
expect(portless_nexpose_console.errors[:port]).to include("is not included in the list")
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should not be valid for out-of-range numbers' do
|
72
|
-
out_of_range =
|
72
|
+
out_of_range = FactoryBot.build(:mdm_nexpose_console, :port => 70000)
|
73
73
|
expect(out_of_range).not_to be_valid
|
74
74
|
expect(out_of_range.errors[:port]).to include("is not included in the list")
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'should not be valid for port 0' do
|
78
|
-
out_of_range =
|
78
|
+
out_of_range = FactoryBot.build(:mdm_nexpose_console, :port => 0)
|
79
79
|
expect(out_of_range).not_to be_valid
|
80
80
|
expect(out_of_range.errors[:port]).to include("is not included in the list")
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'should not be valid for decimal numbers' do
|
84
|
-
out_of_range =
|
84
|
+
out_of_range = FactoryBot.build(:mdm_nexpose_console, :port => 5.67)
|
85
85
|
expect(out_of_range).not_to be_valid
|
86
86
|
expect(out_of_range.errors[:port]).to include("must be an integer")
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'should not be valid for a negative number' do
|
90
|
-
out_of_range =
|
90
|
+
out_of_range = FactoryBot.build(:mdm_nexpose_console, :port => -8)
|
91
91
|
expect(out_of_range).not_to be_valid
|
92
92
|
expect(out_of_range.errors[:port]).to include("is not included in the list")
|
93
93
|
end
|
@@ -95,7 +95,7 @@ RSpec.describe Mdm::NexposeConsole, type: :model do
|
|
95
95
|
|
96
96
|
context 'name' do
|
97
97
|
it 'should require a name' do
|
98
|
-
unnamed_console =
|
98
|
+
unnamed_console = FactoryBot.build(:mdm_nexpose_console, :name => nil)
|
99
99
|
expect(unnamed_console).not_to be_valid
|
100
100
|
expect(unnamed_console.errors[:name]).to include("can't be blank")
|
101
101
|
end
|
@@ -103,7 +103,7 @@ RSpec.describe Mdm::NexposeConsole, type: :model do
|
|
103
103
|
|
104
104
|
context 'username' do
|
105
105
|
it 'should require a name' do
|
106
|
-
console =
|
106
|
+
console = FactoryBot.build(:mdm_nexpose_console, :username => nil)
|
107
107
|
expect(console).not_to be_valid
|
108
108
|
expect(console.errors[:username]).to include("can't be blank")
|
109
109
|
end
|
@@ -111,7 +111,7 @@ RSpec.describe Mdm::NexposeConsole, type: :model do
|
|
111
111
|
|
112
112
|
context 'password' do
|
113
113
|
it 'should require a password' do
|
114
|
-
console =
|
114
|
+
console = FactoryBot.build(:mdm_nexpose_console, :password => nil)
|
115
115
|
expect(console).not_to be_valid
|
116
116
|
expect(console.errors[:password]).to include("can't be blank")
|
117
117
|
end
|
@@ -122,11 +122,11 @@ RSpec.describe Mdm::NexposeConsole, type: :model do
|
|
122
122
|
context 'callbacks' do
|
123
123
|
describe '#strip_protocol' do
|
124
124
|
it 'should strip protocol handlers from the front of the address' do
|
125
|
-
nexpose_console =
|
125
|
+
nexpose_console = FactoryBot.create(:mdm_nexpose_console, :address => 'https://foo.bar.com')
|
126
126
|
expect(nexpose_console.address).to eq 'foo.bar.com'
|
127
127
|
end
|
128
128
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
end
|
132
|
+
end
|
@@ -3,7 +3,7 @@ RSpec.describe Mdm::Note, type: :model do
|
|
3
3
|
|
4
4
|
context 'factory' do
|
5
5
|
it 'should be valid' do
|
6
|
-
note =
|
6
|
+
note = FactoryBot.build(:mdm_note)
|
7
7
|
expect(note).to be_valid
|
8
8
|
end
|
9
9
|
end
|
@@ -29,7 +29,7 @@ RSpec.describe Mdm::Note, type: :model do
|
|
29
29
|
|
30
30
|
context '#destroy' do
|
31
31
|
it 'should successfully destroy the object' do
|
32
|
-
note =
|
32
|
+
note = FactoryBot.create(:mdm_note)
|
33
33
|
expect {
|
34
34
|
note.destroy
|
35
35
|
}.to_not raise_error
|
@@ -49,16 +49,16 @@ RSpec.describe Mdm::Note, type: :model do
|
|
49
49
|
context 'scopes' do
|
50
50
|
context 'flagged' do
|
51
51
|
it 'should exclude non-critical note' do
|
52
|
-
flagged_note =
|
53
|
-
non_critical_note =
|
52
|
+
flagged_note = FactoryBot.create(:mdm_note, :critical => true, :seen => false)
|
53
|
+
non_critical_note = FactoryBot.create(:mdm_note, :critical => false, :seen => false)
|
54
54
|
flagged_set = Mdm::Note.flagged
|
55
55
|
expect(flagged_set).to include(flagged_note)
|
56
56
|
expect(flagged_set).not_to include(non_critical_note)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should exclude seen notes' do
|
60
|
-
flagged_note =
|
61
|
-
non_critical_note =
|
60
|
+
flagged_note = FactoryBot.create(:mdm_note, :critical => true, :seen => false)
|
61
|
+
non_critical_note = FactoryBot.create(:mdm_note, :critical => false, :seen => true)
|
62
62
|
flagged_set = Mdm::Note.flagged
|
63
63
|
expect(flagged_set).to include(flagged_note)
|
64
64
|
expect(flagged_set).not_to include(non_critical_note)
|
@@ -67,8 +67,8 @@ RSpec.describe Mdm::Note, type: :model do
|
|
67
67
|
|
68
68
|
context 'visible' do
|
69
69
|
it 'should only include visible notes' do
|
70
|
-
flagged_note =
|
71
|
-
webform_note =
|
70
|
+
flagged_note = FactoryBot.create(:mdm_note, :ntype => 'flag.me', :critical => true, :seen => false)
|
71
|
+
webform_note = FactoryBot.create(:mdm_note, :ntype => 'web.form', :critical => true, :seen => false)
|
72
72
|
visible_set = Mdm::Note.visible
|
73
73
|
expect(visible_set).to include(flagged_note)
|
74
74
|
expect(visible_set).not_to include(webform_note)
|
@@ -77,15 +77,15 @@ RSpec.describe Mdm::Note, type: :model do
|
|
77
77
|
|
78
78
|
context 'search' do
|
79
79
|
it 'should match on ntype' do
|
80
|
-
flagged_note =
|
80
|
+
flagged_note = FactoryBot.create(:mdm_note, :ntype => 'flag.me', :critical => true, :seen => false)
|
81
81
|
expect(Mdm::Note.search('flag.me')).to include(flagged_note)
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'should match on host name' do
|
85
|
-
flagged_note =
|
85
|
+
flagged_note = FactoryBot.create(:mdm_note, :seen => false)
|
86
86
|
host_name = flagged_note.host.name
|
87
87
|
expect(Mdm::Note.search(host_name)).to include(flagged_note)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
-
end
|
91
|
+
end
|
@@ -8,15 +8,15 @@ RSpec.describe Mdm::Ref, type: :model do
|
|
8
8
|
context 'with Mdm::Module::Refs' do
|
9
9
|
context 'with same name' do
|
10
10
|
let(:name) do
|
11
|
-
|
11
|
+
FactoryBot.generate :mdm_ref_name
|
12
12
|
end
|
13
13
|
|
14
14
|
let!(:module_ref) do
|
15
|
-
|
15
|
+
FactoryBot.create(:mdm_module_ref, :name => name)
|
16
16
|
end
|
17
17
|
|
18
18
|
let!(:ref) do
|
19
|
-
|
19
|
+
FactoryBot.create(:mdm_ref, :name => name)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should have module_refs in assocation' do
|
@@ -50,7 +50,7 @@ RSpec.describe Mdm::Ref, type: :model do
|
|
50
50
|
context 'factories' do
|
51
51
|
context 'mdm_ref' do
|
52
52
|
subject(:mdm_ref) do
|
53
|
-
|
53
|
+
FactoryBot.build :mdm_ref
|
54
54
|
end
|
55
55
|
|
56
56
|
it { is_expected.to be_valid }
|
@@ -59,7 +59,7 @@ RSpec.describe Mdm::Ref, type: :model do
|
|
59
59
|
|
60
60
|
context '#destroy' do
|
61
61
|
it 'should successfully destroy the object' do
|
62
|
-
mdm_ref =
|
62
|
+
mdm_ref = FactoryBot.create(:mdm_ref)
|
63
63
|
expect {
|
64
64
|
mdm_ref.destroy
|
65
65
|
}.to_not raise_error
|
@@ -68,4 +68,4 @@ RSpec.describe Mdm::Ref, type: :model do
|
|
68
68
|
}.to raise_error(ActiveRecord::RecordNotFound)
|
69
69
|
end
|
70
70
|
end
|
71
|
-
end
|
71
|
+
end
|
@@ -7,14 +7,14 @@ RSpec.describe Mdm::Route, type: :model do
|
|
7
7
|
|
8
8
|
context 'factory' do
|
9
9
|
it 'should be valid' do
|
10
|
-
route =
|
10
|
+
route = FactoryBot.build(:mdm_route)
|
11
11
|
expect(route).to be_valid
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
context '#destroy' do
|
16
16
|
it 'should successfully destroy the object' do
|
17
|
-
route =
|
17
|
+
route = FactoryBot.create(:mdm_route)
|
18
18
|
expect {
|
19
19
|
route.destroy
|
20
20
|
}.to_not raise_error
|
@@ -32,4 +32,4 @@ RSpec.describe Mdm::Route, type: :model do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
end
|
35
|
+
end
|