Esempio n. 1
0
    def __init__(self, log, command, *args, **kwargs):
        self.log = log
        self.command = command
        self.finished = Deferred()
        self.result = StringIO.StringIO()
        self.reason = None

        SSHChannel.__init__(self, *args, **kwargs)
Esempio n. 2
0
    def __init__(self, command, **k):
        SSHChannel.__init__(self, **k)

        self._logger = logging.getLogger(self.__class__.__name__)

        self._databytes = ''
        self._extbytes = ''
        self.command = command
        self.reason = None
Esempio n. 3
0
    def loseConnection(self):
        """ Overridden to fix possible bug.

        Described here : http://twistedmatrix.com/trac/ticket/2754

        """
        close_old_connections()
        if self.client and self.client.transport:
            self.client.transport.loseConnection()
        SSHChannel.loseConnection(self)
Esempio n. 4
0
    def __init__(self, log, command, timeout, *args, **kwargs):
        """
        :param timeout: command timeout in seconds.  0 for no timeout
        """
        self.log = log
        self.command = command
        self.finished = Deferred()
        self.result = StringIO.StringIO()
        self.reason = None
        self.timeout = timeout

        SSHChannel.__init__(self, *args, **kwargs)
Esempio n. 5
0
    def __init__(self, log, command, timeout, *args, **kwargs):
        """
        :param timeout: command timeout in seconds.  0 for no timeout
        """
        self.log = log
        self.command = command
        self.finished = Deferred()
        self.result = StringIO.StringIO()
        self.reason = None
        self.timeout = timeout

        SSHChannel.__init__(self, *args, **kwargs)
Esempio n. 6
0
 def __init__(self, creator, command, protocolFactory, commandConnected, incremental,
         with_errors, prompt_pattern, timeout, command_interval):
     SSHChannel.__init__(self)
     self._creator = creator
     self._protocolFactory = protocolFactory
     self._command = command
     self._commandConnected = commandConnected
     self.incremental = incremental
     self.with_errors = with_errors
     self.prompt = prompt_pattern
     self.timeout = timeout
     self.command_interval = command_interval
     self._reason = None
Esempio n. 7
0
 def __init__(self, creator, command, protocolFactory, commandConnected,
              incremental, with_errors, prompt_pattern, timeout,
              command_interval):
     SSHChannel.__init__(self)
     self._creator = creator
     self._protocolFactory = protocolFactory
     self._command = command
     self._commandConnected = commandConnected
     self.incremental = incremental
     self.with_errors = with_errors
     self.prompt = prompt_pattern
     self.timeout = timeout
     self.command_interval = command_interval
     self._reason = None
Esempio n. 8
0
    def __init__(self, creator, protocolFactory, shellConnected):
        """
        @param creator: The L{ICowrieSSHConnectionCreator} provider which was used
            to get the connection which this channel exists on.
        @type creator: L{ICowrieSSHConnectionCreator} provider

        @param protocolFactory: A client factory to use to build a L{IProtocol}
            provider to use to associate with the shell

        @param shellConnected: A L{Deferred} to use to signal that opening the
            shell has failed or that it has succeeded and the shell is open.
        @type shellConnected: L{Deferred}
        """
        SSHChannel.__init__(self)
        self._creator = creator
        self._protocolFactory = protocolFactory
        self._shellConnected = shellConnected
        self._reason = None
Esempio n. 9
0
    def __init__(self, creator, protocolFactory, shellConnected):
        """
        @param creator: The L{ICowrieSSHConnectionCreator} provider which was used
            to get the connection which this channel exists on.
        @type creator: L{ICowrieSSHConnectionCreator} provider

        @param protocolFactory: A client factory to use to build a L{IProtocol}
            provider to use to associate with the shell

        @param shellConnected: A L{Deferred} to use to signal that opening the
            shell has failed or that it has succeeded and the shell is open.
        @type shellConnected: L{Deferred}
        """
        SSHChannel.__init__(self)
        self._creator = creator
        self._protocolFactory = protocolFactory
        self._shellConnected = shellConnected
        self._reason = None
Esempio n. 10
0
    def __init__(self, creator, command, protocolFactory, commandConnected):
        """
        @param creator: The L{_ISSHConnectionCreator} provider which was used
            to get the connection which this channel exists on.
        @type creator: L{_ISSHConnectionCreator} provider

        @param command: The command to be executed.
        @type command: L{bytes}

        @param protocolFactory: A client factory to use to build a L{IProtocol}
            provider to use to associate with the running command.

        @param commandConnected: A L{Deferred} to use to signal that execution
            of the command has failed or that it has succeeded and the command
            is now running.
        @type commandConnected: L{Deferred}
        """
        SSHChannel.__init__(self)
        self._creator = creator
        self._command = command
        self._protocolFactory = protocolFactory
        self._commandConnected = commandConnected
        self._reason = None
Esempio n. 11
0
    def __init__(self, creator, command, protocolFactory, commandConnected):
        """
        @param creator: The L{_ISSHConnectionCreator} provider which was used
            to get the connection which this channel exists on.
        @type creator: L{_ISSHConnectionCreator} provider

        @param command: The command to be executed.
        @type command: L{bytes}

        @param protocolFactory: A client factory to use to build a L{IProtocol}
            provider to use to associate with the running command.

        @param commandConnected: A L{Deferred} to use to signal that execution
            of the command has failed or that it has succeeded and the command
            is now running.
        @type commandConnected: L{Deferred}
        """
        SSHChannel.__init__(self)
        self._creator = creator
        self._command = command
        self._protocolFactory = protocolFactory
        self._commandConnected = commandConnected
        self._reason = None
Esempio n. 12
0
 def __init__(self, env, usePTY, *args, **kwargs):
     SSHChannel.__init__(self, *args, **kwargs)
     self.env = env
     self.usePTY = usePTY
Esempio n. 13
0
 def __init__(self, command, protocol):
     SSHChannel.__init__(self)
     if isinstance(command, unicode):
         command = command.encode('utf-8')
     self._command = command
     self._protocol = protocol
Esempio n. 14
0
 def __init__(self, command, protocolFactory, commandConnected):
     SSHChannel.__init__(self)
     self._command = command
     self._protocolFactory = protocolFactory
     self._commandConnected = commandConnected
Esempio n. 15
0
 def __init__(self, command, protocol):
     SSHChannel.__init__(self)
     if isinstance(command, unicode):
         command = command.encode('utf-8')
     self._command = command
     self._protocol = protocol
Esempio n. 16
0
 def __init__(self, command, **k):
     SSHChannel.__init__(self, **k)
     self._databytes = ''
     self._extbytes = ''
     self.command = command
     self.reason = None
Esempio n. 17
0
 def __init__(self, command, env={}, **k):
     SSHChannel.__init__(self, **k)
     self.command = command
     self.env = env
     self.reason = None
Esempio n. 18
0
 def extReceived(self, type, data):
     if type == EXTENDED_DATA_STDERR:
         self._protocol.errReceived(data)
     else:
         SSHChannel.extReceived(self, type, data)
Esempio n. 19
0
 def __init__(self, command, **k):
     SSHChannel.__init__(self, **k)
     self.command = command
     self.reason = None
Esempio n. 20
0
 def closed(self):
     SSHChannel.closed(self)
     self._protocol.connectionLost(Failure(ConnectionDone("ssh channel closed")))
     # must close the transport otherwise connections stay open. \o/
     # this wasn't in the example conch code, lsof -p to the rescue.
     self.conn.transport.loseConnection()
Esempio n. 21
0
 def __init__(self, env, usePTY, *args, **kwargs):
     SSHChannel.__init__(self, *args, **kwargs)
     self.env = env
     self.usePTY = usePTY
Esempio n. 22
0
    def __init__(self, *args, **kwargs):
        SSHChannel.__init__(self, *args, **kwargs)

        self.proxy = Proxy()
        attach_protocol_to_channel(self.proxy, self)
Esempio n. 23
0
 def extReceived(self, type, data):
     if type == EXTENDED_DATA_STDERR:
         self._protocol.errReceived(data)
     else:
         SSHChannel.extReceived(self, type, data)
Esempio n. 24
0
 def __init__(self, command, protocolFactory, commandConnected):
     SSHChannel.__init__(self)
     self._command = command
     self._protocolFactory = protocolFactory
     self._commandConnected = commandConnected
Esempio n. 25
0
    def __init__(self, *args, **kwargs):
        SSHChannel.__init__(self, *args, **kwargs)

        self.proxy = Proxy()
        attach_protocol_to_channel(self.proxy, self)