adds -s <string> Execute the specified string as console commands to msfconsole
for convenience when you don't need/want a full resource file, you just want to run something quick example usage: # say you have a saved config ready to go on load ./msfconsole -s 'exploit -j' # you can run multiple commands too ./msfconsole -s 'set ConsoleLogging true\nshow options'unstable
parent
c19e9a8053
commit
56d5c13755
|
@ -249,6 +249,13 @@ class Driver < Msf::Ui::Driver
|
|||
# If the opt is nil here, we load ~/.msf3/msfconsole.rc
|
||||
load_resource(opts['Resource'])
|
||||
end
|
||||
|
||||
# Process any additional startup commands
|
||||
if opts['SCommands'] and opts['SCommands'].kind_of? Array
|
||||
opts['SCommands'].each { |c|
|
||||
run_single(c)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -101,6 +101,11 @@ class OptsConsole
|
|||
options['DisableBanner'] = true
|
||||
end
|
||||
|
||||
opts.on("-s", "-s <string>", "Execute the specified string as console commands") do |s|
|
||||
options['SCommands'] ||= []
|
||||
options['SCommands'] += s.split('\n')
|
||||
end
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Common options:"
|
||||
|
||||
|
|
Loading…
Reference in New Issue