Skip to content

Commit

Permalink
Land #12946, set PAYLOAD normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
wvu committed Feb 19, 2020
2 parents 9010446 + c591704 commit 7a9ecd7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/msf/ui/console/command_dispatcher/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1577,13 +1577,19 @@ def cmd_set(*args)
name = args[0]
value = args[1, args.length-1].join(' ')

# Set PAYLOAD by index
# Set PAYLOAD
if name.upcase == 'PAYLOAD' && active_module && (active_module.exploit? || active_module.evasion?)
index_from_list(payload_show_results, value) do |mod|
return false unless mod && mod.respond_to?(:first)
if value.start_with?('/', 'payload/')
# Trims starting `/`, `payload/`, `/payload/` from user input
value.sub!(%r{^/?(?:payload/)?}, '')
else
# Checking set PAYLOAD by index
index_from_list(payload_show_results, value) do |mod|
return false unless mod && mod.respond_to?(:first)

# [name, class] from payload_show_results
value = mod.first
# [name, class] from payload_show_results
value = mod.first
end
end
end

Expand Down

0 comments on commit 7a9ecd7

Please sign in to comment.