Update Net::SSH::CommandStream exception handling

GSoC/Meterpreter_Web_Console
William Vu 2018-10-18 22:38:10 -05:00
parent 390e0e86f7
commit cf00f20e11
1 changed files with 7 additions and 3 deletions

View File

@ -16,7 +16,10 @@ class CommandStream
end
def shell_requested(channel, success)
raise "could not request ssh shell" unless success
unless success
raise Net::SSH::ChannelRequestFailed, 'shell/exec channel request failed'
end
channel[:data] = ''
channel.on_eof do
@ -57,7 +60,7 @@ class CommandStream
# A PTY will write us to {u,w}tmp and lastlog
rch.request_pty if rpty
if rcmd.nil?
rch.send_channel_request("shell", &method(:shell_requested))
rch.send_channel_request('shell', &method(:shell_requested))
else
rch.exec(rcmd, &method(:shell_requested))
end
@ -78,6 +81,7 @@ class CommandStream
end
rescue ::Exception => e
# XXX: This won't be set UNTIL there's a failure from a thread
self.error = e
#::Kernel.warn "BOO: #{e.inspect}"
#::Kernel.warn e.backtrace.join("\n")