metasploit-credential 0.14.7 → 0.14.8
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
- data/CONTRIBUTING.md +41 -9
- data/lib/metasploit/credential/exporter/core.rb +2 -2
- data/lib/metasploit/credential/exporter/pwdump.rb +2 -2
- data/lib/metasploit/credential/migrator.rb +1 -1
- data/lib/metasploit/credential/version.rb +12 -21
- data/spec/dummy/db/structure.sql +0 -1
- data/spec/lib/metasploit/credential/creation_spec.rb +8 -6
- data/spec/lib/metasploit/credential/exporter/core_spec.rb +85 -100
- data/spec/lib/metasploit/credential/exporter/pwdump_spec.rb +16 -14
- data/spec/lib/metasploit/credential/importer/core_spec.rb +12 -10
- data/spec/lib/metasploit/credential/importer/multi_spec.rb +6 -4
- data/spec/lib/metasploit/credential/importer/pwdump_spec.rb +13 -11
- data/spec/lib/metasploit/credential/importer/zip_spec.rb +7 -5
- data/spec/lib/metasploit/credential/migrator_spec.rb +13 -13
- data/spec/lib/metasploit/credential/version_spec.rb +141 -3
- data/spec/lib/metasploit/credential_spec.rb +15 -4
- data/spec/models/mdm/service_spec.rb +5 -3
- data/spec/models/mdm/session_spec.rb +4 -2
- data/spec/models/mdm/task_spec.rb +6 -4
- data/spec/models/mdm/user_spec.rb +4 -2
- data/spec/models/mdm/workspace_spec.rb +4 -2
- data/spec/models/metasploit/credential/blank_username_spec.rb +7 -5
- data/spec/models/metasploit/credential/core_spec.rb +45 -43
- data/spec/models/metasploit/credential/login/status_spec.rb +21 -19
- data/spec/models/metasploit/credential/login_spec.rb +38 -36
- data/spec/models/metasploit/credential/nonreplayable_hash_spec.rb +5 -3
- data/spec/models/metasploit/credential/ntlm_hash_spec.rb +15 -13
- data/spec/models/metasploit/credential/origin/cracked_password_spec.rb +7 -5
- data/spec/models/metasploit/credential/origin/import_spec.rb +10 -8
- data/spec/models/metasploit/credential/origin/manual_spec.rb +9 -7
- data/spec/models/metasploit/credential/origin/service_spec.rb +12 -10
- data/spec/models/metasploit/credential/origin/session_spec.rb +13 -11
- data/spec/models/metasploit/credential/password_hash_spec.rb +6 -4
- data/spec/models/metasploit/credential/password_spec.rb +5 -3
- data/spec/models/metasploit/credential/postgres_md5_spec.rb +6 -4
- data/spec/models/metasploit/credential/private_spec.rb +10 -8
- data/spec/models/metasploit/credential/public_spec.rb +7 -5
- data/spec/models/metasploit/credential/realm_spec.rb +16 -14
- data/spec/models/metasploit/credential/replayable_hash_spec.rb +5 -3
- data/spec/models/metasploit/credential/ssh_key_spec.rb +17 -15
- data/spec/models/metasploit/credential/username_spec.rb +8 -6
- data/spec/models/metasploit_data_models/search/visitor/relation_spec.rb +3 -1
- data/spec/spec_helper.rb +25 -95
- data/spec/support/shared/contexts/mdm/workspace.rb +1 -1
- data/spec/support/shared/examples/core_validations.rb +42 -117
- data/spec/support/shared/examples/single_table_inheritance_database_columns.rb +2 -2
- data/spec/support/shared/examples/timestamp_database_column.rb +2 -2
- metadata +8 -22
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::Origin::Service do
|
2
4
|
include_context 'Mdm::Workspace'
|
3
5
|
|
4
6
|
subject(:service_origin) do
|
@@ -8,23 +10,23 @@ RSpec.describe Metasploit::Credential::Origin::Service, type: :model do
|
|
8
10
|
it_should_behave_like 'Metasploit::Concern.run'
|
9
11
|
|
10
12
|
context 'associations' do
|
11
|
-
it {
|
12
|
-
it {
|
13
|
+
it { should have_many(:cores).class_name('Metasploit::Credential::Core').dependent(:destroy) }
|
14
|
+
it { should belong_to(:service).class_name('Mdm::Service') }
|
13
15
|
end
|
14
16
|
|
15
17
|
context 'database' do
|
16
18
|
context 'columns' do
|
17
19
|
it_should_behave_like 'timestamp database columns'
|
18
20
|
|
19
|
-
it {
|
21
|
+
it { should have_db_column(:module_full_name).of_type(:text).with_options(null: false) }
|
20
22
|
|
21
23
|
context 'foreign keys' do
|
22
|
-
it {
|
24
|
+
it { should have_db_column(:service_id).of_type(:integer).with_options(null: false) }
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
28
|
context 'indices' do
|
27
|
-
it {
|
29
|
+
it { should have_db_index([:service_id, :module_full_name]).unique(true) }
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
@@ -34,13 +36,13 @@ RSpec.describe Metasploit::Credential::Origin::Service, type: :model do
|
|
34
36
|
FactoryGirl.build(:metasploit_credential_origin_service)
|
35
37
|
end
|
36
38
|
|
37
|
-
it {
|
39
|
+
it { should be_valid }
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
43
|
context 'mass assignment security' do
|
42
44
|
it { should_not allow_mass_assignment_of :created_at }
|
43
|
-
it {
|
45
|
+
it { should allow_mass_assignment_of :module_full_name }
|
44
46
|
it { should_not allow_mass_assignment_of :service }
|
45
47
|
it { should_not allow_mass_assignment_of :service_id }
|
46
48
|
it { should_not allow_mass_assignment_of :updated_at }
|
@@ -162,10 +164,10 @@ RSpec.describe Metasploit::Credential::Origin::Service, type: :model do
|
|
162
164
|
FactoryGirl.create(:metasploit_credential_origin_service)
|
163
165
|
end
|
164
166
|
|
165
|
-
it {
|
167
|
+
it { should validate_uniqueness_of(:module_full_name).scoped_to(:service_id) }
|
166
168
|
end
|
167
169
|
end
|
168
170
|
|
169
|
-
it {
|
171
|
+
it { should validate_presence_of :service }
|
170
172
|
end
|
171
173
|
end
|
@@ -1,24 +1,26 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::Origin::Session do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
6
|
context 'associations' do
|
5
|
-
it {
|
6
|
-
it {
|
7
|
+
it { should have_many(:cores).class_name('Metasploit::Credential::Core').dependent(:destroy) }
|
8
|
+
it { should belong_to(:session).class_name('Mdm::Session') }
|
7
9
|
end
|
8
10
|
|
9
11
|
context 'database' do
|
10
12
|
context 'columns' do
|
11
|
-
it {
|
13
|
+
it { should have_db_column(:post_reference_name).of_type(:text).with_options(null: false) }
|
12
14
|
|
13
15
|
it_should_behave_like 'timestamp database columns'
|
14
16
|
|
15
17
|
context 'foreign keys' do
|
16
|
-
it {
|
18
|
+
it { should have_db_column(:session_id).of_type(:integer).with_options(null: false) }
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
22
|
context 'columns' do
|
21
|
-
it {
|
23
|
+
it { should have_db_index([:session_id, :post_reference_name]).unique(true) }
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
@@ -30,13 +32,13 @@ RSpec.describe Metasploit::Credential::Origin::Session, type: :model do
|
|
30
32
|
FactoryGirl.build(:metasploit_credential_origin_session)
|
31
33
|
end
|
32
34
|
|
33
|
-
it {
|
35
|
+
it { should be_valid }
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
39
|
context 'mass assignment security' do
|
38
40
|
it { should_not allow_mass_assignment_of(:created_at) }
|
39
|
-
it {
|
41
|
+
it { should allow_mass_assignment_of(:post_reference_name) }
|
40
42
|
it { should_not allow_mass_assignment_of(:session) }
|
41
43
|
it { should_not allow_mass_assignment_of(:session_id) }
|
42
44
|
it { should_not allow_mass_assignment_of(:updated_at) }
|
@@ -50,10 +52,10 @@ RSpec.describe Metasploit::Credential::Origin::Session, type: :model do
|
|
50
52
|
FactoryGirl.create(:metasploit_credential_origin_session)
|
51
53
|
end
|
52
54
|
|
53
|
-
it {
|
54
|
-
it {
|
55
|
+
it { should validate_presence_of :post_reference_name }
|
56
|
+
it { should validate_uniqueness_of(:post_reference_name).scoped_to(:session_id) }
|
55
57
|
end
|
56
58
|
|
57
|
-
it {
|
59
|
+
it { should validate_presence_of :session }
|
58
60
|
end
|
59
61
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::PasswordHash do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
|
-
it {
|
6
|
+
it { should be_a Metasploit::Credential::Private }
|
5
7
|
|
6
8
|
context 'factories' do
|
7
9
|
context 'metasploit_credential_password_hash' do
|
@@ -9,11 +11,11 @@ RSpec.describe Metasploit::Credential::PasswordHash, type: :model do
|
|
9
11
|
FactoryGirl.build(:metasploit_credential_password_hash)
|
10
12
|
end
|
11
13
|
|
12
|
-
it {
|
14
|
+
it { should be_valid }
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
context 'validations' do
|
17
|
-
it {
|
19
|
+
it { should validate_presence_of :data }
|
18
20
|
end
|
19
21
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::Password do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
|
-
it {
|
6
|
+
it { should be_a Metasploit::Credential::Private }
|
5
7
|
|
6
8
|
context 'factories' do
|
7
9
|
context 'metasploit_credential_password' do
|
@@ -9,7 +11,7 @@ RSpec.describe Metasploit::Credential::Password, type: :model do
|
|
9
11
|
FactoryGirl.build(:metasploit_credential_password)
|
10
12
|
end
|
11
13
|
|
12
|
-
it {
|
14
|
+
it { should be_valid }
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::PostgresMD5 do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
|
-
it {
|
6
|
+
it { should be_a Metasploit::Credential::ReplayableHash }
|
5
7
|
|
6
8
|
context 'CONSTANTS' do
|
7
9
|
context 'DATA_REGEXP' do
|
@@ -53,7 +55,7 @@ RSpec.describe Metasploit::Credential::PostgresMD5, type: :model do
|
|
53
55
|
nil
|
54
56
|
end
|
55
57
|
|
56
|
-
it {
|
58
|
+
it { should be_nil }
|
57
59
|
end
|
58
60
|
|
59
61
|
context 'with upper case characters' do
|
@@ -85,7 +87,7 @@ RSpec.describe Metasploit::Credential::PostgresMD5, type: :model do
|
|
85
87
|
FactoryGirl.build(:metasploit_credential_postgres_md5)
|
86
88
|
end
|
87
89
|
|
88
|
-
it {
|
90
|
+
it { should be_valid }
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::Private do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
6
|
context 'database' do
|
@@ -6,11 +8,11 @@ RSpec.describe Metasploit::Credential::Private, type: :model do
|
|
6
8
|
it_should_behave_like 'single table inheritance database columns'
|
7
9
|
it_should_behave_like 'timestamp database columns'
|
8
10
|
|
9
|
-
it {
|
11
|
+
it { should have_db_column(:data).of_type(:text).with_options(null: false) }
|
10
12
|
end
|
11
13
|
|
12
14
|
context 'indices' do
|
13
|
-
it {
|
15
|
+
it { should have_db_index([:type, :data]).unique(true) }
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -20,13 +22,13 @@ RSpec.describe Metasploit::Credential::Private, type: :model do
|
|
20
22
|
FactoryGirl.build(:metasploit_credential_private)
|
21
23
|
end
|
22
24
|
|
23
|
-
it {
|
25
|
+
it { should be_valid }
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
29
|
context 'mass assignement security' do
|
28
30
|
it { should_not allow_mass_assignment_of :created_at }
|
29
|
-
it {
|
31
|
+
it { should allow_mass_assignment_of :data }
|
30
32
|
it { should_not allow_mass_assignment_of :id }
|
31
33
|
it { should_not allow_mass_assignment_of :updated_at }
|
32
34
|
it { should_not allow_mass_assignment_of :type }
|
@@ -34,9 +36,9 @@ RSpec.describe Metasploit::Credential::Private, type: :model do
|
|
34
36
|
|
35
37
|
context 'validations' do
|
36
38
|
context 'data' do
|
37
|
-
it {
|
39
|
+
it { should validate_non_nilness_of :data }
|
38
40
|
|
39
|
-
# `it {
|
41
|
+
# `it { should validate_uniqueness_of(:data).scoped_to(:type) }` tries to use a NULL type, which isn't allowed, so
|
40
42
|
# have to perform validation check manually
|
41
43
|
context 'validates uniqueness of #data scoped to #type' do
|
42
44
|
subject(:data_errors) do
|
@@ -87,7 +89,7 @@ RSpec.describe Metasploit::Credential::Private, type: :model do
|
|
87
89
|
existent_private.type
|
88
90
|
end
|
89
91
|
|
90
|
-
it {
|
92
|
+
it { should include(error) }
|
91
93
|
end
|
92
94
|
|
93
95
|
context 'without same #type' do
|
@@ -1,15 +1,17 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::Public do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
6
|
context 'database' do
|
5
7
|
context 'columns' do
|
6
8
|
it_should_behave_like 'timestamp database columns'
|
7
9
|
|
8
|
-
it {
|
10
|
+
it { should have_db_column(:username).of_type(:string).with_options(null: false) }
|
9
11
|
end
|
10
12
|
|
11
13
|
context 'indices' do
|
12
|
-
it {
|
14
|
+
it { should have_db_index(:username).unique(true) }
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
@@ -19,14 +21,14 @@ RSpec.describe Metasploit::Credential::Public, type: :model do
|
|
19
21
|
FactoryGirl.build(:metasploit_credential_public)
|
20
22
|
end
|
21
23
|
|
22
|
-
it {
|
24
|
+
it { should be_valid }
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
28
|
context 'mass assignment security' do
|
27
29
|
it { should_not allow_mass_assignment_of(:created_at) }
|
28
30
|
it { should_not allow_mass_assignment_of(:updated_at) }
|
29
|
-
it {
|
31
|
+
it { should allow_mass_assignment_of(:username) }
|
30
32
|
end
|
31
33
|
|
32
34
|
context 'search' do
|
@@ -1,16 +1,18 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::Realm do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
6
|
context 'database' do
|
5
7
|
context 'columns' do
|
6
|
-
it {
|
7
|
-
it {
|
8
|
+
it { should have_db_column(:key).of_type(:string).with_options(null: false) }
|
9
|
+
it { should have_db_column(:value).of_type(:string).with_options(null: false) }
|
8
10
|
|
9
11
|
it_should_behave_like 'timestamp database columns'
|
10
12
|
end
|
11
13
|
|
12
14
|
context 'indices' do
|
13
|
-
it {
|
15
|
+
it { should have_db_index([:key, :value]).unique(true) }
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -20,7 +22,7 @@ RSpec.describe Metasploit::Credential::Realm, type: :model do
|
|
20
22
|
FactoryGirl.build(:metasploit_credential_active_directory_domain)
|
21
23
|
end
|
22
24
|
|
23
|
-
it {
|
25
|
+
it { should be_valid }
|
24
26
|
|
25
27
|
context '#key' do
|
26
28
|
subject(:key) {
|
@@ -38,7 +40,7 @@ RSpec.describe Metasploit::Credential::Realm, type: :model do
|
|
38
40
|
FactoryGirl.build(:metasploit_credential_oracle_system_identifier)
|
39
41
|
end
|
40
42
|
|
41
|
-
it {
|
43
|
+
it { should be_valid }
|
42
44
|
|
43
45
|
context '#key' do
|
44
46
|
subject(:key) {
|
@@ -56,7 +58,7 @@ RSpec.describe Metasploit::Credential::Realm, type: :model do
|
|
56
58
|
FactoryGirl.build(:metasploit_credential_postgresql_database)
|
57
59
|
end
|
58
60
|
|
59
|
-
it {
|
61
|
+
it { should be_valid }
|
60
62
|
|
61
63
|
context '#key' do
|
62
64
|
subject(:key) {
|
@@ -74,13 +76,13 @@ RSpec.describe Metasploit::Credential::Realm, type: :model do
|
|
74
76
|
FactoryGirl.build(:metasploit_credential_realm)
|
75
77
|
end
|
76
78
|
|
77
|
-
it {
|
79
|
+
it { should be_valid }
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
81
83
|
context 'mass assignment security' do
|
82
|
-
it {
|
83
|
-
it {
|
84
|
+
it { should allow_mass_assignment_of(:key) }
|
85
|
+
it { should allow_mass_assignment_of(:value) }
|
84
86
|
end
|
85
87
|
|
86
88
|
|
@@ -104,12 +106,12 @@ RSpec.describe Metasploit::Credential::Realm, type: :model do
|
|
104
106
|
|
105
107
|
context 'validations' do
|
106
108
|
context 'on #key' do
|
107
|
-
it {
|
108
|
-
it {
|
109
|
+
it { should ensure_inclusion_of(:key).in_array(Metasploit::Model::Realm::Key::ALL) }
|
110
|
+
it { should validate_presence_of :key }
|
109
111
|
end
|
110
112
|
|
111
113
|
context 'on #value' do
|
112
|
-
it {
|
114
|
+
it { should validate_presence_of :value }
|
113
115
|
|
114
116
|
# key cannot be NULL so `validate_uniqueness_of(:value).scoped_to(:key)` does not work because it tries a NULL
|
115
117
|
# key
|
@@ -162,7 +164,7 @@ RSpec.describe Metasploit::Credential::Realm, type: :model do
|
|
162
164
|
existent_realm.value
|
163
165
|
end
|
164
166
|
|
165
|
-
it {
|
167
|
+
it { should include(error) }
|
166
168
|
end
|
167
169
|
|
168
170
|
context 'without same #value' do
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::ReplayableHash do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
|
-
it {
|
6
|
+
it { should be_a Metasploit::Credential::PasswordHash }
|
5
7
|
|
6
8
|
context 'factories' do
|
7
9
|
context 'metasploit_credential_replayable_hash' do
|
@@ -9,7 +11,7 @@ RSpec.describe Metasploit::Credential::ReplayableHash, type: :model do
|
|
9
11
|
FactoryGirl.build(:metasploit_credential_replayable_hash)
|
10
12
|
end
|
11
13
|
|
12
|
-
it {
|
14
|
+
it { should be_valid }
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Credential::SSHKey do
|
2
4
|
it_should_behave_like 'Metasploit::Concern.run'
|
3
5
|
|
4
6
|
#
|
@@ -16,7 +18,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
16
18
|
FactoryGirl.build(:metasploit_credential_dsa_key)
|
17
19
|
end
|
18
20
|
|
19
|
-
it {
|
21
|
+
it { should be_valid }
|
20
22
|
|
21
23
|
it 'has DSA key type' do
|
22
24
|
expect(metasploit_credential_dsa_key.data).to match(/-----BEGIN DSA PRIVATE KEY-----/)
|
@@ -29,7 +31,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
29
31
|
FactoryGirl.build(:metasploit_credential_rsa_key)
|
30
32
|
end
|
31
33
|
|
32
|
-
it {
|
34
|
+
it { should be_valid }
|
33
35
|
|
34
36
|
it 'has RSA key type' do
|
35
37
|
expect(metasploit_credential_rsa_key.data).to match(/-----BEGIN RSA PRIVATE KEY-----/)
|
@@ -42,12 +44,12 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
42
44
|
FactoryGirl.build(:metasploit_credential_ssh_key)
|
43
45
|
end
|
44
46
|
|
45
|
-
it {
|
47
|
+
it { should be_valid }
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
51
|
context 'validations' do
|
50
|
-
it {
|
52
|
+
it { should validate_presence_of :data }
|
51
53
|
|
52
54
|
context 'on #data' do
|
53
55
|
subject(:data_errors) do
|
@@ -90,7 +92,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
90
92
|
false
|
91
93
|
end
|
92
94
|
|
93
|
-
it {
|
95
|
+
it { should include(error) }
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
@@ -154,7 +156,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
154
156
|
ssh_key.valid?
|
155
157
|
end
|
156
158
|
|
157
|
-
it {
|
159
|
+
it { should be_empty }
|
158
160
|
end
|
159
161
|
end
|
160
162
|
|
@@ -173,7 +175,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
173
175
|
ssh_key.valid?
|
174
176
|
end
|
175
177
|
|
176
|
-
it {
|
178
|
+
it { should include(error) }
|
177
179
|
end
|
178
180
|
end
|
179
181
|
|
@@ -201,7 +203,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
201
203
|
true
|
202
204
|
end
|
203
205
|
|
204
|
-
it {
|
206
|
+
it { should include(error) }
|
205
207
|
end
|
206
208
|
|
207
209
|
context 'without #encrypted' do
|
@@ -253,7 +255,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
253
255
|
cipher.random_key
|
254
256
|
end
|
255
257
|
|
256
|
-
it {
|
258
|
+
it { should be_encrypted }
|
257
259
|
end
|
258
260
|
|
259
261
|
context 'without encrypted' do
|
@@ -331,7 +333,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
331
333
|
unencrypted_key.to_pem
|
332
334
|
end
|
333
335
|
|
334
|
-
it {
|
336
|
+
it { should be_a OpenSSL::PKey.const_get(key_type) }
|
335
337
|
end
|
336
338
|
end
|
337
339
|
end
|
@@ -357,7 +359,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
357
359
|
nil
|
358
360
|
end
|
359
361
|
|
360
|
-
it {
|
362
|
+
it { should be_nil }
|
361
363
|
end
|
362
364
|
|
363
365
|
context 'with DSA key' do
|
@@ -365,7 +367,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
365
367
|
FactoryGirl.build(:metasploit_credential_dsa_key)
|
366
368
|
end
|
367
369
|
|
368
|
-
it {
|
370
|
+
it { should be_a OpenSSL::PKey::DSA }
|
369
371
|
end
|
370
372
|
|
371
373
|
context 'with RSA key' do
|
@@ -373,7 +375,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
373
375
|
FactoryGirl.build(:metasploit_credential_rsa_key)
|
374
376
|
end
|
375
377
|
|
376
|
-
it {
|
378
|
+
it { should be_a OpenSSL::PKey::RSA }
|
377
379
|
end
|
378
380
|
|
379
381
|
context 'with nil' do
|
@@ -417,7 +419,7 @@ RSpec.describe Metasploit::Credential::SSHKey, type: :model do
|
|
417
419
|
private_key
|
418
420
|
end
|
419
421
|
|
420
|
-
it {
|
422
|
+
it { should be_private }
|
421
423
|
end
|
422
424
|
end
|
423
425
|
end
|