parent
a27c1d7dcc
commit
b05b2657bc
|
@ -18,9 +18,9 @@ PATH
|
||||||
PATH
|
PATH
|
||||||
remote: /Users/trevor/rapid7/metasploit-credential
|
remote: /Users/trevor/rapid7/metasploit-credential
|
||||||
specs:
|
specs:
|
||||||
metasploit-credential (0.5.5.pre.electro.pre.release)
|
metasploit-credential (0.6.1.pre.electro.pre.release)
|
||||||
metasploit-concern (~> 0.1.0)
|
metasploit-concern (~> 0.1.0)
|
||||||
metasploit-model (>= 0.25.1, < 0.26)
|
metasploit-model (>= 0.25.3, < 0.26)
|
||||||
metasploit_data_models (>= 0.18.0.pre.compatibility, < 0.19)
|
metasploit_data_models (>= 0.18.0.pre.compatibility, < 0.19)
|
||||||
rubyntlm
|
rubyntlm
|
||||||
rubyzip (~> 1.1)
|
rubyzip (~> 1.1)
|
||||||
|
@ -62,12 +62,12 @@ GEM
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
fivemat (1.2.1)
|
fivemat (1.2.1)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
i18n (0.6.9)
|
i18n (0.6.11)
|
||||||
journey (1.0.4)
|
journey (1.0.4)
|
||||||
json (1.8.1)
|
json (1.8.1)
|
||||||
metasploit-concern (0.1.1)
|
metasploit-concern (0.1.1)
|
||||||
activesupport (~> 3.0, >= 3.0.0)
|
activesupport (~> 3.0, >= 3.0.0)
|
||||||
metasploit-model (0.25.2)
|
metasploit-model (0.25.3)
|
||||||
activesupport
|
activesupport
|
||||||
metasploit_data_models (0.18.0)
|
metasploit_data_models (0.18.0)
|
||||||
activerecord (>= 3.2.13, < 4.0.0)
|
activerecord (>= 3.2.13, < 4.0.0)
|
||||||
|
|
|
@ -3628,6 +3628,7 @@ class DBManager
|
||||||
data.entries.each do |e|
|
data.entries.each do |e|
|
||||||
target = ::File.join(@import_filedata[:zip_tmp],e.name)
|
target = ::File.join(@import_filedata[:zip_tmp],e.name)
|
||||||
data.extract(e,target)
|
data.extract(e,target)
|
||||||
|
|
||||||
if target =~ /^.*.xml$/
|
if target =~ /^.*.xml$/
|
||||||
target_data = ::File.open(target, "rb") {|f| f.read 1024}
|
target_data = ::File.open(target, "rb") {|f| f.read 1024}
|
||||||
if import_filetype_detect(target_data) == :msf_xml
|
if import_filetype_detect(target_data) == :msf_xml
|
||||||
|
@ -3636,6 +3637,16 @@ class DBManager
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Import any creds if there are some in the import file
|
||||||
|
Dir.entries(@import_filedata[:zip_tmp]).each do |entry|
|
||||||
|
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)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# This will kick the newly-extracted XML file through
|
# This will kick the newly-extracted XML file through
|
||||||
# the import_file process all over again.
|
# the import_file process all over again.
|
||||||
if @import_filedata[:zip_extracted_xml]
|
if @import_filedata[:zip_extracted_xml]
|
||||||
|
@ -3802,6 +3813,17 @@ class DBManager
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
# @param report [REXML::Element] to be imported
|
# @param report [REXML::Element] to be imported
|
||||||
# @param args [Hash]
|
# @param args [Hash]
|
||||||
# @param base_dir [String]
|
# @param base_dir [String]
|
||||||
|
|
|
@ -352,6 +352,7 @@ module Msf
|
||||||
|
|
||||||
## Handle old-style (pre 4.10) XML files
|
## Handle old-style (pre 4.10) XML files
|
||||||
if btag == "MetasploitV4"
|
if btag == "MetasploitV4"
|
||||||
|
if host.elements['creds'].present?
|
||||||
unless host.elements['creds'].elements.empty?
|
unless host.elements['creds'].elements.empty?
|
||||||
origin = Metasploit::Credential::Origin::Import.create(filename: "console-import-#{Time.now.to_i}")
|
origin = Metasploit::Credential::Origin::Import.create(filename: "console-import-#{Time.now.to_i}")
|
||||||
|
|
||||||
|
@ -380,6 +381,7 @@ module Msf
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
host.elements.each('sessions/session') do |sess|
|
host.elements.each('sessions/session') do |sess|
|
||||||
|
|
Loading…
Reference in New Issue