Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`conch`.`endpoints`.`SSHCommandClientEndpoint``

class documentation

`class SSHCommandClientEndpoint: (source)`

Implements interfaces: `twisted.internet.interfaces.IStreamClientEndpoint`

View In Hierarchy

`SSHCommandClientEndpoint` exposes the command-executing functionality of SSH servers.

`SSHCommandClientEndpoint` can set up a new SSH connection, authenticate it in any one of a number of different ways (keys, passwords, agents), launch a command over that connection and then associate its input and output with a protocol.

It can also re-use an existing, already-authenticated SSH connection (perhaps one which already has some SSH channels being used for other purposes). In this case it creates a new SSH channel to use to execute the command. Notably this means it supports multiplexing several different command invocations over a single SSH connection.

Class Method | `existingConnection` | Create and return a new endpoint which will try to open a new channel on an existing SSH connection and run a command over it. It will not close the connection if there is a problem executing the command or after the command finishes.
Class Method | `newConnection` | Create and return a new endpoint which will try to create a new connection to an SSH server and run a command over it. It will also close the connection if there are problems leading up to the command being executed, after the command finishes, or if the connection ...
Method | `__init__` | No summary
Method | `connect` | Set up an SSH connection, use a channel from that connection to launch a command, and hook the stdin and stdout of that command up as a transport for a protocol created by the given factory.
Method | `_executeCommand` | Given a secured SSH connection, try to execute a command in a new channel created on it and associate the result with a protocol from the given factory.
Instance Variable | `_command` | Undocumented
Instance Variable | `_creator` | Undocumented

@classmethod
def existingConnection(cls, connection, command): (source)

Create and return a new endpoint which will try to open a new channel on an existing SSH connection and run a command over it. It will not close the connection if there is a problem executing the command or after the command finishes.

Parameters
connection:`SSHConnection` | An existing connection to an SSH server.
command:`bytes` | See `SSHCommandClientEndpoint.newConnection`'s `command` parameter.
Returns
A new instance of `cls` (probably `SSHCommandClientEndpoint`).

@classmethod
def newConnection(cls, reactor, command, username, hostname, port=None, keys=None, password=None, agentEndpoint=None, knownHosts=None, ui=None): (source)

Create and return a new endpoint which will try to create a new connection to an SSH server and run a command over it. It will also close the connection if there are problems leading up to the command being executed, after the command finishes, or if the connection `Deferred` is cancelled.

Parameters
reactor:`IReactorTCP` provider | The reactor to use to establish the connection.
command | See `__init__`'s `command` argument.
username:`bytes` | The username with which to authenticate to the SSH server.
hostname:`bytes` | The hostname of the SSH server.
port:`int` | The port number of the SSH server. By default, the standard SSH port number is used.
keys:`list` of `Key` | Private keys with which to authenticate to the SSH server, if key authentication is to be attempted (otherwise `None`).
password:`bytes` or `None` | The password with which to authenticate to the SSH server, if password authentication is to be attempted (otherwise `None`).
agentEndpoint:`IStreamClientEndpoint` provider | An `IStreamClientEndpoint` provider which may be used to connect to an SSH agent, if one is to be used to help with authentication.
knownHosts:`KnownHostsFile` | The currently known host keys, used to check the host key presented by the server we actually connect to.
ui:`None` or `ConsoleUI` | An object for interacting with users to make decisions about whether to accept the server host keys. If `None`, a `ConsoleUI` connected to /dev/tty will be used; if /dev/tty is unavailable, an object which answers `b"no"` to all prompts will be used.
Returns
A new instance of `cls` (probably `SSHCommandClientEndpoint`).

def __init__(self, creator, command): (source)

Parameters
creator:`_ISSHConnectionCreator` provider | An `_ISSHConnectionCreator` provider which will be used to set up the SSH connection which will be used to run a command.
command:`bytes` | The command line to execute on the SSH server. This byte string is interpreted by a shell on the SSH server, so it may have a value like `"ls /"`. Take care when trying to run a command like `"/Volumes/My Stuff/a-program"` - spaces (and other special bytes) may require escaping.

def connect(self, protocolFactory): (source)
from `twisted.internet.interfaces.IStreamClientEndpoint`

Set up an SSH connection, use a channel from that connection to launch a command, and hook the stdin and stdout of that command up as a transport for a protocol created by the given factory.

Parameters
protocolFactory | A `Factory` to use to create the protocol which will be connected to the stdin and stdout of the command on the SSH server.
Returns
A `Deferred` which will fire with an error if the connection cannot be set up for any reason or with the protocol instance created by `protocolFactory` once it has been connected to the command.

def _executeCommand(self, connection, protocolFactory): (source)

Given a secured SSH connection, try to execute a command in a new channel created on it and associate the result with a protocol from the given factory.

Parameters
connection | See `SSHCommandClientEndpoint.existingConnection`'s `connection` parameter.
protocolFactory | See `SSHCommandClientEndpoint.connect`'s `protocolFactory` parameter.
Returns
See `SSHCommandClientEndpoint.connect`'s return value.

_command = (source)

Undocumented

_creator = (source)

Undocumented