IPWorks SSH 2020 Python Edition

Questions / Feedback?

on_ssh_channel_request Event

Fired when the SSHHost sends a channel request to the client.

Syntax

class SSHDaemonSSHChannelRequestEventParams(object):
  @property
  def connection_id() -> int: ...
  @property
  def channel_id() -> int: ...
  @property
  def request_type() -> str: ...
  @property
  def packet() -> bytes: ...
  @property
  def success() -> bool: ...
  @success.setter
  def success(value) -> None: ...

# In class SSHDaemon:
@property
def on_ssh_channel_request() -> Callable[[SSHDaemonSSHChannelRequestEventParams], None]: ...
@on_ssh_channel_request.setter
def on_ssh_channel_request(event_hook: Callable[[SSHDaemonSSHChannelRequestEventParams], None]) -> None: ...

Remarks

The ssh_host may send requests that affect the status of a particular SSHChannel. Some requests will be automatically handled by the class. However, others may need the attention of the user to be dealt with properly within the scope of the application.

ConnectionId identifies the connection.

ChannelId identifies the channel receiving the request.

Type will contain the type of the request. These types are dependent upon the type of the channel. For example, a "session" channel executing a command on the remote shell may receive an "exit-status" request containing the return code of that command.

RequestData contains the remainder of the original SSH packet. If the request type has specific parameters, they can be parsed out of this data.

Success should be used to instruct the class to respond to the request with either a success or failure notification. If the request is successful, on_ssh_channel_requested will fire with the same information in case the request requires further processing.

Note: Processing long-running requests, including sending channel data, inside this event may cause the underlying transport to stop processing SSH data until the event returns. In order to prevent this from happening, all requests should be processed asynchronously in a separate thread outside of this event.

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 Python Edition - Version 20.0 [Build 8501]