Implement resource scripting for command shells

GSoC/Meterpreter_Web_Console
William Vu 2019-01-17 13:39:03 -06:00
parent b412bb3136
commit a5a8c88a6e
2 changed files with 13 additions and 12 deletions

View File

@ -34,13 +34,14 @@ class CommandShell
##
# :category: Msf::Session::Scriptable implementors
#
# Executes the supplied script, must be specified as full path.
#
# Msf::Session::Scriptable implementor
# Runs the shell session script or resource file.
#
def execute_file(full_path, args)
o = Rex::Script::Shell.new(self, full_path)
o.run(args)
if File.extname(full_path) == '.rb'
Rex::Script::Shell.new(self, full_path).run(args)
else
load_resource(full_path)
end
end
#
@ -486,7 +487,7 @@ class CommandShell
end
# User input is not a built-in command, write to socket directly
shell_write(cmd)
shell_write(cmd + "\n")
end
#

View File

@ -308,11 +308,11 @@ class Meterpreter < Rex::Post::Meterpreter::Client
##
# :category: Msf::Session::Scriptable implementors
#
# Runs the Meterpreter script or resource file
# Runs the Meterpreter script or resource file.
#
def execute_file(full_path, args)
# Infer a Meterpreter script by it having an .rb extension
if File.extname(full_path) == ".rb"
# Infer a Meterpreter script by .rb extension
if File.extname(full_path) == '.rb'
Rex::Script::Meterpreter.new(self, full_path).run(args)
else
console.load_resource(full_path)