Pass workspace down in import of creds dump

MSP-9948
bug/bundler_fix
Trevor Rosen 2014-07-14 16:40:41 -05:00
parent b05b2657bc
commit aca627489e
No known key found for this signature in database
GPG Key ID: 255ADB7A642D3928
3 changed files with 16 additions and 15 deletions

View File

@ -7,8 +7,7 @@ group :db do
# Needed for Msf::DbManager
gem 'activerecord', '>= 3.0.0', '< 4.0.0'
# Metasploit::Credential database models
# gem 'metasploit-credential', git: 'github-metasploit-credential:rapid7/metasploit-credential.git', tag: 'v0.5.1-electro-release'
gem 'metasploit-credential', path: '/Users/trevor/rapid7/metasploit-credential'
gem 'metasploit-credential', git: 'github-metasploit-credential:rapid7/metasploit-credential.git', tag: 'v0.6.3.pre.electro.pre.release'
# Database models shared between framework and Pro.
gem 'metasploit_data_models', '~> 0.18.0.pre.compatibility'
# Needed for module caching in Mdm::ModuleDetails

View File

@ -1,3 +1,15 @@
GIT
remote: github-metasploit-credential:rapid7/metasploit-credential.git
revision: 3059b9ccd2d0a99566b9d0ad356e235dc197754e
tag: v0.6.3.pre.electro.pre.release
specs:
metasploit-credential (0.6.3.pre.electro.pre.release)
metasploit-concern (~> 0.1.0)
metasploit-model (>= 0.25.3, < 0.26)
metasploit_data_models (>= 0.18.0.pre.compatibility, < 0.19)
rubyntlm
rubyzip (~> 1.1)
PATH
remote: .
specs:
@ -15,16 +27,6 @@ PATH
sqlite3
tzinfo
PATH
remote: /Users/trevor/rapid7/metasploit-credential
specs:
metasploit-credential (0.6.1.pre.electro.pre.release)
metasploit-concern (~> 0.1.0)
metasploit-model (>= 0.25.3, < 0.26)
metasploit_data_models (>= 0.18.0.pre.compatibility, < 0.19)
rubyntlm
rubyzip (~> 1.1)
GEM
remote: https://rubygems.org/
specs:

View File

@ -3595,7 +3595,7 @@ class DBManager
# XXX: Refactor so it's not quite as sanity-blasting.
def import_msf_zip(args={}, &block)
data = args[:data]
wpsace = args[:wspace] || workspace
wspace = args[:wspace] || workspace
bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
new_tmp = ::File.join(Dir::tmpdir,"msf","imp_#{Rex::Text::rand_text_alphanumeric(4)}",@import_filedata[:zip_basename])
@ -3642,7 +3642,7 @@ class DBManager
if entry =~ /^.*#{Regexp.quote(Metasploit::Credential::Exporter::Core::CREDS_DUMP_FILE_IDENTIFIER)}.*/
manifest_file_path = File.join(@import_filedata[:zip_tmp], entry, Metasploit::Credential::Importer::Zip::MANIFEST_FILE_NAME)
if File.exists? manifest_file_path
import_msf_cred_dump(manifest_file_path)
import_msf_cred_dump(manifest_file_path, wspace)
end
end
end
@ -3816,7 +3816,7 @@ class DBManager
# Import credentials given a path to a valid manifest file
# @param creds_dump_manifest_path [String]
# @return [void]
def import_msf_cred_dump(creds_dump_manifest_path)
def import_msf_cred_dump(creds_dump_manifest_path, workspace)
manifest_file = File.open(creds_dump_manifest_path)
origin = Metasploit::Credential::Origin::Import.create!(filename: File.basename(creds_dump_manifest_path))
importer = Metasploit::Credential::Importer::Core.new(workspace: workspace, input: manifest_file, origin: origin)