Skip to content

Commit 44ff3ec

Browse files
author
jvazquez-r7
committed
Land rapid7#1953, @wchen-r7's fix around fileformat
2 parents fd74390 + 1280143 commit 44ff3ec

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

lib/msf/core/exploit/fileformat.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def file_format_filename
3030
datastore['FILENAME']
3131
end
3232

33-
def file_create(data, filename = nil)
34-
fname = filename || file_format_filename
33+
def file_create(data)
34+
fname = file_format_filename
3535
ltype = "exploit.fileformat.#{self.shortname}"
3636
full_path = store_local(ltype, nil, data, fname)
3737
print_good "#{fname} stored at #{full_path}"

modules/exploits/windows/fileformat/ultraiso_ccd.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,18 @@ def exploit
206206
sploit << idx_line
207207

208208
file_create(sploit)
209-
file_create('', datastore['FILENAME'].gsub(/\.ccd$/, '.img'))
209+
210+
# This extends the current class, and changes the file_format_name.
211+
# This allows us to use the file_create(data) to store the created
212+
# file in the correct directory.
213+
214+
class << self
215+
def file_format_filename
216+
datastore['FILENAME'].gsub(/\.ccd$/, '.img')
217+
end
218+
end
219+
220+
file_create('')
210221
end
211222

212-
end
223+
end

modules/exploits/windows/fileformat/ultraiso_cue.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,18 @@ def exploit
111111

112112
print_status("Creating '#{datastore['FILENAME']}' using target '#{target.name}' ...")
113113
file_create(cue_data)
114-
file_create('', datastore['FILENAME'].gsub(/\.cue$/, '.bin'))
115114

115+
# This extends the current class, and changes the file_format_name.
116+
# This allows us to use the file_create(data) to store the created
117+
# file in the correct directory.
116118

119+
class << self
120+
def file_format_filename
121+
datastore['FILENAME'].gsub(/\.cue$/, '.bin')
122+
end
123+
end
124+
125+
file_create('')
117126
end
118127

119-
end
128+
end

0 commit comments

Comments
 (0)