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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a90760c4188d3ce6e1bd95b802e0376b71ed9ad8
|
4
|
+
data.tar.gz: c97d418f43a8f720e24842789ba4b6d0ca7940f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6ee036a556e2f76bc544f0744a2e1bf20e8b90ac51b62c3828d16dc818012d7377e7a00b956e452fe5eb15f475305fdb00c57f0857bef54928e69a109b72b29
|
7
|
+
data.tar.gz: 1296775fd735c71e1997bf5a115a2b97edd498214db11ba5d8a0225e8f0c4ea2f00d8765dd2b511b47fea478bd5fe8f2bfae496b35776b1c81e5d26fbd14d424
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
@@ -2,59 +2,16 @@
|
|
2
2
|
# `metasploit/credential` itself is expected to be loaded.
|
3
3
|
module Metasploit
|
4
4
|
module Credential
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
|
16
|
-
PATCH = 1
|
17
|
-
|
18
|
-
#
|
19
|
-
# Module Methods
|
20
|
-
#
|
21
|
-
|
22
|
-
# The full version string, including the {Metasploit::Credential::Version::MAJOR},
|
23
|
-
# {Metasploit::Credential::Version::MINOR}, {Metasploit::Credential::Version::PATCH}, and optionally, the
|
24
|
-
# `Metasploit::Credential::Version::PRERELEASE` in the
|
25
|
-
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
|
26
|
-
#
|
27
|
-
# @return [String] '{Metasploit::Credential::Version::MAJOR}.{Metasploit::Credential::Version::MINOR}.{Metasploit::Credential::Version::PATCH}'
|
28
|
-
# on master.
|
29
|
-
# '{Metasploit::Credential::Version::MAJOR}.{Metasploit::Credential::Version::MINOR}.{Metasploit::Credential::Version::PATCH}-PRERELEASE'
|
30
|
-
# on any branch other than master.
|
31
|
-
def self.full
|
32
|
-
version = "#{MAJOR}.#{MINOR}.#{PATCH}"
|
33
|
-
|
34
|
-
if defined? PRERELEASE
|
35
|
-
version = "#{version}-#{PRERELEASE}"
|
36
|
-
end
|
37
|
-
|
38
|
-
version
|
39
|
-
end
|
40
|
-
|
41
|
-
# The full gem version string, including the {Metasploit::Credential::Version::MAJOR},
|
42
|
-
# {Metasploit::Credential::Version::MINOR}, {Metasploit::Credential::Version::PATCH}, and optionally, the
|
43
|
-
# `Metasploit::Credential::Version::PRERELEASE` in the
|
44
|
-
# {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
|
45
|
-
#
|
46
|
-
# @return [String] '{Metasploit::Credential::Version::MAJOR}.{Metasploit::Credential::Version::MINOR}.{Metasploit::Credential::Version::PATCH}'
|
47
|
-
# on master. '{Metasploit::Credential::Version::MAJOR}.{Metasploit::Credential::Version::MINOR}.{Metasploit::Credential::Version::PATCH}.PRERELEASE'
|
48
|
-
# on any branch other than master.
|
49
|
-
def self.gem
|
50
|
-
full.gsub('-', '.pre.')
|
51
|
-
end
|
5
|
+
# VERSION is managed by GemRelease
|
6
|
+
VERSION = '1.1.0'
|
7
|
+
|
8
|
+
# @return [String]
|
9
|
+
#
|
10
|
+
# returns the VERSION
|
11
|
+
#
|
12
|
+
|
13
|
+
def self.version
|
14
|
+
VERSION
|
52
15
|
end
|
53
|
-
|
54
|
-
# (see Version.gem)
|
55
|
-
GEM_VERSION = Version.gem
|
56
|
-
|
57
|
-
# (see Version.full)
|
58
|
-
VERSION = Version.full
|
59
16
|
end
|
60
17
|
end
|
@@ -43,7 +43,10 @@ module Dummy
|
|
43
43
|
|
44
44
|
# Configure sensitive parameters which will be filtered from the log file.
|
45
45
|
config.filter_parameters += [:password]
|
46
|
-
|
46
|
+
|
47
|
+
# Raise deprecations as errors
|
48
|
+
config.active_support.deprecation = :raise
|
49
|
+
|
47
50
|
# Enable escaping HTML in JSON.
|
48
51
|
config.active_support.escape_html_entities_in_json = true
|
49
52
|
|
@@ -1,22 +1,13 @@
|
|
1
|
-
# Please only use postgresql bound to a TCP port.
|
2
1
|
development: &pgsql
|
3
2
|
adapter: postgresql
|
4
|
-
database:
|
3
|
+
database: metasploit-credential_development0
|
5
4
|
username: msf
|
6
5
|
password: pass123
|
7
6
|
host: localhost
|
8
7
|
port: 5432
|
9
8
|
pool: 5
|
10
9
|
timeout: 5
|
11
|
-
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
|
-
#
|
16
|
-
# Note also, sqlite3 is totally unsupported by Metasploit now.
|
10
|
+
min_messages: warning
|
17
11
|
test:
|
18
12
|
<<: *pgsql
|
19
|
-
database:
|
20
|
-
password: pass123
|
21
|
-
username: msf
|
22
|
-
|
13
|
+
database: metasploit-credential_test0
|
@@ -16,9 +16,6 @@ Dummy::Application.configure do
|
|
16
16
|
# # Don't care if the mailer can't send
|
17
17
|
# config.action_mailer.raise_delivery_errors = false
|
18
18
|
|
19
|
-
# Print deprecation notices to the Rails logger
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
19
|
# Do not compress assets
|
23
20
|
config.assets.compress = false
|
24
21
|
|
@@ -63,8 +63,4 @@ Dummy::Application.configure do
|
|
63
63
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
64
64
|
# the I18n.default_locale when a translation can not be found)
|
65
65
|
config.i18n.fallbacks = true
|
66
|
-
|
67
|
-
# Send deprecation notices to registered listeners
|
68
|
-
config.active_support.deprecation = :notify
|
69
|
-
|
70
66
|
end
|
@@ -31,7 +31,4 @@ Dummy::Application.configure do
|
|
31
31
|
# # The :test delivery method accumulates sent emails in the
|
32
32
|
# # ActionMailer::Base.deliveries array.
|
33
33
|
# config.action_mailer.delivery_method = :test
|
34
|
-
|
35
|
-
# Print deprecation notices to the stderr
|
36
|
-
config.active_support.deprecation = :stderr
|
37
34
|
end
|
@@ -5,14 +5,14 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
5
5
|
|
6
6
|
subject(:core_exporter){ Metasploit::Credential::Exporter::Core.new(workspace: workspace) }
|
7
7
|
|
8
|
-
before(:
|
8
|
+
before(:example) do
|
9
9
|
origin.task = nil
|
10
10
|
end
|
11
11
|
|
12
12
|
#
|
13
13
|
# Clean up generated files/paths
|
14
14
|
#
|
15
|
-
after(:
|
15
|
+
after(:example) do
|
16
16
|
Dir.glob("#{Dir.tmpdir}/metasploit*").each {|d| FileUtils.rm_rf d}
|
17
17
|
end
|
18
18
|
|
@@ -171,7 +171,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
171
171
|
describe "uniqueness for export" do
|
172
172
|
let(:path_fragment){ "export-#{Time.now.to_s}" }
|
173
173
|
|
174
|
-
before(:
|
174
|
+
before(:example) do
|
175
175
|
allow(core_exporter).to receive(:output_final_subdirectory_name).and_return(path_fragment)
|
176
176
|
end
|
177
177
|
|
@@ -183,12 +183,12 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
183
183
|
|
184
184
|
describe "#data" do
|
185
185
|
describe "in LOGIN_MODE" do
|
186
|
-
before(:
|
186
|
+
before(:example) do
|
187
187
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::LOGIN_MODE
|
188
188
|
end
|
189
189
|
|
190
190
|
describe "when whitelist_ids is present" do
|
191
|
-
before(:
|
191
|
+
before(:example) do
|
192
192
|
allow(core_exporter).to receive(:whitelist_ids).and_return([login1.id])
|
193
193
|
end
|
194
194
|
|
@@ -205,12 +205,12 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
205
205
|
end
|
206
206
|
|
207
207
|
describe "in CORE_MODE" do
|
208
|
-
before(:
|
208
|
+
before(:example) do
|
209
209
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::CORE_MODE
|
210
210
|
end
|
211
211
|
|
212
212
|
describe "when whitelist_ids is present" do
|
213
|
-
before(:
|
213
|
+
before(:example) do
|
214
214
|
allow(core_exporter).to receive(:whitelist_ids).and_return([core1.id])
|
215
215
|
end
|
216
216
|
|
@@ -229,7 +229,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
229
229
|
|
230
230
|
describe "#export_data" do
|
231
231
|
describe "in CORE_MODE" do
|
232
|
-
before(:
|
232
|
+
before(:example) do
|
233
233
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::CORE_MODE
|
234
234
|
end
|
235
235
|
|
@@ -240,7 +240,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
240
240
|
end
|
241
241
|
|
242
242
|
describe "in LOGIN_MODE" do
|
243
|
-
before(:
|
243
|
+
before(:example) do
|
244
244
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::LOGIN_MODE
|
245
245
|
end
|
246
246
|
|
@@ -254,7 +254,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
254
254
|
describe "generation" do
|
255
255
|
describe "#render_manifest_and_output_keys" do
|
256
256
|
describe "in CORE_MODE" do
|
257
|
-
before(:
|
257
|
+
before(:example) do
|
258
258
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::CORE_MODE
|
259
259
|
core_exporter.render_manifest_output_and_keys
|
260
260
|
path = core_exporter.output_final_directory_path + '/' + Metasploit::Credential::Importer::Zip::MANIFEST_FILE_NAME
|
@@ -301,7 +301,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
301
301
|
end
|
302
302
|
|
303
303
|
describe "in LOGIN_MODE" do
|
304
|
-
before(:
|
304
|
+
before(:example) do
|
305
305
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::LOGIN_MODE
|
306
306
|
core_exporter.render_manifest_output_and_keys
|
307
307
|
path = core_exporter.output_final_directory_path + '/' + Metasploit::Credential::Importer::Zip::MANIFEST_FILE_NAME
|
@@ -378,7 +378,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
378
378
|
|
379
379
|
describe "#render_zip" do
|
380
380
|
describe "when there are no SSH keys in the dataset" do
|
381
|
-
before(:
|
381
|
+
before(:example) do
|
382
382
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::CORE_MODE
|
383
383
|
core_exporter.render_manifest_output_and_keys
|
384
384
|
core_exporter.render_zip
|
@@ -409,7 +409,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
409
409
|
private: private_with_key,
|
410
410
|
workspace: workspace)}
|
411
411
|
|
412
|
-
before(:
|
412
|
+
before(:example) do
|
413
413
|
allow(core_exporter).to receive(:mode).and_return Metasploit::Credential::Exporter::Core::CORE_MODE
|
414
414
|
core_exporter.render_manifest_output_and_keys
|
415
415
|
core_exporter.render_zip
|
@@ -432,7 +432,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
432
432
|
end
|
433
433
|
|
434
434
|
describe "the keys directory" do
|
435
|
-
before(:
|
435
|
+
before(:example) do
|
436
436
|
@key_entries = nil
|
437
437
|
Zip::File.open(core_exporter.output_zipfile_path) do |zip_file|
|
438
438
|
@key_entries = zip_file.glob("#{Metasploit::Credential::Importer::Zip::KEYS_SUBDIRECTORY_NAME}/*")
|
@@ -18,7 +18,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
18
18
|
describe "plaintext passwords" do
|
19
19
|
let(:private){ FactoryGirl.build :metasploit_credential_password }
|
20
20
|
|
21
|
-
before(:
|
21
|
+
before(:example) do
|
22
22
|
core.private = private
|
23
23
|
end
|
24
24
|
|
@@ -40,7 +40,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
40
40
|
describe "non-replayable" do
|
41
41
|
let(:private){ FactoryGirl.build :metasploit_credential_nonreplayable_hash }
|
42
42
|
|
43
|
-
before(:
|
43
|
+
before(:example) do
|
44
44
|
core.private = private
|
45
45
|
end
|
46
46
|
|
@@ -62,7 +62,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
62
62
|
describe "NTLM" do
|
63
63
|
let(:private){ FactoryGirl.build :metasploit_credential_ntlm_hash }
|
64
64
|
|
65
|
-
before(:
|
65
|
+
before(:example) do
|
66
66
|
core.private = private
|
67
67
|
end
|
68
68
|
|
@@ -84,7 +84,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
84
84
|
describe "PostgresMD5" do
|
85
85
|
let(:private){ FactoryGirl.build :metasploit_credential_postgres_md5 }
|
86
86
|
|
87
|
-
before(:
|
87
|
+
before(:example) do
|
88
88
|
core.private = private
|
89
89
|
end
|
90
90
|
|
@@ -109,7 +109,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
109
109
|
describe "netlm" do
|
110
110
|
let(:private){ FactoryGirl.build :metasploit_credential_nonreplayable_hash, jtr_type: 'netlm' }
|
111
111
|
|
112
|
-
before(:
|
112
|
+
before(:example) do
|
113
113
|
core.private = private
|
114
114
|
end
|
115
115
|
|
@@ -121,7 +121,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
121
121
|
describe "netntlm" do
|
122
122
|
let(:private){ FactoryGirl.build :metasploit_credential_nonreplayable_hash, jtr_type: 'netntlm' }
|
123
123
|
|
124
|
-
before(:
|
124
|
+
before(:example) do
|
125
125
|
core.private = private
|
126
126
|
end
|
127
127
|
|
@@ -135,7 +135,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
135
135
|
describe "netlmv2" do
|
136
136
|
let(:private){ FactoryGirl.build :metasploit_credential_non_replayable_hash, jtr_type: 'netlmv2' }
|
137
137
|
|
138
|
-
before(:
|
138
|
+
before(:example) do
|
139
139
|
core.private = private
|
140
140
|
end
|
141
141
|
|
@@ -147,7 +147,7 @@ RSpec.describe Metasploit::Credential::Exporter::Pwdump do
|
|
147
147
|
describe "netntlmv2" do
|
148
148
|
let(:private){ FactoryGirl.build :metasploit_credential_non_replayable_hash, jtr_type: 'netntlmv2' }
|
149
149
|
|
150
|
-
before(:
|
150
|
+
before(:example) do
|
151
151
|
core.private = private
|
152
152
|
end
|
153
153
|
|
@@ -5,14 +5,14 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
5
5
|
subject(:core_csv_importer){FactoryGirl.build(:metasploit_credential_core_importer, workspace:workspace)}
|
6
6
|
|
7
7
|
# CSV objects are IOs
|
8
|
-
after(:
|
8
|
+
after(:example) do
|
9
9
|
core_csv_importer.csv_object.rewind
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "validations" do
|
13
13
|
describe "short-form imports" do
|
14
14
|
describe "with well-formed CSV data" do
|
15
|
-
before(:
|
15
|
+
before(:example) do
|
16
16
|
core_csv_importer.input = FactoryGirl.generate :short_well_formed_csv
|
17
17
|
core_csv_importer.private_credential_type = "Metasploit::Credential::Password"
|
18
18
|
end
|
@@ -25,12 +25,12 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
25
25
|
I18n.translate!('activemodel.errors.models.metasploit/credential/importer/core.attributes.private_credential_type.invalid_type')
|
26
26
|
end
|
27
27
|
|
28
|
-
before(:
|
28
|
+
before(:example) do
|
29
29
|
core_csv_importer.input = FactoryGirl.generate :short_well_formed_csv
|
30
30
|
core_csv_importer.private_credential_type = "Metasploit::Credential::SSHKey"
|
31
31
|
end
|
32
32
|
|
33
|
-
it{
|
33
|
+
it{ is_expected.not_to be_valid }
|
34
34
|
|
35
35
|
it 'should report the error being invalid private type' do
|
36
36
|
core_csv_importer.valid?
|
@@ -43,12 +43,12 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
43
43
|
I18n.translate!('activemodel.errors.models.metasploit/credential/importer/core.attributes.input.incorrect_csv_headers')
|
44
44
|
end
|
45
45
|
|
46
|
-
before(:
|
46
|
+
before(:example) do
|
47
47
|
core_csv_importer.input = FactoryGirl.generate :short_well_formed_csv_non_compliant_header
|
48
48
|
core_csv_importer.private_credential_type = "Metasploit::Credential::Password"
|
49
49
|
end
|
50
50
|
|
51
|
-
it{
|
51
|
+
it{ is_expected.not_to be_valid }
|
52
52
|
|
53
53
|
it 'should report the error being invalid headers' do
|
54
54
|
core_csv_importer.valid?
|
@@ -64,7 +64,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "with data that includes a missing Public (username)" do
|
67
|
-
before(:
|
67
|
+
before(:example) do
|
68
68
|
core_csv_importer.input = FactoryGirl.generate :well_formed_csv_compliant_header_missing_public
|
69
69
|
end
|
70
70
|
|
@@ -74,7 +74,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "with data that includes a missing Private" do
|
77
|
-
before(:
|
77
|
+
before(:example) do
|
78
78
|
core_csv_importer.input = FactoryGirl.generate :well_formed_csv_compliant_header_missing_private
|
79
79
|
end
|
80
80
|
|
@@ -96,7 +96,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
96
96
|
}
|
97
97
|
end
|
98
98
|
|
99
|
-
before(:
|
99
|
+
before(:example) do
|
100
100
|
core = Metasploit::Credential::Core.new
|
101
101
|
core.public = FactoryGirl.create(:metasploit_credential_username, username: preexisting_cred_data[:username])
|
102
102
|
core.private = FactoryGirl.create(:metasploit_credential_password, data: preexisting_cred_data[:private_data])
|
@@ -117,11 +117,11 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
117
117
|
I18n.translate!('activemodel.errors.models.metasploit/credential/importer/core.attributes.input.incorrect_csv_headers')
|
118
118
|
end
|
119
119
|
|
120
|
-
before(:
|
120
|
+
before(:example) do
|
121
121
|
core_csv_importer.input = FactoryGirl.generate(:well_formed_csv_non_compliant_header)
|
122
122
|
end
|
123
123
|
|
124
|
-
it {
|
124
|
+
it { is_expected.not_to be_valid }
|
125
125
|
|
126
126
|
it 'should report the error being incorrect headers' do
|
127
127
|
core_csv_importer.valid?
|
@@ -134,7 +134,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
134
134
|
I18n.translate!('activemodel.errors.models.metasploit/credential/importer/core.attributes.input.malformed_csv')
|
135
135
|
end
|
136
136
|
|
137
|
-
before(:
|
137
|
+
before(:example) do
|
138
138
|
core_csv_importer.input = FactoryGirl.generate(:malformed_csv)
|
139
139
|
end
|
140
140
|
|
@@ -151,7 +151,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
151
151
|
I18n.translate!('activemodel.errors.models.metasploit/credential/importer/core.attributes.input.empty_csv')
|
152
152
|
end
|
153
153
|
|
154
|
-
before(:
|
154
|
+
before(:example) do
|
155
155
|
core_csv_importer.input = FactoryGirl.generate(:empty_core_csv)
|
156
156
|
end
|
157
157
|
|
@@ -164,7 +164,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
describe "when accesssing without rewind" do
|
167
|
-
before(:
|
167
|
+
before(:example) do
|
168
168
|
core_csv_importer.csv_object.gets
|
169
169
|
end
|
170
170
|
|
@@ -176,7 +176,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
describe "short-form imports" do
|
179
|
-
before(:
|
179
|
+
before(:example) do
|
180
180
|
core_csv_importer.private_credential_type = "Metasploit::Credential::Password"
|
181
181
|
core_csv_importer.input = FactoryGirl.generate :short_well_formed_csv
|
182
182
|
end
|
@@ -202,7 +202,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
202
202
|
}
|
203
203
|
end
|
204
204
|
|
205
|
-
before(:
|
205
|
+
before(:example) do
|
206
206
|
core = Metasploit::Credential::Core.new
|
207
207
|
core.public = FactoryGirl.create(:metasploit_credential_username, username: preexisting_cred_data[:username])
|
208
208
|
core.private = FactoryGirl.create(:metasploit_credential_password, data: preexisting_cred_data[:private_data])
|
@@ -224,7 +224,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
224
224
|
# Contains 3 unique Publics
|
225
225
|
let(:stored_public){ core_csv_importer.csv_object.gets; core_csv_importer.csv_object.first['username'] }
|
226
226
|
|
227
|
-
before(:
|
227
|
+
before(:example) do
|
228
228
|
Metasploit::Credential::Username.create!(username: stored_public)
|
229
229
|
core_csv_importer.csv_object.rewind
|
230
230
|
end
|
@@ -247,7 +247,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
247
247
|
let(:stored_private_row){ core_csv_importer.csv_object.gets; core_csv_importer.csv_object.first }
|
248
248
|
let(:private_class){ stored_private_row['private_type'].constantize }
|
249
249
|
|
250
|
-
before(:
|
250
|
+
before(:example) do
|
251
251
|
private_cred = private_class.new
|
252
252
|
private_cred.data = stored_private_row['private_data']
|
253
253
|
private_cred.save!
|
@@ -272,7 +272,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
272
272
|
# Contains 2 unique Realms
|
273
273
|
let(:stored_realm_row){ core_csv_importer.csv_object.gets; core_csv_importer.csv_object.first }
|
274
274
|
|
275
|
-
before(:
|
275
|
+
before(:example) do
|
276
276
|
Metasploit::Credential::Realm.create(key: stored_realm_row['realm_key'],
|
277
277
|
value: stored_realm_row['realm_value'])
|
278
278
|
end
|
@@ -296,7 +296,7 @@ RSpec.describe Metasploit::Credential::Importer::Core do
|
|
296
296
|
end
|
297
297
|
|
298
298
|
context "when there are Logins in the input" do
|
299
|
-
before(:
|
299
|
+
before(:example) do
|
300
300
|
core_csv_importer.input = FactoryGirl.generate :well_formed_csv_compliant_header_with_service_info
|
301
301
|
end
|
302
302
|
|