Files
metasploit-gs/lib/msf/core/exploit/fileformat.rb
T
HD Moore f9eccd1a59 Fix up the fileformat mixin; some slightly wrong ruby and an extra \n at the end of the generated files
git-svn-id: file:///home/svn/framework3/trunk@6338 4d416f70-5f16-0410-b530-b9f4589650da
2009-03-14 01:28:59 +00:00

31 lines
633 B
Ruby

###
#
# 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
)
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