Make target_uri default to "/" in case the TARGETURI option is nil or empty

unstable
sinn3r 2012-04-07 19:43:19 -05:00
parent 05eba0ab4c
commit 9a229dfcff
1 changed files with 4 additions and 1 deletions

View File

@ -524,7 +524,10 @@ module Exploit::Remote::HttpClient
#
def target_uri
begin
URI(datastore['TARGETURI'])
# In case TARGETURI is empty, at least we default to '/'
u = datastore['TARGETURI']
u = "/" if u.nil? or u.empty?
URI(u)
rescue ::URI::InvalidURIError
print_error "Invalid URI: #{datastore['TARGETURI'].inspect}"
raise Msf::OptionValidateError.new(['TARGETURI'])