Skip to content

Commit 403b5e2

Browse files
committed
Move TARGET check into option_values_payloads
1 parent 9941097 commit 403b5e2

File tree

1 file changed

+5
-9
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+5
-9
lines changed

lib/msf/ui/console/command_dispatcher/core.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def initialize(driver)
141141

142142
@cache_payloads = nil
143143
@previous_module = nil
144+
@previous_target = nil
144145
@history_limit = 100
145146
end
146147

@@ -1625,12 +1626,6 @@ def cmd_set(*args)
16251626
# Set the supplied name to the supplied value
16261627
name = args[0]
16271628
value = args[1, args.length-1].join(' ')
1628-
if (name.upcase == "TARGET")
1629-
# Different targets can have different architectures and platforms
1630-
# so we need to rebuild the payload list whenever the target
1631-
# changes.
1632-
@cache_payloads = nil
1633-
end
16341629

16351630
# If the driver indicates that the value is not valid, bust out.
16361631
if (driver.on_variable_set(global, name, value) == false)
@@ -2286,15 +2281,16 @@ def option_values_dispatch(o, str, words)
22862281
# Provide valid payload options for the current exploit
22872282
#
22882283
def option_values_payloads
2289-
if @cache_payloads && active_module == @previous_module
2284+
if @cache_payloads && active_module == @previous_module && active_module.target == @previous_target
22902285
return @cache_payloads
22912286
end
22922287

22932288
@previous_module = active_module
2289+
@previous_target = active_module.target
22942290

2295-
@cache_payloads = active_module.compatible_payloads.map { |refname, payload|
2291+
@cache_payloads = active_module.compatible_payloads.map do |refname, payload|
22962292
refname
2297-
}
2293+
end
22982294

22992295
@cache_payloads
23002296
end

0 commit comments

Comments
 (0)