Land #15889, Add validation for resizeable interactive shells
This commit is contained in:
commit
7b06ee9701
|
@ -395,7 +395,16 @@ class Console::CommandDispatcher::Stdapi::Sys
|
|||
#
|
||||
def pty_shell(sh_path, raw: false)
|
||||
args = ['-p']
|
||||
args << '-r' if raw
|
||||
|
||||
if raw
|
||||
args << '-r' if raw
|
||||
if client.commands.include?(Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_SET_TERM_SIZE)
|
||||
print_line("Terminal size will be synced automatically.")
|
||||
else
|
||||
print_line("You may want to set the correct terminal size manually.")
|
||||
print_line("Example: `stty rows {rows} cols {columns}`")
|
||||
end
|
||||
end
|
||||
sh_path = client.fs.file.exist?(sh_path) ? sh_path : '/bin/sh'
|
||||
|
||||
# Python Meterpreter calls pty.openpty() - No need for other methods
|
||||
|
|
|
@ -111,6 +111,7 @@ module Console::InteractiveChannel
|
|||
end
|
||||
|
||||
def update_term_size
|
||||
return unless self.client.commands.include?(Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_SET_TERM_SIZE)
|
||||
rows, cols = ::IO.console.winsize
|
||||
unless rows == self.rows && cols == self.cols
|
||||
set_term_size(rows, cols)
|
||||
|
|
Loading…
Reference in New Issue