Skip to content

Commit a61b92a

Browse files
David MaloneyBrent Cook
authored andcommitted
tweak target selection
the target selection actually adjust the datastore as if a user selected the target, this prevents a mismatch between the target and the target index MS-2325
1 parent 3d2957d commit a61b92a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/msf/core/exploit.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def initialize(info = {})
302302

303303
self.targets = Rex::Transformer.transform(info['Targets'], Array,
304304
[ Target ], 'Targets')
305-
self.default_target = info['DefaultTarget']
305+
self.default_target = info['DefaultTarget'] || 0
306306
self.payload_info = info['Payload'] || {}
307307
self.successful = false
308308
self.session_count = 0
@@ -688,13 +688,11 @@ def passive?
688688
# default target, that one will be automatically used.
689689
#
690690
def target
691-
target_idx = target_index
692-
693691
auto_idx = auto_targeted_index
694692
unless auto_idx.nil?
695-
target_idx = auto_idx
693+
datastore['TARGET'] = auto_idx
696694
end
697-
695+
target_idx = target_index
698696
return (target_idx) ? targets[target_idx.to_i] : nil
699697
end
700698

spec/file_fixtures/modules/exploits/auto_target_windows.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def initialize(info = {})
6262
],
6363
'DisclosureDate' => 'Jan 01 1999'
6464
))
65+
66+
deregister_options('RPORT')
6567
end
6668

6769
def exploit

0 commit comments

Comments
 (0)