Skip to content

Commit cd64e35

Browse files
RuslaideeminRuslaideemin
authored andcommitted
Fix UltraISO file creation
This makes file creation where datastore['FILENAME'] is not used when a different filename is required, and ends up creating files in the wrong place.
1 parent c6b4290 commit cd64e35

File tree

3 files changed

+4
-24
lines changed

3 files changed

+4
-24
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)
34-
fname = file_format_filename
33+
def file_create(data, filename = nil)
34+
fname = filename || 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: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,7 @@ def exploit
206206
sploit << idx_line
207207

208208
file_create(sploit)
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('')
209+
file_create('', datastore['FILENAME'].gsub(/\.ccd$/, '.img'))
221210
end
222211

223212
end

modules/exploits/windows/fileformat/ultraiso_cue.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,9 @@ 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'))
114115

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.
118116

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

128119
end

0 commit comments

Comments
 (0)