Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/base/sessions/command_shell_unix.rb
Views: 11623
module Msf::Sessions12class CommandShellUnix < CommandShell3def initialize(*args)4self.platform = "unix"5super6end78def shell_command_token(cmd,timeout = 10)9shell_command_token_unix(cmd,timeout)10end1112# Convert the executable and argument array to a command that can be run in this command shell13# @param cmd_and_args [Array<String>] The process path and the arguments to the process14def to_cmd(cmd_and_args)15self.class.to_cmd(cmd_and_args)16end1718# Escape an individual argument per Unix shell rules19# @param arg [String] Shell argument20def escape_arg(arg)21self.class.escape_arg(arg)22end2324# Convert the executable and argument array to a command that can be run in this command shell25# @param cmd_and_args [Array<String>] The process path and the arguments to the process26def self.to_cmd(cmd_and_args)27escaped = cmd_and_args.map do |arg|28escape_arg(arg)29end3031escaped.join(' ')32end3334# Escape an individual argument per Unix shell rules35# @param arg [String] Shell argument36def self.escape_arg(arg)37quote_requiring = ['\\', '`', '(', ')', '<', '>', '&', '|', ' ', '@', '"', '$', ';']38result = CommandShell._glue_cmdline_escape(arg, quote_requiring, "'", "\\'", "'")39if result == ''40result = "''"41end4243result44end45end4647end484950