Extract Msf::DBManager::Import::MetasploitFramework::Credential

MSP-11124
bug/bundler_fix
Luke Imhoff 2014-10-15 11:12:13 -05:00
parent 7d101be0f5
commit d0d0c478aa
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
3 changed files with 38 additions and 35 deletions

View File

@ -347,41 +347,6 @@ module Msf::DBManager::Import
raise DBImportError.new("Could not automatically determine file type") raise DBImportError.new("Could not automatically determine file type")
end end
# Import credentials given a path to a valid manifest file
#
# @param creds_dump_manifest_path [String]
# @param workspace [Mdm::Workspace] Default: {#workspace}
# @return [void]
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)
importer.import!
end
# Import credentials given a path to a valid manifest file
#
# @option args [String] :filename
# @option args [Mdm::Workspace] :wspace Default: {#workspace}
# @return [void]
def import_msf_cred_dump_zip(args = {})
wspace = args[:wspace] || workspace
origin = Metasploit::Credential::Origin::Import.create!(filename: File.basename(args[:filename]))
importer = Metasploit::Credential::Importer::Zip.new(workspace: wspace, input: File.open(args[:filename]), origin: origin)
importer.import!
nil
end
# Perform in an import of an msfpwdump file
def import_msf_pwdump(args={}, &block)
filename = File.basename(args[:data].path)
wspace = args[:wspace] || workspace
origin = Metasploit::Credential::Origin::Import.create!(filename: filename)
importer = Metasploit::Credential::Importer::Pwdump.new(input: args[:data], workspace: wspace, filename: filename, origin:origin)
importer.import!
importer.input.close unless importer.input.closed?
end
# There is no place the NBE actually stores the plugin name used to # There is no place the NBE actually stores the plugin name used to
# scan. You get "Security Note" or "Security Warning," and that's it. # scan. You get "Security Note" or "Security Warning," and that's it.
def import_nessus_nbe(args={}, &block) def import_nessus_nbe(args={}, &block)

View File

@ -1,7 +1,9 @@
module Msf::DBManager::Import::MetasploitFramework module Msf::DBManager::Import::MetasploitFramework
autoload :Credential, 'msf/core/db_manager/import/metasploit_framework/credential'
autoload :XML, 'msf/core/db_manager/import/metasploit_framework/xml' autoload :XML, 'msf/core/db_manager/import/metasploit_framework/xml'
autoload :Zip, 'msf/core/db_manager/import/metasploit_framework/zip' autoload :Zip, 'msf/core/db_manager/import/metasploit_framework/zip'
include Msf::DBManager::Import::MetasploitFramework::Credential
include Msf::DBManager::Import::MetasploitFramework::XML include Msf::DBManager::Import::MetasploitFramework::XML
include Msf::DBManager::Import::MetasploitFramework::Zip include Msf::DBManager::Import::MetasploitFramework::Zip
end end

View File

@ -0,0 +1,36 @@
module Msf::DBManager::Import::MetasploitFramework::Credential
# Import credentials given a path to a valid manifest file
#
# @param creds_dump_manifest_path [String]
# @param workspace [Mdm::Workspace] Default: {#workspace}
# @return [void]
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)
importer.import!
end
# Import credentials given a path to a valid manifest file
#
# @option args [String] :filename
# @option args [Mdm::Workspace] :wspace Default: {#workspace}
# @return [void]
def import_msf_cred_dump_zip(args = {})
wspace = args[:wspace] || workspace
origin = Metasploit::Credential::Origin::Import.create!(filename: File.basename(args[:filename]))
importer = Metasploit::Credential::Importer::Zip.new(workspace: wspace, input: File.open(args[:filename]), origin: origin)
importer.import!
nil
end
# Perform in an import of an msfpwdump file
def import_msf_pwdump(args={}, &block)
filename = File.basename(args[:data].path)
wspace = args[:wspace] || workspace
origin = Metasploit::Credential::Origin::Import.create!(filename: filename)
importer = Metasploit::Credential::Importer::Pwdump.new(input: args[:data], workspace: wspace, filename: filename, origin:origin)
importer.import!
importer.input.close unless importer.input.closed?
end
end