diff --git a/lib/msf/core/exploit/fileformat.rb b/lib/msf/core/exploit/fileformat.rb index acdfb7ffe4..a24e1a9a67 100644 --- a/lib/msf/core/exploit/fileformat.rb +++ b/lib/msf/core/exploit/fileformat.rb @@ -30,8 +30,8 @@ module Exploit::FILEFORMAT datastore['FILENAME'] end - def file_create(data) - fname = file_format_filename + def file_create(data, filename = nil) + fname = filename || file_format_filename ltype = "exploit.fileformat.#{self.shortname}" full_path = store_local(ltype, nil, data, fname) print_good "#{fname} stored at #{full_path}" diff --git a/modules/exploits/windows/fileformat/ultraiso_ccd.rb b/modules/exploits/windows/fileformat/ultraiso_ccd.rb index ff8439299d..e24e67ae93 100644 --- a/modules/exploits/windows/fileformat/ultraiso_ccd.rb +++ b/modules/exploits/windows/fileformat/ultraiso_ccd.rb @@ -206,18 +206,7 @@ class Metasploit3 < Msf::Exploit::Remote sploit << idx_line file_create(sploit) - - # This extends the current class, and changes the file_format_name. - # This allows us to use the file_create(data) to store the created - # file in the correct directory. - - class << self - def file_format_filename - datastore['FILENAME'].gsub(/\.ccd$/, '.img') - end - end - - file_create('') + file_create('', datastore['FILENAME'].gsub(/\.ccd$/, '.img')) end end diff --git a/modules/exploits/windows/fileformat/ultraiso_cue.rb b/modules/exploits/windows/fileformat/ultraiso_cue.rb index 57b60e07a7..c35fdf356f 100644 --- a/modules/exploits/windows/fileformat/ultraiso_cue.rb +++ b/modules/exploits/windows/fileformat/ultraiso_cue.rb @@ -111,18 +111,9 @@ class Metasploit3 < Msf::Exploit::Remote print_status("Creating '#{datastore['FILENAME']}' using target '#{target.name}' ...") file_create(cue_data) + file_create('', datastore['FILENAME'].gsub(/\.cue$/, '.bin')) - # This extends the current class, and changes the file_format_name. - # This allows us to use the file_create(data) to store the created - # file in the correct directory. - class << self - def file_format_filename - datastore['FILENAME'].gsub(/\.cue$/, '.bin') - end - end - - file_create('') end end