Exemple #1
0
    def close_session(self, channel: paramiko.Channel) -> None:
        # pylint: disable=protected-access
        if channel.closed:
            return

        if not channel.eof_received:
            message = Message()
            message.add_byte(cMSG_CHANNEL_EOF)
            message.add_int(channel.remote_chanid)
            channel.transport._send_user_message(message)  # type: ignore

            message = Message()
            message.add_byte(cMSG_CHANNEL_REQUEST)
            message.add_int(channel.remote_chanid)
            message.add_string('*****@*****.**')
            message.add_boolean(False)
            channel.transport._send_user_message(message)  # type: ignore

        message = Message()
        message.add_byte(cMSG_CHANNEL_CLOSE)
        message.add_int(channel.remote_chanid)
        channel.transport._send_user_message(message)  # type: ignore

        channel._unlink()  # type: ignore

        super(SCPBaseForwarder, self).close_session(channel)
        logging.debug("[chan %d] SCP closed", channel.get_id())
Exemple #2
0
 def check_channel_exec_request(self, channel: paramiko.Channel,
                                command: bytes) -> bool:
     self.command_queues.setdefault(channel.get_id(), Queue()).put(command)
     return True