### # # This module exposes a simple method to create a file. # ### module Msf module Exploit::FILEFORMAT def initialize(info = {}) super register_options( [ OptString.new('FILENAME', [ true, 'The file name.', 'MSF']), OptString.new('OUTPUTPATH', [ true, 'The location of the file.', File.join(Msf::Config.install_root, 'data', 'exploits')]), ], Msf::Exploit::FILEFORMAT ) def file_create(data) fd = File.new("#{datastore['OUTPUTPATH']}/#{datastore['FILENAME']}","wb") fd.puts data fd.close print_status("File '#{datastore['FILENAME']}' is located in '#{datastore['OUTPUTPATH']}' ...") end end end end