phpseclib API Documentation
Class

phpseclib\Net\SSH2

class SSH2

Pure-PHP implementation of SSHv2.

Constants

MASK_CONSTRUCTOR

MASK_CONNECTED

MASK_LOGIN_REQ

MASK_LOGIN

MASK_SHELL

MASK_WINDOW_ADJUST

CHANNEL_EXEC

CHANNEL_SHELL

CHANNEL_SUBSYSTEM

CHANNEL_AGENT_FORWARD

CHANNEL_KEEP_ALIVE

LOG_SIMPLE

Returns the message numbers

LOG_COMPLEX

Returns the message content

LOG_REALTIME

Outputs the content real-time

LOG_REALTIME_FILE

Dumps the content real-time to a file

LOG_MAX_SIZE

Make sure that the log never gets larger than this

READ_SIMPLE

Returns when a string matching $expect exactly is found

READ_REGEX

Returns when a string matching the regular expression $expect is found

READ_NEXT

Returns whenever a data packet is received.

Some data packets may only contain a single character so it may be necessary to call read() multiple times when using this option

Properties

string $identifier The SSH identifier
object $fsock The Socket Object
int $bitmap Execution Bitmap
string $errors Error information
array|false $server_identifier Server Identifier
array|false $kex_algorithms Key Exchange Algorithms
string|false $kex_algorithm Key Exchange Algorithm
int $kex_dh_group_size_min Minimum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
int $kex_dh_group_size_preferred Preferred Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
int $kex_dh_group_size_max Maximum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
array|false $server_host_key_algorithms Server Host Key Algorithms
array|false $encryption_algorithms_client_to_server Encryption Algorithms: Client to Server
array|false $encryption_algorithms_server_to_client Encryption Algorithms: Server to Client
array|false $mac_algorithms_client_to_server MAC Algorithms: Client to Server
array|false $mac_algorithms_server_to_client MAC Algorithms: Server to Client
array|false $compression_algorithms_client_to_server Compression Algorithms: Client to Server
array|false $compression_algorithms_server_to_client Compression Algorithms: Server to Client
array|false $languages_server_to_client Languages: Server to Client
array|false $languages_client_to_server Languages: Client to Server
array $preferred Preferred Algorithms
int $encrypt_block_size Block Size for Server to Client Encryption
int $decrypt_block_size Block Size for Client to Server Encryption
object $decrypt Server to Client Encryption Object
object $encrypt Client to Server Encryption Object
object $hmac_create Client to Server HMAC Object
object $hmac_check Server to Client HMAC Object
int $hmac_size Size of server to client HMAC
string $server_public_host_key Server Public Host Key
string $session_id Session identifier
string $exchange_hash Exchange hash
array $message_numbers Message Numbers
array $disconnect_reasons Disconnection Message 'reason codes' defined in RFC4253
array $channel_open_failure_reasons SSHMSGCHANNELOPENFAILURE 'reason codes', defined in RFC4254
array $terminal_modes Terminal Modes
array $channel_extended_data_type_codes SSHMSGCHANNELEXTENDEDDATA's datatypecodes
int $send_seq_no Send Sequence Number
int $get_seq_no Get Sequence Number
array $server_channels Server Channels
array $channel_buffers Channel Buffers
array $channel_status Channel Status
array $packet_size_client_to_server Packet Size
array $message_number_log Message Number Log
array $message_log Message Log
int $window_size The Window Size
int $window_resize What we resize the window to
array $window_size_server_to_client Window size, server to client
array $window_size_client_to_server Window size, client to server
string $signature Server signature
string $signature_format Server signature format
array $interactiveBuffer Interactive Buffer
int $log_size Current log size
$timeout Timeout
$curTimeout Current Timeout
resource $realtime_log_file Real-time log file pointer
int $realtime_log_size Real-time log file size
bool $signature_validated Has the signature been validated?
$realtime_log_wrap Real-time log file wrap boolean
$quiet_mode Flag to suppress stderr from output
int $last_packet Time of first network activity
int $exit_status Exit status returned from ssh if any
bool $request_pty Flag to request a PTY when using exec()
bool $in_request_pty_exec Flag set while exec() is running when using enablePTY()
bool $in_subsystem Flag set after startSubsystem() is called
string $stdErrorLog Contents of stdError
string $last_interactive_response The Last Interactive Response
array $keyboard_requests_responses Keyboard Interactive Request / Responses
string $banner_message Banner Message
bool $is_timeout Did read() timeout or return normally?
string $log_boundary Log Boundary
int $log_long_width Log Long Width
int $log_short_width Log Short Width
string $host Hostname
int $port Port Number
int $windowColumns Number of columns for terminal window size
int $windowRows Number of columns for terminal window size
int $crypto_engine Crypto Engine
System_SSH_Agent $agent A SystemSSHAgent for use in the SSH2 Agent Forwarding scenario
bool $send_id_string_first Send the identification string first?
bool $send_kex_first Send the key exchange initiation packet first?
bool $bad_key_size_fix Some versions of OpenSSH incorrectly calculate the key size
bool $retry_connect Should we try to re-connect to re-establish keys?
string|false $binary_packet_buffer Binary Packet Buffer
string|false $preferred_signature_format Preferred Signature Format
array $auth Authentication Credentials

Methods

SSH2 __construct(mixed $host, int $port = 22, int $timeout = 10)

Default Constructor.

setCryptoEngine(int $engine)

Set Crypto Engine Mode

sendIdentificationStringFirst()

Send Identification String First

sendIdentificationStringLast()

Send Identification String Last

sendKEXINITFirst()

Send SSHMSGKEXINIT First

sendKEXINITLast()

Send SSHMSGKEXINIT Last

bool _connect()

Connect to an SSHv2 server

string _generate_identifier()

Generates the SSH identifier

_key_exchange(string $kexinit_payload_server = false)

Key Exchange

int|null _encryption_algorithm_to_key_size(string $algorithm)

Maps an encryption algorithm name to the number of key bytes.

mixed _encryption_algorithm_to_crypt_instance(string $algorithm)

Maps an encryption algorithm name to an instance of a subclass of \phpseclib\Crypt\Base.

bool _bad_algorithm_candidate(string $algorithm)

Tests whether or not proposed algorithm has a potential for issues

bool login($username)

Login

bool _login($username)

Login Helper

bool _login_helper(string $username, string $password = null)

Login Helper

bool _keyboard_interactive_login(string $username, string $password)

Login via keyboard-interactive authentication

bool _keyboard_interactive_process()

Handle the keyboard-interactive requests / responses.

bool _ssh_agent_login(string $username, Agent $agent)

Login with an ssh-agent provided key

bool _privatekey_login($username, $privatekey)

Login with an RSA private key

setTimeout(mixed $timeout)

Set Timeout

getStdError()

Get the output from stdError

string exec(string $command, Callback $callback = null)

Execute Command

bool _initShell()

Creates an interactive shell

int _get_interactive_channel()

Return the channel to be used with read() / write()

int _get_open_channel()

Return an available open channel

string|bool read(string $expect = '', int $mode = self::READ_SIMPLE)

Returns the output of an interactive shell

bool write(string $cmd)

Inputs a command into an interactive shell.

bool startSubsystem(string $subsystem)

Start a subsystem.

bool stopSubsystem()

Stops a subsystem.

reset()

Closes a channel

isTimeout()

Is timeout?

disconnect()

Disconnect

__destruct()

Destructor.

bool isConnected()

Is the connection still active?

bool isAuthenticated()

Have you successfully been logged in?

bool ping()

Pings a server connection, or tries to reconnect if the connection has gone down

boolean _reconnect()

In situ reconnect method

_reset_connection(int $reason)

Resets a connection for re-use

string _get_binary_packet($skip_channel_filter = false)

Gets Binary Packets

string _filter($payload, $skip_channel_filter)

Filter Binary Packets

enableQuietMode()

Enable Quiet Mode

disableQuietMode()

Disable Quiet Mode

bool isQuietModeEnabled()

Returns whether Quiet Mode is enabled or not

enablePTY()

Enable request-pty when using exec()

disablePTY()

Disable request-pty when using exec()

bool isPTYEnabled()

Returns whether request-pty is enabled or not

mixed _get_channel_packet($client_channel, $skip_extended = false)

Gets channel data

bool _send_binary_packet(string $data, string $logged = null)

Sends Binary Packets

_append_log($message_number, $message)

Logs data packets

bool _send_channel_packet(int $client_channel, string $data)

Sends channel data

bool _close_channel(int $client_channel, bool $want_reply = false)

Closes and flushes a channel

bool _disconnect(int $reason)

Disconnect

string _string_shift(string $string, int $index = 1)

String Shift

_define_array()

Define Array

array|false|string getLog()

Returns a log of the packets that have been sent and received.

string _format_log(array $message_log, array $message_number_log)

Formats a log for printing

string _format_log_helper(array $matches)

Helper function for formatlog

_on_channel_open()

Helper function for agent->onchannel_open()

mixed _array_intersect_first(array $array1, array $array2)

Returns the first value of the intersection of two arrays or false if the intersection is empty.

string[] getErrors()

Returns all errors

string getLastError()

Returns the last error

string getServerIdentification()

Return the server identification.

array getKexAlgorithms()

Return a list of the key exchange algorithms the server supports.

array getServerHostKeyAlgorithms()

Return a list of the host key (public key) algorithms the server supports.

array getEncryptionAlgorithmsClient2Server()

Return a list of the (symmetric key) encryption algorithms the server supports, when receiving stuff from the client.

array getEncryptionAlgorithmsServer2Client()

Return a list of the (symmetric key) encryption algorithms the server supports, when sending stuff to the client.

array getMACAlgorithmsClient2Server()

Return a list of the MAC algorithms the server supports, when receiving stuff from the client.

array getMACAlgorithmsServer2Client()

Return a list of the MAC algorithms the server supports, when sending stuff to the client.

array getCompressionAlgorithmsClient2Server()

Return a list of the compression algorithms the server supports, when receiving stuff from the client.

array getCompressionAlgorithmsServer2Client()

Return a list of the compression algorithms the server supports, when sending stuff to the client.

array getLanguagesServer2Client()

Return a list of the languages the server supports, when sending stuff to the client.

array getLanguagesClient2Server()

Return a list of the languages the server supports, when receiving stuff from the client.

array getServerAlgorithms()

Returns a list of algorithms the server supports

array getSupportedKEXAlgorithms()

Returns a list of KEX algorithms that phpseclib supports

array getSupportedHostKeyAlgorithms()

Returns a list of host key algorithms that phpseclib supports

array getSupportedEncryptionAlgorithms()

Returns a list of symmetric key algorithms that phpseclib supports

array getSupportedMACAlgorithms()

Returns a list of MAC algorithms that phpseclib supports

array getSupportedCompressionAlgorithms()

Returns a list of compression algorithms that phpseclib supports

array getAlgorithmsNegotiated()

Return list of negotiated algorithms

setPreferredAlgorithms(array $methods)

Accepts an associative array with up to four parameters as described at https://www.php.net/manual/en/function.ssh2-connect.php

string getBannerMessage()

Returns the banner message.

mixed getServerPublicHostKey()

Returns the server public host key.

false|int getExitStatus()

Returns the exit status of an SSH command or false.

int getWindowColumns()

Returns the number of columns for the terminal window size.

int getWindowRows()

Returns the number of rows for the terminal window size.

setWindowColumns(int $value)

Sets the number of columns for the terminal window size.

setWindowRows(int $value)

Sets the number of rows for the terminal window size.

setWindowSize(int $columns = 80, int $rows = 24)

Sets the number of columns and rows for the terminal window size.

_updateLogHistory(string $old, string $new)

Update packet types in log history

Details

at line 977
public SSH2 __construct(mixed $host, int $port = 22, int $timeout = 10)

Default Constructor.

$host can either be a string, representing the host, or a stream resource.

Parameters

mixed $host
int $port
int $timeout

Return Value

SSH2

See also

self::login()

at line 1079
public setCryptoEngine(int $engine)

Set Crypto Engine Mode

Possible $engine values: CRYPTMODEINTERNAL, CRYPTMODEMCRYPT

Parameters

int $engine

at line 1093
public sendIdentificationStringFirst()

Send Identification String First

https://tools.ietf.org/html/rfc4253#section-4.2 says "when the connection has been established, both sides MUST send an identification string". It does not say which side sends it first. In theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy

at line 1107
public sendIdentificationStringLast()

Send Identification String Last

https://tools.ietf.org/html/rfc4253#section-4.2 says "when the connection has been established, both sides MUST send an identification string". It does not say which side sends it first. In theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy

at line 1121
public sendKEXINITFirst()

Send SSHMSGKEXINIT First

https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending sending the [SSHMSGKEXINIT] packet". It does not say which side sends it first. In theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy

at line 1135
public sendKEXINITLast()

Send SSHMSGKEXINIT Last

https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending sending the [SSHMSGKEXINIT] packet". It does not say which side sends it first. In theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy

at line 1146
public bool _connect()

Connect to an SSHv2 server

Return Value

bool

at line 1305
public string _generate_identifier()

Generates the SSH identifier

You should overwrite this method in your own class if you want to use another identifier

Return Value

string

at line 1339
public _key_exchange(string $kexinit_payload_server = false)

Key Exchange

Parameters

string $kexinit_payload_server optional

at line 2008
public int|null _encryption_algorithm_to_key_size(string $algorithm)

Maps an encryption algorithm name to the number of key bytes.

Parameters

string $algorithm Name of the encryption algorithm

Return Value

int|null Number of bytes as an integer or null for unknown

at line 2052
public mixed _encryption_algorithm_to_crypt_instance(string $algorithm)

Maps an encryption algorithm name to an instance of a subclass of \phpseclib\Crypt\Base.

Parameters

string $algorithm Name of the encryption algorithm

Return Value

mixed Instance of \phpseclib\Crypt\Base or null for unknown

at line 2097
public bool _bad_algorithm_candidate(string $algorithm)

Tests whether or not proposed algorithm has a potential for issues

Parameters

string $algorithm Name of the encryption algorithm

Return Value

bool

at line 2121
public bool login($username)

Login

The $password parameter can be a plaintext password, a \phpseclib\Crypt\RSA object or an array

Parameters

$username

Return Value

bool

See also

self::_login()

at line 2147
public bool _login($username)

Login Helper

Parameters

$username

Return Value

bool

See also

self::_login_helper()

at line 2178
public bool _login_helper(string $username, string $password = null)

Login Helper

Parameters

string $username
string $password

Return Value

bool

at line 2376
public bool _keyboard_interactive_login(string $username, string $password)

Login via keyboard-interactive authentication

See {@link http://tools.ietf.org/html/rfc4256 RFC4256} for details. This is not a full-featured keyboard-interactive authenticator.

Parameters

string $username
string $password

Return Value

bool

at line 2407
public bool _keyboard_interactive_process()

Handle the keyboard-interactive requests / responses.

Return Value

bool

at line 2531
public bool _ssh_agent_login(string $username, Agent $agent)

Login with an ssh-agent provided key

Parameters

string $username
Agent $agent

Return Value

bool

at line 2554
public bool _privatekey_login($username, $privatekey)

Login with an RSA private key

Parameters

$username
$privatekey

Return Value

bool

at line 2678
public setTimeout(mixed $timeout)

Set Timeout

$ssh->exec('ping 127.0.0.1'); on a Linux host will never return and will run indefinitely. setTimeout() makes it so it'll timeout. Setting $timeout to false or 0 will mean there is no timeout.

Parameters

mixed $timeout

at line 2688
public getStdError()

Get the output from stdError

at line 2704
public string exec(string $command, Callback $callback = null)

Execute Command

If $callback is set to false then \phpseclib\Net\SSH2::getchannelpacket(self::CHANNELEXEC) will need to be called manually. In all likelihood, this is not a feature you want to be taking advantage of.

Parameters

string $command
Callback $callback

Return Value

string

at line 2860
public bool _initShell()

Creates an interactive shell

Return Value

bool

See also

self::read()
self::write()

at line 2968
public int _get_interactive_channel()

Return the channel to be used with read() / write()

Return Value

int

See also

self::read()
self::write()

at line 2986
public int _get_open_channel()

Return an available open channel

Return Value

int

at line 3010
public string|bool read(string $expect = '', int $mode = self::READ_SIMPLE)

Returns the output of an interactive shell

Returns when there's a match for $expect, which can take the form of a string literal or, if $mode == self::READ_REGEX, a regular expression.

Parameters

string $expect
int $mode

Return Value

string|bool

See also

self::write()

at line 3059
public bool write(string $cmd)

Inputs a command into an interactive shell.

Parameters

string $cmd

Return Value

bool

See also

self::read()

at line 3088
public bool startSubsystem(string $subsystem)

Start a subsystem.

Right now only one subsystem at a time is supported. To support multiple subsystem's stopSubsystem() could accept a string that contained the name of the subsystem, but at that point, only one subsystem of each type could be opened. To support multiple subsystem's of the same name maybe it'd be best if startSubsystem() generated a new channel id and returns that and then that that was passed into stopSubsystem() but that'll be saved for a future date and implemented if there's sufficient demand for such a feature.

Parameters

string $subsystem

Return Value

bool

See also

self::stopSubsystem()

at line 3150
public bool stopSubsystem()

Stops a subsystem.

Return Value

bool

See also

self::startSubsystem()

at line 3164
public reset()

Closes a channel

If read() timed out you might want to just close the channel and have it auto-restart on the next read() call

at line 3176
public isTimeout()

Is timeout?

Did exec() or read() return because they timed out or because they encountered the end?

at line 3186
public disconnect()

Disconnect

at line 3202
public __destruct()

Destructor.

Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call disconnect().

at line 3213
public bool isConnected()

Is the connection still active?

Return Value

bool

at line 3224
public bool isAuthenticated()

Have you successfully been logged in?

Return Value

bool

at line 3237
public bool ping()

Pings a server connection, or tries to reconnect if the connection has gone down

Inspired by http://php.net/manual/en/mysqli.ping.php

Return Value

bool

at line 3279
public boolean _reconnect()

In situ reconnect method

Return Value

boolean

at line 3298
public _reset_connection(int $reason)

Resets a connection for re-use

Parameters

int $reason

at line 3319
public string _get_binary_packet($skip_channel_filter = false)

Gets Binary Packets

See '6. Binary Packet Protocol' of rfc4253 for more info.

Parameters

$skip_channel_filter

Return Value

string

See also

self::_send_binary_packet()

at line 3421
public string _filter($payload, $skip_channel_filter)

Filter Binary Packets

Because some binary packets need to be ignored...

Parameters

$payload
$skip_channel_filter

Return Value

string

See also

self::_get_binary_packet()

at line 3582
public enableQuietMode()

Enable Quiet Mode

Suppress stderr from output

at line 3594
public disableQuietMode()

Disable Quiet Mode

Show stderr in output

at line 3607
public bool isQuietModeEnabled()

Returns whether Quiet Mode is enabled or not

Return Value

bool

See also

self::enableQuietMode()
self::disableQuietMode()

at line 3617
public enablePTY()

Enable request-pty when using exec()

at line 3627
public disablePTY()

Disable request-pty when using exec()

at line 3644
public bool isPTYEnabled()

Returns whether request-pty is enabled or not

Return Value

bool

See also

self::enablePTY()
self::disablePTY()

at line 3658
public mixed _get_channel_packet($client_channel, $skip_extended = false)

Gets channel data

Returns the data as a string if it's available and false if not.

Parameters

$client_channel
$skip_extended

Return Value

mixed

at line 3930
public bool _send_binary_packet(string $data, string $logged = null)

Sends Binary Packets

See '6. Binary Packet Protocol' of rfc4253 for more info.

Parameters

string $data
string $logged

Return Value

bool

See also

self::_get_binary_packet()

at line 3988
public _append_log($message_number, $message)

Logs data packets

Makes sure that only the last 1MB worth of packets will be logged

Parameters

$message_number
$message

at line 4066
public bool _send_channel_packet(int $client_channel, string $data)

Sends channel data

Spans multiple SSHMSGCHANNEL_DATAs if appropriate

Parameters

int $client_channel
string $data

Return Value

bool

at line 4114
public bool _close_channel(int $client_channel, bool $want_reply = false)

Closes and flushes a channel

\phpseclib\Net\SSH2 doesn't properly close most channels. For exec() channels are normally closed by the server and for SFTP channels are presumably closed when the client disconnects. This functions is intended for SCP more than anything.

Parameters

int $client_channel
bool $want_reply

Return Value

bool

at line 4147
public bool _disconnect(int $reason)

Disconnect

Parameters

int $reason

Return Value

bool

at line 4172
public string _string_shift(string $string, int $index = 1)

String Shift

Inspired by array_shift

Parameters

string $string
int $index

Return Value

string

at line 4189
public _define_array()

Define Array

Takes any number of arrays whose indices are integers and whose values are strings and defines a bunch of named constants from it, using the value as the name of the constant and the index as the value of the constant. If any of the constants that would be defined already exists, none of the constants will be defined.

at line 4211
public array|false|string getLog()

Returns a log of the packets that have been sent and received.

Returns a string if NETSSH2LOGGING == self::LOGCOMPLEX, an array if NETSSH2LOGGING == self::LOGSIMPLE and false if !defined('NETSSH2LOGGING')

Return Value

array|false|string

at line 4236
public string _format_log(array $message_log, array $message_number_log)

Formats a log for printing

Parameters

array $message_log
array $message_number_log

Return Value

string

at line 4271
public string _format_log_helper(array $matches)

Helper function for formatlog

For use with pregreplacecallback()

Parameters

array $matches

Return Value

string

at line 4285
public _on_channel_open()

Helper function for agent->onchannel_open()

Used when channels are created to inform agent of said channel opening. Must be called after channel open confirmation received

at line 4301
public mixed _array_intersect_first(array $array1, array $array2)

Returns the first value of the intersection of two arrays or false if the intersection is empty.

The order is defined by the first parameter.

Parameters

array $array1
array $array2

Return Value

mixed False if intersection is empty, else intersected value.

at line 4317
public string[] getErrors()

Returns all errors

Return Value

string[]

at line 4328
public string getLastError()

Returns the last error

Return Value

string

at line 4343
public string getServerIdentification()

Return the server identification.

Return Value

string

at line 4356
public array getKexAlgorithms()

Return a list of the key exchange algorithms the server supports.

Return Value

array

at line 4369
public array getServerHostKeyAlgorithms()

Return a list of the host key (public key) algorithms the server supports.

Return Value

array

at line 4382
public array getEncryptionAlgorithmsClient2Server()

Return a list of the (symmetric key) encryption algorithms the server supports, when receiving stuff from the client.

Return Value

array

at line 4395
public array getEncryptionAlgorithmsServer2Client()

Return a list of the (symmetric key) encryption algorithms the server supports, when sending stuff to the client.

Return Value

array

at line 4408
public array getMACAlgorithmsClient2Server()

Return a list of the MAC algorithms the server supports, when receiving stuff from the client.

Return Value

array

at line 4421
public array getMACAlgorithmsServer2Client()

Return a list of the MAC algorithms the server supports, when sending stuff to the client.

Return Value

array

at line 4434
public array getCompressionAlgorithmsClient2Server()

Return a list of the compression algorithms the server supports, when receiving stuff from the client.

Return Value

array

at line 4447
public array getCompressionAlgorithmsServer2Client()

Return a list of the compression algorithms the server supports, when sending stuff to the client.

Return Value

array

at line 4460
public array getLanguagesServer2Client()

Return a list of the languages the server supports, when sending stuff to the client.

Return Value

array

at line 4473
public array getLanguagesClient2Server()

Return a list of the languages the server supports, when receiving stuff from the client.

Return Value

array

at line 4486
public array getServerAlgorithms()

Returns a list of algorithms the server supports

Return Value

array

at line 4514
public array getSupportedKEXAlgorithms()

Returns a list of KEX algorithms that phpseclib supports

Return Value

array

at line 4547
public array getSupportedHostKeyAlgorithms()

Returns a list of host key algorithms that phpseclib supports

Return Value

array

at line 4563
public array getSupportedEncryptionAlgorithms()

Returns a list of symmetric key algorithms that phpseclib supports

Return Value

array

at line 4638
public array getSupportedMACAlgorithms()

Returns a list of MAC algorithms that phpseclib supports

Return Value

array

at line 4658
public array getSupportedCompressionAlgorithms()

Returns a list of compression algorithms that phpseclib supports

Return Value

array

at line 4674
public array getAlgorithmsNegotiated()

Return list of negotiated algorithms

Uses the same format as https://www.php.net/ssh2-methods-negotiated

Return Value

array

at line 4701
public setPreferredAlgorithms(array $methods)

Accepts an associative array with up to four parameters as described at https://www.php.net/manual/en/function.ssh2-connect.php

Parameters

array $methods

at line 4789
public string getBannerMessage()

Returns the banner message.

Quoting from the RFC, "in some jurisdictions, sending a warning message before authentication may be relevant for getting legal protection."

Return Value

string

at line 4803
public mixed getServerPublicHostKey()

Returns the server public host key.

Caching this the first time you connect to a server and checking the result on subsequent connections is recommended. Returns false if the server signature is not signed correctly with the public host key.

Return Value

mixed

at line 5009
public false|int getExitStatus()

Returns the exit status of an SSH command or false.

Return Value

false|int

at line 5023
public int getWindowColumns()

Returns the number of columns for the terminal window size.

Return Value

int

at line 5034
public int getWindowRows()

Returns the number of rows for the terminal window size.

Return Value

int

at line 5045
public setWindowColumns(int $value)

Sets the number of columns for the terminal window size.

Parameters

int $value

at line 5056
public setWindowRows(int $value)

Sets the number of rows for the terminal window size.

Parameters

int $value

at line 5068
public setWindowSize(int $columns = 80, int $rows = 24)

Sets the number of columns and rows for the terminal window size.

Parameters

int $columns
int $rows

at line 5081
public _updateLogHistory(string $old, string $new)

Update packet types in log history

Parameters

string $old
string $new