lib/rex/post/meterpreter/ui/console/interactive_channel.rb in librex-0.0.68 vs lib/rex/post/meterpreter/ui/console/interactive_channel.rb in librex-0.0.70

- old
+ new

@@ -10,87 +10,87 @@ # manner that adds interactive capabilities. # ### module Console::InteractiveChannel - include Rex::Ui::Interactive + include Rex::Ui::Interactive - # - # Interacts with self. - # - def _interact - # If the channel has a left-side socket, then we can interact with it. - if (self.lsock) - self.interactive(true) + # + # Interacts with self. + # + def _interact + # If the channel has a left-side socket, then we can interact with it. + if (self.lsock) + self.interactive(true) - interact_stream(self) + interact_stream(self) - self.interactive(false) - else - print_error("Channel #{self.cid} does not support interaction.") + self.interactive(false) + else + print_error("Channel #{self.cid} does not support interaction.") - self.interacting = false - end - end + self.interacting = false + end + end - # - # Called when an interrupt is sent. - # - def _interrupt - prompt_yesno("Terminate channel #{self.cid}?") - end + # + # Called when an interrupt is sent. + # + def _interrupt + prompt_yesno("Terminate channel #{self.cid}?") + end - # - # Suspends interaction with the channel. - # - def _suspend - # Ask the user if they would like to background the session - if (prompt_yesno("Background channel #{self.cid}?") == true) - self.interactive(false) + # + # Suspends interaction with the channel. + # + def _suspend + # Ask the user if they would like to background the session + if (prompt_yesno("Background channel #{self.cid}?") == true) + self.interactive(false) - self.interacting = false - end - end + self.interacting = false + end + end - # - # Closes the channel like it aint no thang. - # - def _interact_complete - begin - self.interactive(false) + # + # Closes the channel like it aint no thang. + # + def _interact_complete + begin + self.interactive(false) - self.close - rescue IOError - end - end + self.close + rescue IOError + end + end - # - # Reads data from local input and writes it remotely. - # - def _stream_read_local_write_remote(channel) - data = user_input.gets - return if not data + # + # Reads data from local input and writes it remotely. + # + def _stream_read_local_write_remote(channel) + data = user_input.gets + return if not data - self.on_command_proc.call(data.strip) if self.on_command_proc - self.write(data) - end + self.on_command_proc.call(data.strip) if self.on_command_proc + self.write(data) + end - # - # Reads from the channel and writes locally. - # - def _stream_read_remote_write_local(channel) - data = self.lsock.sysread(16384) + # + # Reads from the channel and writes locally. + # + def _stream_read_remote_write_local(channel) + data = self.lsock.sysread(16384) - self.on_print_proc.call(data.strip) if self.on_print_proc - user_output.print(data) - end + self.on_print_proc.call(data.strip) if self.on_print_proc + user_output.print(data) + end - # - # Returns the remote file descriptor to select on - # - def _remote_fd(stream) - self.lsock - end + # + # Returns the remote file descriptor to select on + # + def _remote_fd(stream) + self.lsock + end end end end