A little cleaner method for determining the nature of imported zip files.
git-svn-id: file:///home/svn/framework3/trunk@12472 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
e99b5a4f35
commit
94be33e8ee
|
@ -2077,12 +2077,12 @@ class DBManager
|
|||
@import_filedata[:zip_filename] = File.split(data.to_s).last
|
||||
@import_filedata[:zip_basename] = @import_filedata[:zip_filename].gsub(/\.zip$/,"")
|
||||
@import_filedata[:zip_entry_names] = data.entries.map {|x| x.name}
|
||||
@import_filedata[:zip_xml] = @import_filedata[:zip_entry_names].grep(/^(.*)_[0-9]+\.xml$/).first
|
||||
@import_filedata[:zip_wspace] = @import_filedata[:zip_xml].to_s.match(/^(.*)_[0-9]+\.xml$/)[1]
|
||||
@import_filedata[:type] = "Metasploit ZIP Report"
|
||||
if @import_filedata[:zip_xml]
|
||||
begin
|
||||
@import_filedata[:zip_xml] = @import_filedata[:zip_entry_names].grep(/^(.*)_[0-9]+\.xml$/).first || raise
|
||||
@import_filedata[:zip_wspace] = @import_filedata[:zip_xml].to_s.match(/^(.*)_[0-9]+\.xml$/)[1]
|
||||
@import_filedata[:type] = "Metasploit ZIP Report"
|
||||
return :msf_zip
|
||||
else
|
||||
rescue
|
||||
raise DBImportError.new("The zip file provided is not a Metasploit ZIP report")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue