2012-06-29 00:18:28 -05:00
|
|
|
# -*- coding: binary -*-
|
2008-12-03 01:23:27 +00:00
|
|
|
###
|
|
|
|
|
#
|
|
|
|
|
# This module exposes a simple method to create a file.
|
|
|
|
|
#
|
|
|
|
|
###
|
|
|
|
|
|
|
|
|
|
module Msf
|
2010-09-26 18:28:58 +00:00
|
|
|
module Exploit::FILEFORMAT
|
|
|
|
|
|
2011-10-27 17:01:51 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2013-08-30 16:28:33 -05:00
|
|
|
|
2008-12-03 01:23:27 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
|
super
|
2013-08-30 16:28:33 -05:00
|
|
|
|
2008-12-03 01:23:27 +00:00
|
|
|
register_options(
|
|
|
|
|
[
|
2011-10-27 17:01:51 +00:00
|
|
|
OptString.new('FILENAME', [ false, 'The file name.', nil]),
|
2008-12-03 01:23:27 +00:00
|
|
|
], Msf::Exploit::FILEFORMAT
|
|
|
|
|
)
|
2013-08-30 16:28:33 -05:00
|
|
|
|
2010-09-26 18:28:58 +00:00
|
|
|
register_advanced_options(
|
|
|
|
|
[
|
|
|
|
|
OptBool.new('DisablePayloadHandler', [ false, "Disable the handler code for the selected payload", true ])
|
|
|
|
|
], Msf::Exploit::FILEFORMAT
|
|
|
|
|
)
|
2008-12-03 01:23:27 +00:00
|
|
|
end
|
2013-08-30 16:28:33 -05:00
|
|
|
|
2012-09-10 15:59:01 -05:00
|
|
|
def file_format_filename
|
|
|
|
|
datastore['FILENAME']
|
|
|
|
|
end
|
2013-08-30 16:28:33 -05:00
|
|
|
|
2013-06-13 16:42:18 -05:00
|
|
|
def file_create(data)
|
|
|
|
|
fname = file_format_filename
|
2011-10-27 17:01:51 +00:00
|
|
|
ltype = "exploit.fileformat.#{self.shortname}"
|
2011-11-20 12:32:06 +11:00
|
|
|
full_path = store_local(ltype, nil, data, fname)
|
2011-10-27 17:01:51 +00:00
|
|
|
print_good "#{fname} stored at #{full_path}"
|
2011-06-09 14:21:52 +00:00
|
|
|
end
|
2011-10-27 17:01:51 +00:00
|
|
|
|
2008-12-03 01:23:27 +00:00
|
|
|
end
|
|
|
|
|
end
|