Skip to content

Commit 72c641f

Browse files
committed
Land rapid7#7889 - use a better check for whether rhosts exists
2 parents 0c749d2 + 7652927 commit 72c641f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/msf/core/exploit.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,14 @@ def initialize(info = {})
294294
# Don't add the automatic target unless there's already more than one target to pick from
295295
if info['Targets'].count > 1
296296
# Finally, only add the target if there is a remote host option
297-
if self.respond_to?(:rhost)
297+
if self.respond_to?(:rhost) && self.respond_to?(:auto_targeted_index)
298298
auto = ["Automatic", { 'AutoGenerated' => true}]
299299
info['Targets'].unshift(auto)
300300
end
301301
end
302302
end
303303
end
304304

305-
306305
self.targets = Rex::Transformer.transform(info['Targets'], Array,
307306
[ Target ], 'Targets')
308307
self.default_target = info['DefaultTarget'] || 0
@@ -702,7 +701,6 @@ def target
702701
datastore['TARGET'] = 1
703702
end
704703
end
705-
706704
end
707705

708706
target_idx = target_index

0 commit comments

Comments
 (0)