metasploit-credential 1.0.1 → 1.1.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.tar.gz.sig +0 -0
- data/lib/metasploit/credential/version.rb +10 -53
- data/spec/dummy/config/application.rb +4 -1
- data/spec/dummy/config/database.yml +3 -12
- data/spec/dummy/config/environments/development.rb +0 -3
- data/spec/dummy/config/environments/production.rb +0 -4
- data/spec/dummy/config/environments/test.rb +0 -3
- data/spec/lib/metasploit/credential/exporter/core_spec.rb +14 -14
- data/spec/lib/metasploit/credential/exporter/pwdump_spec.rb +8 -8
- data/spec/lib/metasploit/credential/importer/core_spec.rb +20 -20
- data/spec/lib/metasploit/credential/importer/multi_spec.rb +1 -1
- data/spec/lib/metasploit/credential/importer/zip_spec.rb +5 -5
- data/spec/lib/metasploit/credential/migrator_spec.rb +9 -9
- data/spec/lib/metasploit/credential_spec.rb +11 -2
- data/spec/models/metasploit/credential/core_spec.rb +17 -17
- data/spec/models/metasploit/credential/login_spec.rb +13 -13
- data/spec/models/metasploit/credential/ntlm_hash_spec.rb +3 -3
- data/spec/models/metasploit/credential/origin/service_spec.rb +3 -1
- data/spec/models/metasploit/credential/origin/session_spec.rb +1 -1
- data/spec/models/metasploit/credential/postgres_md5_spec.rb +1 -1
- data/spec/models/metasploit/credential/private_spec.rb +4 -4
- data/spec/models/metasploit/credential/realm_spec.rb +4 -4
- data/spec/models/metasploit/credential/ssh_key_spec.rb +11 -11
- data/spec/models/metasploit/credential/username_spec.rb +1 -0
- data/spec/spec_helper.rb +28 -5
- data/spec/support/shared/contexts/mdm/workspace.rb +2 -2
- data/spec/support/shared/contexts/metasploit/credential/exporter/export_objects.rb +1 -1
- data/spec/support/shared/contexts/metasploit/credential/importer/zip/file.rb +3 -3
- data/spec/support/shared/contexts/metasploit/credential/search/operation/type.rb +1 -1
- data/spec/support/shared/examples/core_validations.rb +1 -1
- data/spec/support/shared/examples/single_table_inheritance_database_columns.rb +1 -1
- data/spec/support/shared/examples/timestamp_database_column.rb +1 -1
- metadata +87 -26
- metadata.gz.sig +0 -0
- data/spec/lib/metasploit/credential/version_spec.rb +0 -3
@@ -23,7 +23,7 @@ RSpec.describe Metasploit::Credential::Importer::Multi do
|
|
23
23
|
describe "when given a file that is not a zip or a CSV" do
|
24
24
|
subject(:multi_importer){ Metasploit::Credential::Importer::Multi.new(input: File.open(unsupported_file), origin: import_origin)}
|
25
25
|
|
26
|
-
it {
|
26
|
+
it { is_expected.not_to be_valid }
|
27
27
|
end
|
28
28
|
|
29
29
|
context "when given zip file" do
|
@@ -17,16 +17,16 @@ RSpec.describe Metasploit::Credential::Importer::Zip do
|
|
17
17
|
I18n.translate!('activemodel.errors.models.metasploit/credential/importer/zip.attributes.input.malformed_archive')
|
18
18
|
end
|
19
19
|
|
20
|
-
before(:
|
20
|
+
before(:example) do
|
21
21
|
File.open(DUMMY_ZIP_PATH, 'wb')
|
22
22
|
zip_importer.input = File.open(DUMMY_ZIP_PATH, 'r')
|
23
23
|
end
|
24
24
|
|
25
|
-
after(:
|
25
|
+
after(:example) do
|
26
26
|
FileUtils.rm(DUMMY_ZIP_PATH)
|
27
27
|
end
|
28
28
|
|
29
|
-
it {
|
29
|
+
it { is_expected.not_to be_valid }
|
30
30
|
|
31
31
|
it 'should show the proper error message' do
|
32
32
|
zip_importer.valid?
|
@@ -39,11 +39,11 @@ RSpec.describe Metasploit::Credential::Importer::Zip do
|
|
39
39
|
I18n.translate!('activemodel.errors.models.metasploit/credential/importer/zip.attributes.input.missing_manifest')
|
40
40
|
end
|
41
41
|
|
42
|
-
before(:
|
42
|
+
before(:example) do
|
43
43
|
zip_importer.input = FactoryGirl.generate :metasploit_credential_importer_zip_file_without_manifest
|
44
44
|
end
|
45
45
|
|
46
|
-
it {
|
46
|
+
it { is_expected.not_to be_valid }
|
47
47
|
|
48
48
|
it 'should show the proper error message' do
|
49
49
|
zip_importer.valid?
|
@@ -13,7 +13,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
13
13
|
|
14
14
|
describe "#convert_creds_in_workspace" do
|
15
15
|
describe "when there are no Mdm::Cred objects in the workspace" do
|
16
|
-
before(:
|
16
|
+
before(:example) do
|
17
17
|
workspace.services.each do |service|
|
18
18
|
service.creds = []
|
19
19
|
end
|
@@ -55,7 +55,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
describe "new Publics" do
|
58
|
-
before(:
|
58
|
+
before(:example) do
|
59
59
|
migrator.convert_creds_in_workspace(workspace)
|
60
60
|
end
|
61
61
|
|
@@ -65,7 +65,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "new Privates" do
|
68
|
-
before(:
|
68
|
+
before(:example) do
|
69
69
|
migrator.convert_creds_in_workspace(workspace)
|
70
70
|
end
|
71
71
|
|
@@ -85,7 +85,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
85
85
|
)
|
86
86
|
end
|
87
87
|
|
88
|
-
before(:
|
88
|
+
before(:example) do
|
89
89
|
migrator.convert_creds_in_workspace(cred.service.host.workspace)
|
90
90
|
end
|
91
91
|
|
@@ -114,7 +114,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
114
114
|
)
|
115
115
|
end
|
116
116
|
|
117
|
-
before(:
|
117
|
+
before(:example) do
|
118
118
|
migrator.convert_creds_in_workspace(cred.service.host.workspace)
|
119
119
|
end
|
120
120
|
|
@@ -132,7 +132,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
132
132
|
)
|
133
133
|
end
|
134
134
|
|
135
|
-
before(:
|
135
|
+
before(:example) do
|
136
136
|
migrator.convert_creds_in_workspace(cred.service.host.workspace)
|
137
137
|
end
|
138
138
|
|
@@ -150,7 +150,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
150
150
|
)
|
151
151
|
end
|
152
152
|
|
153
|
-
before(:
|
153
|
+
before(:example) do
|
154
154
|
migrator.convert_creds_in_workspace(cred.service.host.workspace)
|
155
155
|
end
|
156
156
|
|
@@ -170,7 +170,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
170
170
|
)
|
171
171
|
end
|
172
172
|
|
173
|
-
before(:
|
173
|
+
before(:example) do
|
174
174
|
migrator.convert_creds_in_workspace(cred.service.host.workspace)
|
175
175
|
end
|
176
176
|
|
@@ -188,7 +188,7 @@ RSpec.describe Metasploit::Credential::Migrator do
|
|
188
188
|
)
|
189
189
|
end
|
190
190
|
|
191
|
-
before(:
|
191
|
+
before(:example) do
|
192
192
|
migrator.convert_creds_in_workspace(cred.service.host.workspace)
|
193
193
|
end
|
194
194
|
|
@@ -1,4 +1,13 @@
|
|
1
1
|
RSpec.describe Metasploit::Credential do
|
2
|
-
|
3
|
-
|
2
|
+
context 'CONSTANTS' do
|
3
|
+
context 'VERSION' do
|
4
|
+
subject(:version) {
|
5
|
+
described_class::VERSION
|
6
|
+
}
|
7
|
+
|
8
|
+
it 'is Metasploit::Credential::Version.full' do
|
9
|
+
expect(version).to eq(Metasploit::Credential::VERSION)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
4
13
|
end
|
@@ -331,7 +331,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
331
331
|
metasploit_credential_core.workspace
|
332
332
|
end
|
333
333
|
|
334
|
-
it {
|
334
|
+
it { is_expected.not_to be_nil }
|
335
335
|
end
|
336
336
|
end
|
337
337
|
|
@@ -395,7 +395,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
395
395
|
metasploit_credential_core_manual.workspace
|
396
396
|
end
|
397
397
|
|
398
|
-
it {
|
398
|
+
it { is_expected.not_to be_nil }
|
399
399
|
end
|
400
400
|
end
|
401
401
|
|
@@ -475,7 +475,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
475
475
|
# Callbacks
|
476
476
|
#
|
477
477
|
|
478
|
-
before(:
|
478
|
+
before(:example) do
|
479
479
|
core.valid?
|
480
480
|
end
|
481
481
|
|
@@ -505,7 +505,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
505
505
|
true
|
506
506
|
end
|
507
507
|
|
508
|
-
it {
|
508
|
+
it { is_expected.not_to include error }
|
509
509
|
end
|
510
510
|
|
511
511
|
context 'without Mdm::User#admin' do
|
@@ -527,11 +527,11 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
527
527
|
}
|
528
528
|
end
|
529
529
|
|
530
|
-
it {
|
530
|
+
it { is_expected.not_to include error }
|
531
531
|
end
|
532
532
|
|
533
533
|
context 'without persisted' do
|
534
|
-
it {
|
534
|
+
it { is_expected.not_to include error }
|
535
535
|
end
|
536
536
|
end
|
537
537
|
|
@@ -583,7 +583,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
583
583
|
workspace
|
584
584
|
end
|
585
585
|
|
586
|
-
it {
|
586
|
+
it { is_expected.not_to include error }
|
587
587
|
end
|
588
588
|
|
589
589
|
context 'different than #workspace' do
|
@@ -647,7 +647,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
647
647
|
workspace
|
648
648
|
end
|
649
649
|
|
650
|
-
it {
|
650
|
+
it { is_expected.not_to include error }
|
651
651
|
end
|
652
652
|
|
653
653
|
context 'different than #workspace' do
|
@@ -714,7 +714,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
714
714
|
# Callbacks
|
715
715
|
#
|
716
716
|
|
717
|
-
before(:
|
717
|
+
before(:example) do
|
718
718
|
core.valid?
|
719
719
|
end
|
720
720
|
|
@@ -741,7 +741,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
741
741
|
FactoryGirl.generate :metasploit_credential_core_realm_factory
|
742
742
|
end
|
743
743
|
|
744
|
-
it {
|
744
|
+
it { is_expected.not_to include(error) }
|
745
745
|
end
|
746
746
|
|
747
747
|
context 'without #realm' do
|
@@ -749,7 +749,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
749
749
|
nil
|
750
750
|
end
|
751
751
|
|
752
|
-
it {
|
752
|
+
it { is_expected.not_to include(error) }
|
753
753
|
end
|
754
754
|
end
|
755
755
|
|
@@ -767,7 +767,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
767
767
|
FactoryGirl.generate :metasploit_credential_core_realm_factory
|
768
768
|
end
|
769
769
|
|
770
|
-
it {
|
770
|
+
it { is_expected.not_to include(error) }
|
771
771
|
end
|
772
772
|
|
773
773
|
context 'without #realm' do
|
@@ -775,7 +775,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
775
775
|
nil
|
776
776
|
end
|
777
777
|
|
778
|
-
it {
|
778
|
+
it { is_expected.not_to include(error) }
|
779
779
|
end
|
780
780
|
end
|
781
781
|
end
|
@@ -799,7 +799,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
799
799
|
FactoryGirl.generate :metasploit_credential_core_realm_factory
|
800
800
|
end
|
801
801
|
|
802
|
-
it {
|
802
|
+
it { is_expected.not_to include(error) }
|
803
803
|
end
|
804
804
|
|
805
805
|
context 'without #realm' do
|
@@ -807,7 +807,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
807
807
|
nil
|
808
808
|
end
|
809
809
|
|
810
|
-
it {
|
810
|
+
it { is_expected.not_to include(error) }
|
811
811
|
end
|
812
812
|
end
|
813
813
|
|
@@ -825,7 +825,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
825
825
|
FactoryGirl.generate :metasploit_credential_core_realm_factory
|
826
826
|
end
|
827
827
|
|
828
|
-
it {
|
828
|
+
it { is_expected.not_to include(error) }
|
829
829
|
end
|
830
830
|
|
831
831
|
end
|
@@ -848,7 +848,7 @@ RSpec.describe Metasploit::Credential::Core, type: :model do
|
|
848
848
|
it { is_expected.to be_valid }
|
849
849
|
|
850
850
|
context "when the Public is missing" do
|
851
|
-
before(:
|
851
|
+
before(:example) do
|
852
852
|
core.public = nil
|
853
853
|
end
|
854
854
|
|
@@ -23,7 +23,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
23
23
|
# Callbacks
|
24
24
|
#
|
25
25
|
|
26
|
-
before(:
|
26
|
+
before(:example) do
|
27
27
|
login.valid?
|
28
28
|
end
|
29
29
|
|
@@ -182,7 +182,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
182
182
|
context 'with existent Metasploit::Credential::Login' do
|
183
183
|
include_context 'Mdm::Workspace'
|
184
184
|
|
185
|
-
before(:
|
185
|
+
before(:example) do
|
186
186
|
# validate_uniqueness_of will use Metasploit::Credential::Login#service_id and not trigger service_id non-null
|
187
187
|
# constraint.
|
188
188
|
FactoryGirl.create(
|
@@ -219,7 +219,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
219
219
|
# Callbacks
|
220
220
|
#
|
221
221
|
|
222
|
-
before(:
|
222
|
+
before(:example) do
|
223
223
|
login.valid?
|
224
224
|
end
|
225
225
|
|
@@ -246,7 +246,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
246
246
|
nil
|
247
247
|
end
|
248
248
|
|
249
|
-
it {
|
249
|
+
it { is_expected.not_to include(error) }
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
@@ -268,7 +268,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
268
268
|
DateTime.now.utc
|
269
269
|
end
|
270
270
|
|
271
|
-
it {
|
271
|
+
it { is_expected.not_to include(error) }
|
272
272
|
end
|
273
273
|
|
274
274
|
context 'without #last_attempted' do
|
@@ -309,7 +309,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
309
309
|
# Callbacks
|
310
310
|
#
|
311
311
|
|
312
|
-
before(:
|
312
|
+
before(:example) do
|
313
313
|
login.valid?
|
314
314
|
end
|
315
315
|
|
@@ -341,7 +341,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
341
341
|
core.workspace
|
342
342
|
end
|
343
343
|
|
344
|
-
it {
|
344
|
+
it { is_expected.not_to include(error) }
|
345
345
|
end
|
346
346
|
|
347
347
|
context 'different than #workspace' do
|
@@ -416,7 +416,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
416
416
|
nil
|
417
417
|
end
|
418
418
|
|
419
|
-
it {
|
419
|
+
it { is_expected.not_to include(error) }
|
420
420
|
end
|
421
421
|
end
|
422
422
|
|
@@ -425,7 +425,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
425
425
|
nil
|
426
426
|
end
|
427
427
|
|
428
|
-
it {
|
428
|
+
it { is_expected.not_to include(error) }
|
429
429
|
end
|
430
430
|
end
|
431
431
|
|
@@ -434,7 +434,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
434
434
|
nil
|
435
435
|
end
|
436
436
|
|
437
|
-
it {
|
437
|
+
it { is_expected.not_to include(error) }
|
438
438
|
end
|
439
439
|
end
|
440
440
|
end
|
@@ -473,7 +473,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
473
473
|
nil
|
474
474
|
end
|
475
475
|
|
476
|
-
it {
|
476
|
+
it { is_expected.not_to include(error) }
|
477
477
|
end
|
478
478
|
end
|
479
479
|
|
@@ -482,7 +482,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
482
482
|
nil
|
483
483
|
end
|
484
484
|
|
485
|
-
it {
|
485
|
+
it { is_expected.not_to include(error) }
|
486
486
|
end
|
487
487
|
end
|
488
488
|
|
@@ -491,7 +491,7 @@ RSpec.describe Metasploit::Credential::Login, type: :model do
|
|
491
491
|
nil
|
492
492
|
end
|
493
493
|
|
494
|
-
it {
|
494
|
+
it { is_expected.not_to include(error) }
|
495
495
|
end
|
496
496
|
end
|
497
497
|
end
|
@@ -90,7 +90,7 @@ RSpec.describe Metasploit::Credential::NTLMHash, type: :model do
|
|
90
90
|
)
|
91
91
|
end
|
92
92
|
|
93
|
-
before(:
|
93
|
+
before(:example) do
|
94
94
|
ntlm_hash.valid?
|
95
95
|
end
|
96
96
|
|
@@ -176,12 +176,12 @@ RSpec.describe Metasploit::Credential::NTLMHash, type: :model do
|
|
176
176
|
# Callbacks
|
177
177
|
#
|
178
178
|
|
179
|
-
before(:
|
179
|
+
before(:example) do
|
180
180
|
ntlm_hash.valid?
|
181
181
|
end
|
182
182
|
|
183
183
|
context 'with <LAN Manager hex digest>:<NT LAN Manager hex digest>' do
|
184
|
-
it {
|
184
|
+
it { is_expected.not_to include(error) }
|
185
185
|
end
|
186
186
|
|
187
187
|
context "without ':'" do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
RSpec.describe Metasploit::Credential::Origin::Service, type: :model do
|
2
4
|
include_context 'Mdm::Workspace'
|
3
5
|
|
@@ -150,7 +152,7 @@ RSpec.describe Metasploit::Credential::Origin::Service, type: :model do
|
|
150
152
|
|
151
153
|
context do
|
152
154
|
# example to sample for service_id
|
153
|
-
before(:
|
155
|
+
before(:example) do
|
154
156
|
FactoryGirl.create(:metasploit_credential_origin_service)
|
155
157
|
end
|
156
158
|
|
@@ -38,7 +38,7 @@ RSpec.describe Metasploit::Credential::Origin::Session, type: :model do
|
|
38
38
|
context 'post_reference_name' do
|
39
39
|
include_context 'Mdm::Workspace'
|
40
40
|
|
41
|
-
before(:
|
41
|
+
before(:example) do
|
42
42
|
FactoryGirl.create(:metasploit_credential_origin_session)
|
43
43
|
end
|
44
44
|
|