inherit the options from the default target so we can autocomplete before the rhost resolution occurs

bug/bundler_fix
Brent Cook 2017-02-17 15:50:45 -06:00
parent 6e62899e1c
commit f4befda59b
1 changed files with 5 additions and 4 deletions

View File

@ -287,15 +287,17 @@ class Exploit < Msf::Module
# to the information hash. # to the information hash.
super(info) super(info)
self.default_target = info['DefaultTarget'] || 0
# Skip this whole routine if there are no targets # Skip this whole routine if there are no targets
unless info['Targets'].nil? if self.default_target == 0 && info['Targets']
# Add an Automatic Target to the Exploit if it doesn't have one # Add an Automatic Target to the Exploit if it doesn't have one
unless has_auto_target?(info['Targets']) if !has_auto_target?(info['Targets'])
# Don't add the automatic target unless there's already more than one target to pick from # Don't add the automatic target unless there's already more than one target to pick from
if info['Targets'].count > 1 if info['Targets'].count > 1
# Finally, only add the target if there is a remote host option # Finally, only add the target if there is a remote host option
if self.respond_to?(:rhost) && self.respond_to?(:auto_targeted_index) if self.respond_to?(:rhost) && self.respond_to?(:auto_targeted_index)
auto = ["Automatic", { 'AutoGenerated' => true}] auto = ["Automatic", {'AutoGenerated' => true}.merge(info['Targets'][self.default_target][1])]
info['Targets'].unshift(auto) info['Targets'].unshift(auto)
end end
end end
@ -304,7 +306,6 @@ class Exploit < Msf::Module
self.targets = Rex::Transformer.transform(info['Targets'], Array, self.targets = Rex::Transformer.transform(info['Targets'], Array,
[ Target ], 'Targets') [ Target ], 'Targets')
self.default_target = info['DefaultTarget'] || 0
self.payload_info = info['Payload'] || {} self.payload_info = info['Payload'] || {}
self.successful = false self.successful = false
self.session_count = 0 self.session_count = 0