Skip to content

Commit 25d8f8c

Browse files
committed
Call #validate in run_simple like it is in call_simple
1 parent c9421a6 commit 25d8f8c

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

lib/msf/base/simple/auxiliary.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ def self.run_simple(omod, opts = {}, job_listener: Msf::Simple::NoopJobListener.
5858
raise MissingActionError, "Please use: #{mod.actions.collect {|e| e.name} * ", "}"
5959
end
6060

61-
# Verify the options
62-
mod.options.validate(mod.datastore)
61+
# Validate the option container state so that options will
62+
# be normalized
63+
mod.validate
6364

6465
# Initialize user interaction
6566
if ! opts['Quiet']

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ def cmd_run(*args, action: nil, opts: {})
6060
rhosts = mod_with_opts.datastore['RHOSTS']
6161
rhosts_walker = Msf::RhostsWalker.new(rhosts, mod_with_opts.datastore)
6262

63-
begin
64-
mod_with_opts.validate
65-
rescue ::Msf::OptionValidateError => e
66-
::Msf::Ui::Formatter::OptionValidateError.print_error(mod_with_opts, e)
67-
return false
68-
end
69-
7063
begin
7164
# Check if this is a scanner module or doesn't target remote hosts
7265
if rhosts.blank? || mod.class.included_modules.include?(Msf::Auxiliary::Scanner)
@@ -102,7 +95,8 @@ def cmd_run(*args, action: nil, opts: {})
10295
rescue ::Interrupt
10396
print_error("Auxiliary interrupted by the console user")
10497
rescue ::Msf::OptionValidateError => e
105-
::Msf::Ui::Formatter::OptionValidateError.print_error(running_mod, e)
98+
::Msf::Ui::Formatter::OptionValidateError.print_error(mod_with_opts, e)
99+
return false
106100
rescue ::Exception => e
107101
print_error("Auxiliary failed: #{e.class} #{e}")
108102
if(e.class.to_s != 'Msf::OptionValidateError')

0 commit comments

Comments
 (0)