Files
metasploit-gs/lib/msf/core/exploit/fileformat.rb
T

31 lines
633 B
Ruby
Raw Normal View History

###
#
# This module exposes a simple method to create a file.
#
###
module Msf
module Exploit::FILEFORMAT
def initialize(info = {})
super
register_options(
[
2008-12-03 15:47:10 +00:00
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
)
end
def file_create(data)
out = File.expand_path(File.join(datastore['OUTPUTPATH'], datastore['FILENAME']))
fd = File.new(out,"wb")
fd.write(data)
fd.close
print_status("Generated output file #{out}")
end
end
end