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
parent
e43adf0223
commit
18c9ac7abb
|
@ -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,21 +52,23 @@ 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)
|
||||||
[
|
[
|
||||||
::Msf::Config.script_directory + ::File::SEPARATOR + "resource",
|
::Msf::Config.script_directory + ::File::SEPARATOR + "resource",
|
||||||
::Msf::Config.user_script_directory + ::File::SEPARATOR + "resource"
|
::Msf::Config.user_script_directory + ::File::SEPARATOR + "resource"
|
||||||
].each do |dir|
|
].each do |dir|
|
||||||
res_path = dir + ::File::SEPARATOR + res
|
res_path = dir + ::File::SEPARATOR + res
|
||||||
if ::File.exist?(res_path)
|
if ::File.exist?(res_path)
|
||||||
good_res = res_path
|
good_res = res_path
|
||||||
break
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if good_res
|
if good_res
|
||||||
driver.load_resource(good_res)
|
driver.load_resource(good_res)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue