Skip to content

Commit 31d36d9

Browse files
David MaloneyBrent Cook
authored andcommitted
if autotargeting fails fall back
fallback to the original first target if auto-targeting fails
1 parent 9dc4ee5 commit 31d36d9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/msf/core/exploit.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,17 @@ def passive?
689689
#
690690
def target
691691
if self.respond_to?(:auto_targeted_index)
692-
auto_idx = auto_targeted_index
693-
if auto_idx.present?
694-
datastore['TARGET'] = auto_idx
692+
if auto_target?
693+
auto_idx = auto_targeted_index
694+
if auto_idx.present?
695+
datastore['TARGET'] = auto_idx
696+
else
697+
# If our inserted Automatic Target was selected but we failed to
698+
# find a suitable target, we just grab the original first target.
699+
datastore['TARGET'] = 1
700+
end
695701
end
702+
696703
end
697704

698705
target_idx = target_index

0 commit comments

Comments
 (0)