Update chmod_x_file to chmod

GSoC/Meterpreter_Web_Console
William Vu 2018-09-24 12:37:15 -05:00
parent 896dd13bbe
commit 5444d7a1a5
1 changed files with 11 additions and 6 deletions

View File

@ -362,14 +362,19 @@ module Msf::Post::File
end
#
# Sets the executable permissions on a remote file
# Sets the permissions on a remote file
#
# @param remote [String] Destination file name on the remote filesystem
def chmod_x_file(remote)
if session.type == "meterpreter" && session.commands.include?('stdapi_fs_chmod')
session.fs.file.chmod(remote, 0700)
# @param path [String] Path on the remote filesystem
# @param mode [Fixnum] Mode as an octal number
def chmod(path, mode = 0700)
if session.platform == 'windows'
raise "`chmod_x_file?' method does not support Windows systems"
end
if session.type == 'meterpreter' && session.commands.include?('stdapi_fs_chmod')
session.fs.file.chmod(path, mode)
else
cmd_exec("chmod 700 \"#{remote}\"")
cmd_exec("chmod #{mode.to_s(8)} '#{path}'")
end
end