GetSSHParam Method
Used to read a field from an SSH packet's payload.
Syntax
char* GetSSHParam(char* lpPayload, INT lenPayload, char* lpszField);
Remarks
This method is used to read the value of a particular field from an SSH packet's payload. Payload should contain the full payload of a packet received by an event such as SSHChannelRequest. Field is the name of a field to be read out of the packet.
The following is a list of the names of well-known channel request field names and their encodings:
ChannelId (int32) | The id of the channel that received the packet. |
RequestType (string) | The type of channel request. |
WantsReply (boolean) | Whether or not the client wants a reply to the request. |
The remaining fields that are available in the payload are dependent upon the value of RequestType.
pty-req
Pty-req is a request to open a pseudo terminal on the specified channel. The following fields are available:
TerminalType (string) | The type of terminal being requested (eg: "vt100"). |
TerminalWidthCharacters (int32) | The width, in characters, of the terminal to be opened. |
TerminalHeightRows (int32) | The height, in rows, of the terminal to be opened. |
TerminalWidthPixels (int32) | The width, in pixels, of the terminal to be opened. |
TerminalHeightPixels (int32) | The height, in pixels, of the terminal to be opened. |
TerminalModes (string) | A list of op-val (int32-byte) encoded modes to be used by the terminal. |
x11-req
X11-req is a request to forward x11 sessions over a channel. The following fields are available:
SingleConnection (boolean) | Disallows more than one connection to be forwarded by the channel. |
X11AuthProtocol (string) | The authentication protocol to be used (eg: "MIT-MAGIC-COOKIE-1"). |
X11AuthCookie (string) | A hexadecimal-encoded cookie to be used for authentication. |
X11ScreenNumber (int32) | The x11 screen number to be used. |
env
Env is a request to set an environment variable to be passed into a shell that may be started later. The following fields are available:
VariableName (string) | The name of the variable to be set. |
VariableValue (string) | The value of the variable to be set. |
exec
Exec is a request to execute a command on the channel using the authenticated user's shell. The following field is available:
Command (string) | The command to be executed. |
subsystem
Subsystem is a request to start a subsystem on the specified channel. The following field is available:
Subsystem (string) | The name of the subsystem to be started (eg: "sftp"). |
xon-xoff
Instructs the server to allow or disallow control-S/control-Q style flow control. The following field is available:
ClientCanDo (boolean) | Whether or not the server should enable flow control. |
signal
Sends a signal to the remote process/service. The following field is available:
SignalName (string) | The name of the signal to be sent. |
If the packet type is not well known, Field should start with the special character "%" and contain a comma-separated list of field types as defined in SetSSHParam. For example, reading out the X11AuthProtocol of an x11-req payload, you can use "%s,f".
Note: the return value is a string encoded the same way as the FieldValue param in SetSSHParam.
Note: This method is only applicable for reading and creating SSH packets for use within the SSHCustomAuth event.