Update stdin processing in resource scripting

Originally in #4674, I wanted to add stdin to msfconsole -r, but I
purposefully left off support for stdin in the console. Now it works.
bug/bundler_fix
William Vu 2017-07-12 13:32:26 -05:00
parent e43adf0223
commit 18c9ac7abb
1 changed files with 14 additions and 12 deletions

View File

@ -37,8 +37,8 @@ module Msf
def cmd_resource_help def cmd_resource_help
print_line "Usage: resource path1 [path2 ...]" print_line "Usage: resource path1 [path2 ...]"
print_line print_line
print_line "Run the commands stored in the supplied files. Resource files may also contain" print_line "Run the commands stored in the supplied files (- for stdin)."
print_line "ruby code between <ruby></ruby> tags." print_line "Resource files may also contain ERB or Ruby code between <ruby></ruby> tags."
print_line print_line
print_line "See also: makerc" print_line "See also: makerc"
print_line print_line
@ -52,7 +52,9 @@ module Msf
args.each do |res| args.each do |res|
good_res = nil good_res = nil
if ::File.exist?(res) if res == '-'
good_res = res
elsif ::File.exist?(res)
good_res = res good_res = res
elsif elsif
# let's check to see if it's in the scripts/resource dir (like when tab completed) # let's check to see if it's in the scripts/resource dir (like when tab completed)