Extract Msf::DBManager::Import::MetasploitFramework::Credential
MSP-11124bug/bundler_fix
parent
7d101be0f5
commit
d0d0c478aa
|
@ -347,41 +347,6 @@ module Msf::DBManager::Import
|
|||
raise DBImportError.new("Could not automatically determine file type")
|
||||
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
|
||||
# scan. You get "Security Note" or "Security Warning," and that's it.
|
||||
def import_nessus_nbe(args={}, &block)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
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 :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::Zip
|
||||
end
|
|
@ -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
|
Loading…
Reference in New Issue