Land #11497, file: RHOSTS fix for exploits
This commit is contained in:
@@ -165,9 +165,12 @@ class Exploit
|
||||
end
|
||||
|
||||
rhosts = mod.datastore['RHOSTS']
|
||||
rhosts_range = Rex::Socket::RangeWalker.new(rhosts)
|
||||
if rhosts
|
||||
rhosts_opt = Msf::OptAddressRange.new('RHOSTS')
|
||||
rhosts_range = Rex::Socket::RangeWalker.new(rhosts_opt.normalize(rhosts))
|
||||
end
|
||||
# For multiple targets exploit attempts.
|
||||
if rhosts && rhosts_range.length.to_i > 1
|
||||
if rhosts_range && rhosts_range.length > 1
|
||||
opts[:multi] = true
|
||||
rhosts_range.each do |rhost|
|
||||
nmod = mod.replicant
|
||||
@@ -196,7 +199,7 @@ class Exploit
|
||||
# For single target or no rhosts option.
|
||||
else
|
||||
# avoid bug when the cidr of rhosts is 32, like 8.8.8.8/32
|
||||
if rhosts_range.length == 1
|
||||
if rhosts_range && rhosts_range.length == 1
|
||||
mod.datastore['RHOST'] = (Rex::Socket.addr_itoa(rhosts_range.ranges.first.start))
|
||||
end
|
||||
session = exploit_single(mod, opts)
|
||||
|
||||
Reference in New Issue
Block a user