Use framework.payloads instead of modules

When we know the module we're creating is definitely a payload, don't
bother looking in the other module sets.

Also removes an exception message that gets ignored anyway because the
exception class has a hard-coded #to_s
bug/bundler_fix
James Lee 2012-12-05 12:30:55 -06:00
parent 77af4ba559
commit d57c24dd5f
3 changed files with 9 additions and 10 deletions

View File

@ -69,8 +69,7 @@ module Exploit
# Make sure parameters are valid. # Make sure parameters are valid.
if (opts['Payload'] == nil) if (opts['Payload'] == nil)
raise MissingPayloadError, raise MissingPayloadError.new, caller
"You must specify a payload.", caller
end end
# Verify the options # Verify the options
@ -81,7 +80,7 @@ module Exploit
# Initialize the driver instance # Initialize the driver instance
driver.exploit = exploit driver.exploit = exploit
driver.payload = exploit.framework.modules.create(opts['Payload']) driver.payload = exploit.framework.payloads.create(opts['Payload'])
# Set the force wait for session flag if the caller requested force # Set the force wait for session flag if the caller requested force
# blocking. This is so that passive exploits can be blocked on from # blocking. This is so that passive exploits can be blocked on from

View File

@ -1859,7 +1859,7 @@ class Core
end end
if (mod.exploit? and mod.datastore['PAYLOAD']) if (mod.exploit? and mod.datastore['PAYLOAD'])
p = framework.modules.create(mod.datastore['PAYLOAD']) p = framework.payloads.create(mod.datastore['PAYLOAD'])
if (p) if (p)
p.options.sorted.each { |e| p.options.sorted.each { |e|
name, opt = e name, opt = e
@ -2389,7 +2389,7 @@ class Core
# How about the selected payload? # How about the selected payload?
if (mod.exploit? and mod.datastore['PAYLOAD']) if (mod.exploit? and mod.datastore['PAYLOAD'])
p = framework.modules.create(mod.datastore['PAYLOAD']) p = framework.payloads.create(mod.datastore['PAYLOAD'])
if (p and p.options.include?(opt)) if (p and p.options.include?(opt))
res.concat(option_values_dispatch(p.options[opt], str, words)) res.concat(option_values_dispatch(p.options[opt], str, words))
end end
@ -2623,7 +2623,7 @@ protected
# If it's an exploit and a payload is defined, create it and # If it's an exploit and a payload is defined, create it and
# display the payload's options # display the payload's options
if (mod.exploit? and mod.datastore['PAYLOAD']) if (mod.exploit? and mod.datastore['PAYLOAD'])
p = framework.modules.create(mod.datastore['PAYLOAD']) p = framework.payloads.create(mod.datastore['PAYLOAD'])
if (!p) if (!p)
print_error("Invalid payload defined: #{mod.datastore['PAYLOAD']}\n") print_error("Invalid payload defined: #{mod.datastore['PAYLOAD']}\n")
@ -2688,7 +2688,7 @@ protected
# If it's an exploit and a payload is defined, create it and # If it's an exploit and a payload is defined, create it and
# display the payload's options # display the payload's options
if (mod.exploit? and mod.datastore['PAYLOAD']) if (mod.exploit? and mod.datastore['PAYLOAD'])
p = framework.modules.create(mod.datastore['PAYLOAD']) p = framework.payloads.create(mod.datastore['PAYLOAD'])
if (!p) if (!p)
print_error("Invalid payload defined: #{mod.datastore['PAYLOAD']}\n") print_error("Invalid payload defined: #{mod.datastore['PAYLOAD']}\n")
@ -2711,7 +2711,7 @@ protected
# If it's an exploit and a payload is defined, create it and # If it's an exploit and a payload is defined, create it and
# display the payload's options # display the payload's options
if (mod.exploit? and mod.datastore['PAYLOAD']) if (mod.exploit? and mod.datastore['PAYLOAD'])
p = framework.modules.create(mod.datastore['PAYLOAD']) p = framework.payloads.create(mod.datastore['PAYLOAD'])
if (!p) if (!p)
print_error("Invalid payload defined: #{mod.datastore['PAYLOAD']}\n") print_error("Invalid payload defined: #{mod.datastore['PAYLOAD']}\n")

View File

@ -551,7 +551,7 @@ class Driver < Msf::Ui::Driver
case var.downcase case var.downcase
when "payload" when "payload"
if (framework and framework.modules.valid?(val) == false) if (framework and framework.payloads.valid?(val) == false)
return false return false
elsif (active_module) elsif (active_module)
active_module.datastore.clear_non_user_defined active_module.datastore.clear_non_user_defined