Module: Msf::DBManager::Import::MetasploitFramework::Credential

Included in:
Msf::DBManager::Import::MetasploitFramework
Defined in:
lib/msf/core/db_manager/import/metasploit_framework/credential.rb

Instance Method Summary collapse

Instance Method Details

#import_msf_cred_dump(creds_dump_manifest_path, workspace) ⇒ void

This method returns an undefined value.

Import credentials given a path to a valid manifest file

Parameters:

  • creds_dump_manifest_path (String)
  • workspace (Mdm::Workspace)

    Default: #workspace


7
8
9
10
11
12
# File 'lib/msf/core/db_manager/import/metasploit_framework/credential.rb', line 7

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_msf_cred_dump_zip(args = {}) ⇒ void

This method returns an undefined value.

Import credentials given a path to a valid manifest file

Parameters:

  • args (Hash) (defaults to: {})

    a customizable set of options

Options Hash (args):

  • :filename (String)
  • :workspace (Mdm::Workspace)

    Default: #workspace


19
20
21
22
23
24
25
# File 'lib/msf/core/db_manager/import/metasploit_framework/credential.rb', line 19

def import_msf_cred_dump_zip(args = {})
  wspace = Msf::Util::DBManager.process_opts_workspace(args, framework)
  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

#import_msf_pwdump(args = {}, &block) ⇒ Object

Perform in an import of an msfpwdump file


28
29
30
31
32
33
34
35
# File 'lib/msf/core/db_manager/import/metasploit_framework/credential.rb', line 28

def import_msf_pwdump(args={}, &block)
  filename = File.basename(args[:data].path)
  wspace   = Msf::Util::DBManager.process_opts_workspace(args, framework)
  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