metasploit-credential 2.0.14 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/metasploit/credential/engine.rb +2 -2
- data/lib/metasploit/credential/version.rb +3 -3
- data/spec/dummy/config/database.yml +2 -2
- data/spec/factories/metasploit/credential/blank_usernames.rb +1 -1
- data/spec/factories/metasploit/credential/cores.rb +6 -6
- data/spec/factories/metasploit/credential/importer/cores.rb +2 -2
- data/spec/factories/metasploit/credential/importer/pwdumps.rb +3 -3
- data/spec/factories/metasploit/credential/importer/zips.rb +8 -8
- data/spec/factories/metasploit/credential/logins.rb +3 -3
- data/spec/factories/metasploit/credential/nonreplayable_hashes.rb +1 -1
- data/spec/factories/metasploit/credential/ntlm_hashes.rb +1 -1
- data/spec/factories/metasploit/credential/origin/imports.rb +1 -1
- data/spec/factories/metasploit/credential/origin/manuals.rb +1 -1
- data/spec/factories/metasploit/credential/origin/services.rb +1 -1
- data/spec/factories/metasploit/credential/origin/sessions.rb +1 -1
- data/spec/factories/metasploit/credential/password_hashes.rb +1 -1
- data/spec/factories/metasploit/credential/passwords.rb +1 -1
- data/spec/factories/metasploit/credential/postgres_md5.rb +1 -1
- data/spec/factories/metasploit/credential/privates.rb +1 -1
- data/spec/factories/metasploit/credential/publics.rb +2 -2
- data/spec/factories/metasploit/credential/realms.rb +1 -1
- data/spec/factories/metasploit/credential/replayable_hashes.rb +1 -1
- data/spec/factories/metasploit/credential/ssh_keys.rb +1 -1
- data/spec/factories/metasploit/credential/usernames.rb +1 -1
- data/spec/lib/metasploit/credential/creation_spec.rb +52 -52
- data/spec/lib/metasploit/credential/exporter/core_spec.rb +3 -3
- data/spec/lib/metasploit/credential/exporter/pwdump_spec.rb +11 -11
- data/spec/lib/metasploit/credential/importer/core_spec.rb +19 -19
- data/spec/lib/metasploit/credential/importer/multi_spec.rb +4 -4
- data/spec/lib/metasploit/credential/importer/pwdump_spec.rb +3 -3
- data/spec/lib/metasploit/credential/importer/zip_spec.rb +3 -3
- data/spec/lib/metasploit/credential/migrator_spec.rb +22 -22
- data/spec/models/metasploit/credential/core_spec.rb +42 -42
- data/spec/models/metasploit/credential/login_spec.rb +20 -20
- data/spec/models/metasploit/credential/nonreplayable_hash_spec.rb +1 -1
- data/spec/models/metasploit/credential/ntlm_hash_spec.rb +5 -5
- data/spec/models/metasploit/credential/origin/import_spec.rb +1 -1
- data/spec/models/metasploit/credential/origin/manual_spec.rb +1 -1
- data/spec/models/metasploit/credential/origin/service_spec.rb +3 -3
- data/spec/models/metasploit/credential/origin/session_spec.rb +2 -2
- data/spec/models/metasploit/credential/password_hash_spec.rb +1 -1
- data/spec/models/metasploit/credential/password_spec.rb +1 -1
- data/spec/models/metasploit/credential/postgres_md5_spec.rb +3 -3
- data/spec/models/metasploit/credential/private_spec.rb +6 -6
- data/spec/models/metasploit/credential/public_spec.rb +1 -1
- data/spec/models/metasploit/credential/realm_spec.rb +9 -9
- data/spec/models/metasploit/credential/replayable_hash_spec.rb +1 -1
- data/spec/models/metasploit/credential/ssh_key_spec.rb +9 -27
- data/spec/models/metasploit/credential/username_spec.rb +1 -1
- data/spec/models/metasploit_data_models/search/visitor/relation_spec.rb +30 -30
- data/spec/support/shared/contexts/metasploit/credential/exporter/export_objects.rb +18 -18
- data/spec/support/shared/examples/core_validations.rb +38 -38
- metadata +18 -4
- metadata.gz.sig +0 -0
@@ -6,7 +6,7 @@ RSpec.describe Metasploit::Credential::ReplayableHash, type: :model do
|
|
6
6
|
context 'factories' do
|
7
7
|
context 'metasploit_credential_replayable_hash' do
|
8
8
|
subject(:metasploit_credential_replayable_hash) do
|
9
|
-
|
9
|
+
FactoryBot.build(:metasploit_credential_replayable_hash)
|
10
10
|
end
|
11
11
|
|
12
12
|
it { is_expected.to be_valid }
|
@@ -13,7 +13,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
13
13
|
context 'factories' do
|
14
14
|
context 'metasploit_credential_dsa_key' do
|
15
15
|
subject(:metasploit_credential_dsa_key) do
|
16
|
-
|
16
|
+
FactoryBot.build(:metasploit_credential_dsa_key)
|
17
17
|
end
|
18
18
|
|
19
19
|
it { is_expected.to be_valid }
|
@@ -26,7 +26,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
26
26
|
|
27
27
|
context 'metasploit_credential_rsa_key' do
|
28
28
|
subject(:metasploit_credential_rsa_key) do
|
29
|
-
|
29
|
+
FactoryBot.build(:metasploit_credential_rsa_key)
|
30
30
|
end
|
31
31
|
|
32
32
|
it { is_expected.to be_valid }
|
@@ -39,7 +39,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
39
39
|
|
40
40
|
context 'metasploit_credential_ssh_key' do
|
41
41
|
subject(:metasploit_credential_ssh_key) do
|
42
|
-
|
42
|
+
FactoryBot.build(:metasploit_credential_ssh_key)
|
43
43
|
end
|
44
44
|
|
45
45
|
it { is_expected.to be_valid }
|
@@ -55,7 +55,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
let(:ssh_key) do
|
58
|
-
|
58
|
+
FactoryBot.build(:metasploit_credential_ssh_key)
|
59
59
|
end
|
60
60
|
|
61
61
|
context '#private' do
|
@@ -217,7 +217,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
217
217
|
|
218
218
|
context '#encrypted?' do
|
219
219
|
subject(:ssh_key) do
|
220
|
-
|
220
|
+
FactoryBot.build(
|
221
221
|
:metasploit_credential_ssh_key,
|
222
222
|
data: data
|
223
223
|
)
|
@@ -289,7 +289,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
289
289
|
#
|
290
290
|
|
291
291
|
let(:ssh_key) do
|
292
|
-
|
292
|
+
FactoryBot.build(
|
293
293
|
:metasploit_credential_ssh_key,
|
294
294
|
data: data
|
295
295
|
)
|
@@ -318,12 +318,6 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
318
318
|
let(:password) do
|
319
319
|
cipher.random_key
|
320
320
|
end
|
321
|
-
|
322
|
-
specify {
|
323
|
-
expect {
|
324
|
-
openssl_pkey_pkey
|
325
|
-
}.to raise_error(ArgumentError)
|
326
|
-
}
|
327
321
|
end
|
328
322
|
|
329
323
|
context 'without encrypted' do
|
@@ -338,18 +332,6 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
338
332
|
|
339
333
|
it_should_behave_like 'key type', 'DSA'
|
340
334
|
it_should_behave_like 'key type', 'RSA'
|
341
|
-
|
342
|
-
context 'with non-key data' do
|
343
|
-
let(:data) do
|
344
|
-
'Not a key'
|
345
|
-
end
|
346
|
-
|
347
|
-
specify {
|
348
|
-
expect {
|
349
|
-
openssl_pkey_pkey
|
350
|
-
}.to raise_error(ArgumentError)
|
351
|
-
}
|
352
|
-
end
|
353
335
|
end
|
354
336
|
|
355
337
|
context 'without data' do
|
@@ -362,7 +344,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
362
344
|
|
363
345
|
context 'with DSA key' do
|
364
346
|
let(:ssh_key) do
|
365
|
-
|
347
|
+
FactoryBot.build(:metasploit_credential_dsa_key)
|
366
348
|
end
|
367
349
|
|
368
350
|
it { is_expected.to be_a OpenSSL::PKey::DSA }
|
@@ -370,7 +352,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
370
352
|
|
371
353
|
context 'with RSA key' do
|
372
354
|
let(:ssh_key) do
|
373
|
-
|
355
|
+
FactoryBot.build(:metasploit_credential_rsa_key)
|
374
356
|
end
|
375
357
|
|
376
358
|
it { is_expected.to be_a OpenSSL::PKey::RSA }
|
@@ -383,7 +365,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
383
365
|
|
384
366
|
context '#private?' do
|
385
367
|
subject(:ssh_key) do
|
386
|
-
|
368
|
+
FactoryBot.build(
|
387
369
|
:metasploit_credential_ssh_key,
|
388
370
|
data: data
|
389
371
|
)
|
@@ -15,7 +15,7 @@ RSpec.describe Metasploit::Credential::Username, type: :model do
|
|
15
15
|
|
16
16
|
context 'validations' do
|
17
17
|
context 'username' do
|
18
|
-
subject {
|
18
|
+
subject { FactoryBot.build(:metasploit_credential_username) }
|
19
19
|
it { is_expected.to validate_presence_of :username }
|
20
20
|
it { is_expected.to validate_uniqueness_of :username }
|
21
21
|
end
|
@@ -76,7 +76,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
76
76
|
}
|
77
77
|
|
78
78
|
let(:matching_private) {
|
79
|
-
|
79
|
+
FactoryBot.create(
|
80
80
|
private_factory,
|
81
81
|
matching_private_attributes
|
82
82
|
)
|
@@ -91,7 +91,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
91
91
|
}
|
92
92
|
|
93
93
|
let(:matching_public) {
|
94
|
-
|
94
|
+
FactoryBot.create(
|
95
95
|
:metasploit_credential_username,
|
96
96
|
username: matching_public_username
|
97
97
|
)
|
@@ -102,7 +102,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
102
102
|
}
|
103
103
|
|
104
104
|
let(:matching_realm) {
|
105
|
-
|
105
|
+
FactoryBot.create(
|
106
106
|
:metasploit_credential_realm,
|
107
107
|
key: matching_realm_key,
|
108
108
|
value: matching_realm_value
|
@@ -126,7 +126,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
126
126
|
}
|
127
127
|
|
128
128
|
let(:non_matching_private) {
|
129
|
-
|
129
|
+
FactoryBot.create(
|
130
130
|
private_factory,
|
131
131
|
non_matching_private_attributes
|
132
132
|
)
|
@@ -137,7 +137,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
137
137
|
}
|
138
138
|
|
139
139
|
let(:non_matching_public) {
|
140
|
-
|
140
|
+
FactoryBot.create(
|
141
141
|
:metasploit_credential_username,
|
142
142
|
username: non_matching_public_username
|
143
143
|
)
|
@@ -148,7 +148,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
148
148
|
}
|
149
149
|
|
150
150
|
let(:non_matching_realm) {
|
151
|
-
|
151
|
+
FactoryBot.create(
|
152
152
|
:metasploit_credential_realm,
|
153
153
|
key: non_matching_realm_key,
|
154
154
|
value: non_matching_realm_value
|
@@ -177,7 +177,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
177
177
|
#
|
178
178
|
|
179
179
|
let!(:matching_login) {
|
180
|
-
|
180
|
+
FactoryBot.create(
|
181
181
|
:metasploit_credential_login,
|
182
182
|
access_level: matching_login_access_level,
|
183
183
|
core: matching_record,
|
@@ -186,7 +186,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
186
186
|
}
|
187
187
|
|
188
188
|
let!(:matching_record) {
|
189
|
-
|
189
|
+
FactoryBot.create(
|
190
190
|
:metasploit_credential_core,
|
191
191
|
private: matching_private,
|
192
192
|
public: matching_public,
|
@@ -195,7 +195,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
195
195
|
}
|
196
196
|
|
197
197
|
let!(:non_matching_login) {
|
198
|
-
|
198
|
+
FactoryBot.create(
|
199
199
|
:metasploit_credential_login,
|
200
200
|
access_level: non_matching_login_access_level,
|
201
201
|
core: non_matching_record,
|
@@ -204,7 +204,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
204
204
|
}
|
205
205
|
|
206
206
|
let!(:non_matching_record) {
|
207
|
-
|
207
|
+
FactoryBot.create(
|
208
208
|
:metasploit_credential_core,
|
209
209
|
private: non_matching_private,
|
210
210
|
public: non_matching_public,
|
@@ -299,13 +299,13 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
299
299
|
}
|
300
300
|
|
301
301
|
let(:matching_credential_core) {
|
302
|
-
|
302
|
+
FactoryBot.create(
|
303
303
|
:metasploit_credential_core
|
304
304
|
)
|
305
305
|
}
|
306
306
|
|
307
307
|
let(:matching_host) {
|
308
|
-
|
308
|
+
FactoryBot.create(
|
309
309
|
:mdm_host,
|
310
310
|
address: matching_host_address,
|
311
311
|
name: matching_host_name,
|
@@ -337,7 +337,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
337
337
|
}
|
338
338
|
|
339
339
|
let(:matching_service) {
|
340
|
-
|
340
|
+
FactoryBot.create(
|
341
341
|
:mdm_service,
|
342
342
|
host: matching_host,
|
343
343
|
info: matching_service_info,
|
@@ -372,13 +372,13 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
372
372
|
}
|
373
373
|
|
374
374
|
let(:non_matching_credential_core) {
|
375
|
-
|
375
|
+
FactoryBot.create(
|
376
376
|
:metasploit_credential_core
|
377
377
|
)
|
378
378
|
}
|
379
379
|
|
380
380
|
let(:non_matching_host) {
|
381
|
-
|
381
|
+
FactoryBot.create(
|
382
382
|
:mdm_host,
|
383
383
|
address: non_matching_host_address,
|
384
384
|
name: non_matching_host_name,
|
@@ -410,7 +410,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
410
410
|
}
|
411
411
|
|
412
412
|
let(:non_matching_service) {
|
413
|
-
|
413
|
+
FactoryBot.create(
|
414
414
|
:mdm_service,
|
415
415
|
host: non_matching_host,
|
416
416
|
info: non_matching_service_info,
|
@@ -441,7 +441,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
441
441
|
#
|
442
442
|
|
443
443
|
let!(:matching_record) {
|
444
|
-
|
444
|
+
FactoryBot.create(
|
445
445
|
:metasploit_credential_login,
|
446
446
|
access_level: matching_access_level,
|
447
447
|
core: matching_credential_core,
|
@@ -450,7 +450,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
450
450
|
}
|
451
451
|
|
452
452
|
let!(:non_matching_record) {
|
453
|
-
|
453
|
+
FactoryBot.create(
|
454
454
|
:metasploit_credential_login,
|
455
455
|
access_level: non_matching_access_level,
|
456
456
|
core: non_matching_credential_core,
|
@@ -627,14 +627,14 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
627
627
|
#
|
628
628
|
|
629
629
|
let!(:matching_record) {
|
630
|
-
|
630
|
+
FactoryBot.create(
|
631
631
|
factory,
|
632
632
|
matching_attributes
|
633
633
|
)
|
634
634
|
}
|
635
635
|
|
636
636
|
let!(:non_matching_record) {
|
637
|
-
|
637
|
+
FactoryBot.create(
|
638
638
|
factory,
|
639
639
|
non_matching_attributes
|
640
640
|
)
|
@@ -732,7 +732,7 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
732
732
|
|
733
733
|
let!(:metasploit_credential_private_by_class) {
|
734
734
|
metasploit_private_factories.each_with_object({}) { |factory, instance_by_class|
|
735
|
-
instance =
|
735
|
+
instance = FactoryBot.create(factory)
|
736
736
|
instance_by_class[instance.class] = instance
|
737
737
|
}
|
738
738
|
}
|
@@ -793,25 +793,25 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
793
793
|
|
794
794
|
let(:metasploit_credential_privates_by_class) {
|
795
795
|
{
|
796
|
-
Metasploit::Credential::NonreplayableHash =>
|
796
|
+
Metasploit::Credential::NonreplayableHash => FactoryBot.create_list(
|
797
797
|
:metasploit_credential_nonreplayable_hash,
|
798
798
|
2
|
799
799
|
),
|
800
|
-
Metasploit::Credential::NTLMHash =>
|
800
|
+
Metasploit::Credential::NTLMHash => FactoryBot.create_list(
|
801
801
|
:metasploit_credential_ntlm_hash,
|
802
802
|
2
|
803
803
|
),
|
804
804
|
Metasploit::Credential::Password => [
|
805
|
-
|
805
|
+
FactoryBot.create(
|
806
806
|
:metasploit_credential_password,
|
807
807
|
data: 'alices_password'
|
808
808
|
),
|
809
|
-
|
809
|
+
FactoryBot.create(
|
810
810
|
:metasploit_credential_password,
|
811
811
|
data: 'bobs_password'
|
812
812
|
)
|
813
813
|
],
|
814
|
-
Metasploit::Credential::SSHKey =>
|
814
|
+
Metasploit::Credential::SSHKey => FactoryBot.create_list(
|
815
815
|
:metasploit_credential_ssh_key,
|
816
816
|
2
|
817
817
|
)
|
@@ -854,14 +854,14 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
854
854
|
#
|
855
855
|
|
856
856
|
let!(:matching_record) {
|
857
|
-
|
857
|
+
FactoryBot.create(
|
858
858
|
:metasploit_credential_username,
|
859
859
|
username: matching_username
|
860
860
|
)
|
861
861
|
}
|
862
862
|
|
863
863
|
let!(:non_matching_record) {
|
864
|
-
|
864
|
+
FactoryBot.create(
|
865
865
|
:metasploit_credential_username,
|
866
866
|
username: non_matching_username
|
867
867
|
)
|
@@ -897,14 +897,14 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Relation, type: :model do
|
|
897
897
|
#
|
898
898
|
|
899
899
|
let!(:matching_record) {
|
900
|
-
|
900
|
+
FactoryBot.create(
|
901
901
|
:metasploit_credential_realm,
|
902
902
|
value: matching_value
|
903
903
|
)
|
904
904
|
}
|
905
905
|
|
906
906
|
let!(:non_matching_record) {
|
907
|
-
|
907
|
+
FactoryBot.create(
|
908
908
|
:metasploit_credential_realm,
|
909
909
|
value: non_matching_value
|
910
910
|
)
|
@@ -3,42 +3,42 @@ RSpec.shared_context 'export objects' do
|
|
3
3
|
#
|
4
4
|
# Basics for testing export object itself
|
5
5
|
#
|
6
|
-
let(:workspace){
|
7
|
-
let(:host){
|
8
|
-
let(:service){
|
9
|
-
let(:origin) {
|
10
|
-
let(:core){
|
11
|
-
let(:login){
|
6
|
+
let(:workspace){ FactoryBot.create(:mdm_workspace) }
|
7
|
+
let(:host){ FactoryBot.create(:mdm_host, workspace: workspace)}
|
8
|
+
let(:service){ FactoryBot.create(:mdm_service, host:host) }
|
9
|
+
let(:origin) { FactoryBot.create(:metasploit_credential_origin_import, task:nil) }
|
10
|
+
let(:core){ FactoryBot.create(:metasploit_credential_core, workspace: workspace, origin: origin) }
|
11
|
+
let(:login){ FactoryBot.create(:metasploit_credential_login, service: service, core:core) }
|
12
12
|
|
13
13
|
|
14
14
|
#
|
15
15
|
# Create 2 each of hosts, services, publics, privates, cores, and logins
|
16
16
|
#
|
17
|
-
let!(:host1){
|
18
|
-
let!(:host2){
|
17
|
+
let!(:host1){ FactoryBot.create(:mdm_host, workspace: workspace) }
|
18
|
+
let!(:host2){ FactoryBot.create(:mdm_host, workspace: workspace) }
|
19
19
|
|
20
|
-
let!(:service1){
|
21
|
-
let!(:service2){
|
20
|
+
let!(:service1){ FactoryBot.create(:mdm_service, host: host1) }
|
21
|
+
let!(:service2){ FactoryBot.create(:mdm_service, host: host2) }
|
22
22
|
|
23
|
-
let!(:public1){
|
24
|
-
let!(:public2){
|
23
|
+
let!(:public1){ FactoryBot.create(:metasploit_credential_public) }
|
24
|
+
let!(:public2){ FactoryBot.create(:metasploit_credential_public) }
|
25
25
|
|
26
|
-
let!(:private1){
|
27
|
-
let!(:private2){
|
26
|
+
let!(:private1){ FactoryBot.create(:metasploit_credential_private, type: "Metasploit::Credential::Password") }
|
27
|
+
let!(:private2){ FactoryBot.create(:metasploit_credential_private, type: "Metasploit::Credential::Password") }
|
28
28
|
|
29
|
-
let!(:core1){
|
29
|
+
let!(:core1){ FactoryBot.create(:metasploit_credential_core,
|
30
30
|
public: public1,
|
31
31
|
private: private1,
|
32
32
|
origin: origin,
|
33
33
|
workspace: workspace) }
|
34
34
|
|
35
|
-
let!(:core2){
|
35
|
+
let!(:core2){ FactoryBot.create(:metasploit_credential_core,
|
36
36
|
public: public2,
|
37
37
|
private: private2,
|
38
38
|
origin: origin,
|
39
39
|
workspace: workspace) }
|
40
40
|
|
41
|
-
let!(:login1){
|
42
|
-
let!(:login2){
|
41
|
+
let!(:login1){ FactoryBot.create(:metasploit_credential_login, core: core1, service: service1) }
|
42
|
+
let!(:login2){ FactoryBot.create(:metasploit_credential_login, core: core2, service: service2) }
|
43
43
|
|
44
44
|
end
|
@@ -52,12 +52,12 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
52
52
|
#
|
53
53
|
|
54
54
|
let(:first_workspace) {
|
55
|
-
|
55
|
+
FactoryBot.create(:mdm_workspace)
|
56
56
|
}
|
57
57
|
|
58
58
|
let(:origin) {
|
59
59
|
# use an origin where the workspace does not need to correlate
|
60
|
-
|
60
|
+
FactoryBot.create(:metasploit_credential_origin_manual)
|
61
61
|
}
|
62
62
|
|
63
63
|
let(:factory_name) {
|
@@ -85,7 +85,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
85
85
|
}
|
86
86
|
|
87
87
|
let(:second_metasploit_credential_core) {
|
88
|
-
|
88
|
+
FactoryBot.build( factory_name, second_factory_options)
|
89
89
|
}
|
90
90
|
|
91
91
|
#
|
@@ -93,7 +93,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
93
93
|
#
|
94
94
|
|
95
95
|
let!(:first_metasploit_credential_core) {
|
96
|
-
|
96
|
+
FactoryBot.create(factory_name, first_factory_options)
|
97
97
|
}
|
98
98
|
end
|
99
99
|
|
@@ -101,23 +101,23 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
101
101
|
context 'indices' do
|
102
102
|
context 'foreign keys' do
|
103
103
|
let(:first_private) {
|
104
|
-
|
104
|
+
FactoryBot.create(:metasploit_credential_private)
|
105
105
|
}
|
106
106
|
|
107
107
|
let(:second_public) {
|
108
|
-
|
108
|
+
FactoryBot.create(:metasploit_credential_username)
|
109
109
|
}
|
110
110
|
|
111
111
|
let(:second_private) {
|
112
|
-
|
112
|
+
FactoryBot.create(:metasploit_credential_private)
|
113
113
|
}
|
114
114
|
|
115
115
|
let(:second_realm) {
|
116
|
-
|
116
|
+
FactoryBot.create(:metasploit_credential_realm)
|
117
117
|
}
|
118
118
|
|
119
119
|
let(:second_workspace) {
|
120
|
-
|
120
|
+
FactoryBot.create(:mdm_workspace)
|
121
121
|
}
|
122
122
|
|
123
123
|
shared_examples_for 'potential collision' do |options={}|
|
@@ -190,7 +190,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
190
190
|
}
|
191
191
|
|
192
192
|
let(:first_public) {
|
193
|
-
|
193
|
+
FactoryBot.create(:metasploit_credential_username)
|
194
194
|
}
|
195
195
|
|
196
196
|
let(:first_realm) {
|
@@ -220,7 +220,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
220
220
|
options.assert_valid_keys(:collision, :private, :public, :workspace)
|
221
221
|
|
222
222
|
let(:first_public) {
|
223
|
-
|
223
|
+
FactoryBot.create(:metasploit_credential_username)
|
224
224
|
}
|
225
225
|
|
226
226
|
let(:first_realm) {
|
@@ -252,7 +252,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
252
252
|
}
|
253
253
|
|
254
254
|
let(:first_realm) {
|
255
|
-
|
255
|
+
FactoryBot.create(:metasploit_credential_realm)
|
256
256
|
}
|
257
257
|
|
258
258
|
let(:second_public) {
|
@@ -280,11 +280,11 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
280
280
|
}
|
281
281
|
|
282
282
|
let(:first_public) {
|
283
|
-
|
283
|
+
FactoryBot.create(:metasploit_credential_username)
|
284
284
|
}
|
285
285
|
|
286
286
|
let(:first_realm) {
|
287
|
-
|
287
|
+
FactoryBot.create(:metasploit_credential_realm)
|
288
288
|
}
|
289
289
|
|
290
290
|
let(:second_private) {
|
@@ -308,11 +308,11 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
308
308
|
options.assert_valid_keys(:collision, :private, :public, :realm, :workspace)
|
309
309
|
|
310
310
|
let(:first_public) {
|
311
|
-
|
311
|
+
FactoryBot.create(:metasploit_credential_username)
|
312
312
|
}
|
313
313
|
|
314
314
|
let(:first_realm) {
|
315
|
-
|
315
|
+
FactoryBot.create(:metasploit_credential_realm)
|
316
316
|
}
|
317
317
|
|
318
318
|
context_with_correlation(options, :workspace) do
|
@@ -589,23 +589,23 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
589
589
|
|
590
590
|
context 'of uniqueness' do
|
591
591
|
let(:first_private) {
|
592
|
-
|
592
|
+
FactoryBot.create(:metasploit_credential_private)
|
593
593
|
}
|
594
594
|
|
595
595
|
let(:second_public) {
|
596
|
-
|
596
|
+
FactoryBot.create(:metasploit_credential_username)
|
597
597
|
}
|
598
598
|
|
599
599
|
let(:second_private) {
|
600
|
-
|
600
|
+
FactoryBot.create(:metasploit_credential_private)
|
601
601
|
}
|
602
602
|
|
603
603
|
let(:second_realm) {
|
604
|
-
|
604
|
+
FactoryBot.create(:metasploit_credential_realm)
|
605
605
|
}
|
606
606
|
|
607
607
|
let(:second_workspace) {
|
608
|
-
|
608
|
+
FactoryBot.create(:mdm_workspace)
|
609
609
|
}
|
610
610
|
|
611
611
|
shared_examples_for 'potential collision' do |options={}|
|
@@ -682,7 +682,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
682
682
|
}
|
683
683
|
|
684
684
|
let(:first_public) {
|
685
|
-
|
685
|
+
FactoryBot.create(:metasploit_credential_username)
|
686
686
|
}
|
687
687
|
|
688
688
|
let(:first_realm) {
|
@@ -717,7 +717,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
717
717
|
}
|
718
718
|
|
719
719
|
let(:first_public) {
|
720
|
-
|
720
|
+
FactoryBot.create(:metasploit_credential_username)
|
721
721
|
}
|
722
722
|
|
723
723
|
let(:second_realm) {
|
@@ -746,7 +746,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
746
746
|
}
|
747
747
|
|
748
748
|
let(:first_realm) {
|
749
|
-
|
749
|
+
FactoryBot.create(:metasploit_credential_realm)
|
750
750
|
}
|
751
751
|
|
752
752
|
let(:second_public) {
|
@@ -775,11 +775,11 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
775
775
|
}
|
776
776
|
|
777
777
|
let(:first_public) {
|
778
|
-
|
778
|
+
FactoryBot.create(:metasploit_credential_username)
|
779
779
|
}
|
780
780
|
|
781
781
|
let(:first_realm) {
|
782
|
-
|
782
|
+
FactoryBot.create(:metasploit_credential_realm)
|
783
783
|
}
|
784
784
|
|
785
785
|
let(:second_private) {
|
@@ -804,11 +804,11 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
804
804
|
options.assert_valid_keys(:collision, :private, :public, :realm, :workspace)
|
805
805
|
|
806
806
|
let(:first_public) {
|
807
|
-
|
807
|
+
FactoryBot.create(:metasploit_credential_username)
|
808
808
|
}
|
809
809
|
|
810
810
|
let(:first_realm) {
|
811
|
-
|
811
|
+
FactoryBot.create(:metasploit_credential_realm)
|
812
812
|
}
|
813
813
|
|
814
814
|
context_with_correlation(options, :workspace) do
|
@@ -1095,11 +1095,11 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1095
1095
|
}
|
1096
1096
|
|
1097
1097
|
let(:first_public) {
|
1098
|
-
|
1098
|
+
FactoryBot.create(:metasploit_credential_username)
|
1099
1099
|
}
|
1100
1100
|
|
1101
1101
|
let(:first_realm) {
|
1102
|
-
|
1102
|
+
FactoryBot.create(:metasploit_credential_realm)
|
1103
1103
|
}
|
1104
1104
|
|
1105
1105
|
let(:second_private) {
|
@@ -1175,7 +1175,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1175
1175
|
|
1176
1176
|
context 'with same workspace without realm with public without private' do
|
1177
1177
|
let(:second_public) {
|
1178
|
-
|
1178
|
+
FactoryBot.create(:metasploit_credential_public)
|
1179
1179
|
}
|
1180
1180
|
|
1181
1181
|
let(:second_private) {
|
@@ -1187,7 +1187,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1187
1187
|
|
1188
1188
|
context 'with same workspace without realm with public with same private' do
|
1189
1189
|
let(:second_public) {
|
1190
|
-
|
1190
|
+
FactoryBot.create(:metasploit_credential_public)
|
1191
1191
|
}
|
1192
1192
|
|
1193
1193
|
it { is_expected.to be_valid }
|
@@ -1195,7 +1195,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1195
1195
|
|
1196
1196
|
context 'with same workspace with realm without public with same private' do
|
1197
1197
|
let(:second_realm) {
|
1198
|
-
|
1198
|
+
FactoryBot.create(:metasploit_credential_realm)
|
1199
1199
|
}
|
1200
1200
|
|
1201
1201
|
it { is_expected.to be_valid }
|
@@ -1213,7 +1213,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1213
1213
|
|
1214
1214
|
context 'with workspace without realm with same public with private' do
|
1215
1215
|
let(:second_private) {
|
1216
|
-
|
1216
|
+
FactoryBot.create(:metasploit_credential_private)
|
1217
1217
|
}
|
1218
1218
|
|
1219
1219
|
it { is_expected.to be_valid }
|
@@ -1221,11 +1221,11 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1221
1221
|
|
1222
1222
|
context 'with workspace with realm without public with private' do
|
1223
1223
|
let(:second_private) {
|
1224
|
-
|
1224
|
+
FactoryBot.create(:metasploit_credential_private)
|
1225
1225
|
}
|
1226
1226
|
|
1227
1227
|
let(:second_realm) {
|
1228
|
-
|
1228
|
+
FactoryBot.create(:metasploit_credential_realm)
|
1229
1229
|
}
|
1230
1230
|
|
1231
1231
|
it { is_expected.to be_valid}
|
@@ -1243,7 +1243,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1243
1243
|
}
|
1244
1244
|
|
1245
1245
|
let(:second_realm) {
|
1246
|
-
|
1246
|
+
FactoryBot.create(:metasploit_credential_realm)
|
1247
1247
|
}
|
1248
1248
|
|
1249
1249
|
it { is_expected.to be_valid }
|
@@ -1261,7 +1261,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::CoreValidations' do
|
|
1261
1261
|
}
|
1262
1262
|
|
1263
1263
|
let(:second_public) {
|
1264
|
-
|
1264
|
+
FactoryBot.create(:metasploit_credential_public)
|
1265
1265
|
}
|
1266
1266
|
|
1267
1267
|
it { is_expected.to be_valid }
|