Land #4674, @wvu-r7 teaches msfconsole to read stdin as -
commit
cf891efc14
|
@ -33,7 +33,7 @@ _arguments \
|
|||
{-o,--output}"[Output to the specified file]:output file" \
|
||||
{-p,--plugin}"[Load a plugin on startup]:plugin file:_files" \
|
||||
{-q,--quiet}"[Do not print the banner on start up]" \
|
||||
{-r,--resource}"[Execute the specified resource file]:resource file:_files" \
|
||||
{-r,--resource}"[Execute the specified resource file (- for stdin)]:resource file:_files" \
|
||||
{-v,--version}"[Show version]" \
|
||||
{-x,--execute-command}"[Execute the specified string as console commands]:commands" \
|
||||
{-y,--yaml}"[Specify a YAML file containing database settings]:yaml file:_files"
|
||||
|
|
|
@ -60,7 +60,7 @@ class Metasploit::Framework::ParsedOptions::Console < Metasploit::Framework::Par
|
|||
options.console.quiet = true
|
||||
end
|
||||
|
||||
option_parser.on('-r', '--resource FILE', 'Execute the specified resource file') do |file|
|
||||
option_parser.on('-r', '--resource FILE', 'Execute the specified resource file (- for stdin)') do |file|
|
||||
options.console.resources << file
|
||||
end
|
||||
|
||||
|
|
|
@ -417,8 +417,14 @@ class Driver < Msf::Ui::Driver
|
|||
# @param path [String] Path to a resource file to run
|
||||
# @return [void]
|
||||
def load_resource(path)
|
||||
return if not ::File.readable?(path)
|
||||
resource_file = ::File.read(path)
|
||||
if path == '-'
|
||||
resource_file = $stdin.read
|
||||
path = 'stdin'
|
||||
elsif ::File.readable?(path)
|
||||
resource_file = ::File.read(path)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
self.active_resource = resource_file
|
||||
|
||||
|
|
Loading…
Reference in New Issue