Add validation for resizable interactive shells
This commit is contained in:
parent
0edfe45003
commit
3b74021e19
|
@ -395,7 +395,16 @@ class Console::CommandDispatcher::Stdapi::Sys
|
||||||
#
|
#
|
||||||
def pty_shell(sh_path, raw: false)
|
def pty_shell(sh_path, raw: false)
|
||||||
args = ['-p']
|
args = ['-p']
|
||||||
|
|
||||||
|
if raw
|
||||||
args << '-r' 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'
|
sh_path = client.fs.file.exist?(sh_path) ? sh_path : '/bin/sh'
|
||||||
|
|
||||||
# Python Meterpreter calls pty.openpty() - No need for other methods
|
# Python Meterpreter calls pty.openpty() - No need for other methods
|
||||||
|
|
|
@ -111,6 +111,7 @@ module Console::InteractiveChannel
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_term_size
|
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
|
rows, cols = ::IO.console.winsize
|
||||||
unless rows == self.rows && cols == self.cols
|
unless rows == self.rows && cols == self.cols
|
||||||
set_term_size(rows, cols)
|
set_term_size(rows, cols)
|
||||||
|
|
Loading…
Reference in New Issue