\phpseclib\NetSSH2

Pure-PHP implementation of SSHv2.

Summary

Methods
Properties
Constants
__construct()
setCryptoEngine()
sendIdentificationStringFirst()
sendIdentificationStringLast()
sendKEXINITFirst()
sendKEXINITLast()
_connect()
_generate_identifier()
_key_exchange()
_encryption_algorithm_to_key_size()
_encryption_algorithm_to_crypt_instance()
_bad_algorithm_candidate()
login()
_login()
_keyboard_interactive_login()
_keyboard_interactive_process()
_ssh_agent_login()
setTimeout()
getStdError()
exec()
_initShell()
_get_interactive_channel()
_get_open_channel()
read()
write()
startSubsystem()
stopSubsystem()
reset()
isTimeout()
disconnect()
__destruct()
isConnected()
isAuthenticated()
ping()
_reconnect()
_reset_connection()
_get_binary_packet()
_filter()
enableQuietMode()
disableQuietMode()
isQuietModeEnabled()
enablePTY()
disablePTY()
isPTYEnabled()
_get_channel_packet()
_send_binary_packet()
_append_log()
_send_channel_packet()
_close_channel()
_disconnect()
_string_shift()
_define_array()
getLog()
_format_log()
_format_log_helper()
_on_channel_open()
_array_intersect_first()
getErrors()
getLastError()
getServerIdentification()
getKexAlgorithms()
getServerHostKeyAlgorithms()
getEncryptionAlgorithmsClient2Server()
getEncryptionAlgorithmsServer2Client()
getMACAlgorithmsClient2Server()
getMACAlgorithmsServer2Client()
getCompressionAlgorithmsClient2Server()
getCompressionAlgorithmsServer2Client()
getLanguagesServer2Client()
getLanguagesClient2Server()
getBannerMessage()
getServerPublicHostKey()
getExitStatus()
getWindowColumns()
getWindowRows()
setWindowColumns()
setWindowRows()
setWindowSize()
$identifier
$fsock
$bitmap
$errors
$server_identifier
$kex_algorithms
$kex_dh_group_size_min
$kex_dh_group_size_preferred
$kex_dh_group_size_max
$server_host_key_algorithms
$encryption_algorithms_client_to_server
$encryption_algorithms_server_to_client
$mac_algorithms_client_to_server
$mac_algorithms_server_to_client
$compression_algorithms_client_to_server
$compression_algorithms_server_to_client
$languages_server_to_client
$languages_client_to_server
$encrypt_block_size
$decrypt_block_size
$decrypt
$encrypt
$hmac_create
$hmac_check
$hmac_size
$server_public_host_key
$session_id
$exchange_hash
$message_numbers
$disconnect_reasons
$channel_open_failure_reasons
$terminal_modes
$channel_extended_data_type_codes
$send_seq_no
$get_seq_no
$server_channels
$channel_buffers
$channel_status
$packet_size_client_to_server
$message_number_log
$message_log
$window_size
$window_size_server_to_client
$window_size_client_to_server
$signature
$signature_format
$interactiveBuffer
$log_size
$timeout
$curTimeout
$realtime_log_file
$realtime_log_size
$signature_validated
$realtime_log_wrap
$quiet_mode
$last_packet
$exit_status
$request_pty
$in_request_pty_exec
$in_subsystem
$stdErrorLog
$last_interactive_response
$keyboard_requests_responses
$banner_message
$is_timeout
$log_boundary
$log_long_width
$log_short_width
$host
$port
$windowColumns
$windowRows
$crypto_engine
$agent
$send_id_string_first
$send_kex_first
$bad_key_size_fix
$decrypt_algorithm
$retry_connect
$binary_packet_buffer
$preferred_signature_format
$auth
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
LOG_COMPLEX
LOG_REALTIME
LOG_REALTIME_FILE
LOG_MAX_SIZE
READ_SIMPLE
READ_REGEX
READ_NEXT
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

MASK_CONSTRUCTOR

MASK_CONSTRUCTOR

MASK_CONNECTED

MASK_CONNECTED

MASK_LOGIN_REQ

MASK_LOGIN_REQ

MASK_LOGIN

MASK_LOGIN

MASK_SHELL

MASK_SHELL

MASK_WINDOW_ADJUST

MASK_WINDOW_ADJUST

CHANNEL_EXEC

CHANNEL_EXEC

CHANNEL_SHELL

CHANNEL_SHELL

CHANNEL_SUBSYSTEM

CHANNEL_SUBSYSTEM

CHANNEL_AGENT_FORWARD

CHANNEL_AGENT_FORWARD

CHANNEL_KEEP_ALIVE

CHANNEL_KEEP_ALIVE

LOG_SIMPLE

LOG_SIMPLE

Returns the message numbers

LOG_COMPLEX

LOG_COMPLEX

Returns the message content

LOG_REALTIME

LOG_REALTIME

Outputs the content real-time

LOG_REALTIME_FILE

LOG_REALTIME_FILE

Dumps the content real-time to a file

LOG_MAX_SIZE

LOG_MAX_SIZE

Make sure that the log never gets larger than this

READ_SIMPLE

READ_SIMPLE

Returns when a string matching $expect exactly is found

READ_REGEX

READ_REGEX

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

READ_NEXT

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

$identifier

$identifier : string

The SSH identifier

Type

string

$fsock

$fsock : object

The Socket Object

Type

object

$bitmap

$bitmap : integer

Execution Bitmap

The bits that are set represent functions that have been called already. This is used to determine if a requisite function has been successfully executed. If not, an error should be thrown.

Type

integer

$errors

$errors : string

Error information

Type

string

$server_identifier

$server_identifier : array|false

Server Identifier

Type

array|false

$kex_algorithms

$kex_algorithms : array|false

Key Exchange Algorithms

Type

array|false

$kex_dh_group_size_min

$kex_dh_group_size_min : integer

Minimum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods

Type

integer

$kex_dh_group_size_preferred

$kex_dh_group_size_preferred : integer

Preferred Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods

Type

integer

$kex_dh_group_size_max

$kex_dh_group_size_max : integer

Maximum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods

Type

integer

$server_host_key_algorithms

$server_host_key_algorithms : array|false

Server Host Key Algorithms

Type

array|false

$encryption_algorithms_client_to_server

$encryption_algorithms_client_to_server : array|false

Encryption Algorithms: Client to Server

Type

array|false

$encryption_algorithms_server_to_client

$encryption_algorithms_server_to_client : array|false

Encryption Algorithms: Server to Client

Type

array|false

$mac_algorithms_client_to_server

$mac_algorithms_client_to_server : array|false

MAC Algorithms: Client to Server

Type

array|false

$mac_algorithms_server_to_client

$mac_algorithms_server_to_client : array|false

MAC Algorithms: Server to Client

Type

array|false

$compression_algorithms_client_to_server

$compression_algorithms_client_to_server : array|false

Compression Algorithms: Client to Server

Type

array|false

$compression_algorithms_server_to_client

$compression_algorithms_server_to_client : array|false

Compression Algorithms: Server to Client

Type

array|false

$languages_server_to_client

$languages_server_to_client : array|false

Languages: Server to Client

Type

array|false

$languages_client_to_server

$languages_client_to_server : array|false

Languages: Client to Server

Type

array|false

$encrypt_block_size

$encrypt_block_size : integer

Block Size for Server to Client Encryption

"Note that the length of the concatenation of 'packet_length', 'padding_length', 'payload', and 'random padding' MUST be a multiple of the cipher block size or 8, whichever is larger. This constraint MUST be enforced, even when using stream ciphers."

-- http://tools.ietf.org/html/rfc4253#section-6

Type

integer

$decrypt_block_size

$decrypt_block_size : integer

Block Size for Client to Server Encryption

Type

integer

$decrypt

$decrypt : object

Server to Client Encryption Object

Type

object

$encrypt

$encrypt : object

Client to Server Encryption Object

Type

object

$hmac_create

$hmac_create : object

Client to Server HMAC Object

Type

object

$hmac_check

$hmac_check : object

Server to Client HMAC Object

Type

object

$hmac_size

$hmac_size : integer

Size of server to client HMAC

We need to know how big the HMAC will be for the server to client direction so that we know how many bytes to read. For the client to server side, the HMAC object will make the HMAC as long as it needs to be. All we need to do is append it.

Type

integer

$server_public_host_key

$server_public_host_key : string

Server Public Host Key

Type

string

$session_id

$session_id : string

Session identifier

"The exchange hash H from the first key exchange is additionally used as the session identifier, which is a unique identifier for this connection."

-- http://tools.ietf.org/html/rfc4253#section-7.2

Type

string

$exchange_hash

$exchange_hash : string

Exchange hash

The current exchange hash

Type

string

$message_numbers

$message_numbers : array

Message Numbers

Type

array

$disconnect_reasons

$disconnect_reasons : array

Disconnection Message 'reason codes' defined in RFC4253

Type

array

$channel_open_failure_reasons

$channel_open_failure_reasons : array

SSH_MSG_CHANNEL_OPEN_FAILURE 'reason codes', defined in RFC4254

Type

array

$terminal_modes

$terminal_modes : array

Terminal Modes

Type

array

$channel_extended_data_type_codes

$channel_extended_data_type_codes : array

SSH_MSG_CHANNEL_EXTENDED_DATA's data_type_codes

Type

array

$send_seq_no

$send_seq_no : integer

Send Sequence Number

See 'Section 6.4. Data Integrity' of rfc4253 for more info.

Type

integer

$get_seq_no

$get_seq_no : integer

Get Sequence Number

See 'Section 6.4. Data Integrity' of rfc4253 for more info.

Type

integer

$server_channels

$server_channels : array

Server Channels

Maps client channels to server channels

Type

array

$channel_buffers

$channel_buffers : array

Channel Buffers

If a client requests a packet from one channel but receives two packets from another those packets should be placed in a buffer

Type

array

$channel_status

$channel_status : array

Channel Status

Contains the type of the last sent message

Type

array

$packet_size_client_to_server

$packet_size_client_to_server : array

Packet Size

Maximum packet size indexed by channel

Type

array

$message_number_log

$message_number_log : array

Message Number Log

Type

array

$message_log

$message_log : array

Message Log

Type

array

$window_size

$window_size : integer

The Window Size

Bytes the other party can send before it must wait for the window to be adjusted (0x7FFFFFFF = 2GB)

Type

integer

$window_size_server_to_client

$window_size_server_to_client : array

Window size, server to client

Window size indexed by channel

Type

array

$window_size_client_to_server

$window_size_client_to_server : array

Window size, client to server

Window size indexed by channel

Type

array

$signature

$signature : string

Server signature

Verified against $this->session_id

Type

string

$signature_format

$signature_format : string

Server signature format

ssh-rsa or ssh-dss.

Type

string

$interactiveBuffer

$interactiveBuffer : array

Interactive Buffer

Type

array

$log_size

$log_size : integer

Current log size

Should never exceed self::LOG_MAX_SIZE

Type

integer

$timeout

$timeout : 

Timeout

Type

$curTimeout

$curTimeout : 

Current Timeout

Type

$realtime_log_file

$realtime_log_file : resource

Real-time log file pointer

Type

resource

$realtime_log_size

$realtime_log_size : integer

Real-time log file size

Type

integer

$signature_validated

$signature_validated : boolean

Has the signature been validated?

Type

boolean

$realtime_log_wrap

$realtime_log_wrap : 

Real-time log file wrap boolean

Type

$quiet_mode

$quiet_mode : 

Flag to suppress stderr from output

Type

$last_packet

$last_packet : integer

Time of first network activity

Type

integer

$exit_status

$exit_status : integer

Exit status returned from ssh if any

Type

integer

$request_pty

$request_pty : boolean

Flag to request a PTY when using exec()

Type

boolean

$in_request_pty_exec

$in_request_pty_exec : boolean

Flag set while exec() is running when using enablePTY()

Type

boolean

$in_subsystem

$in_subsystem : boolean

Flag set after startSubsystem() is called

Type

boolean

$stdErrorLog

$stdErrorLog : string

Contents of stdError

Type

string

$last_interactive_response

$last_interactive_response : string

The Last Interactive Response

Type

string

$keyboard_requests_responses

$keyboard_requests_responses : array

Keyboard Interactive Request / Responses

Type

array

$banner_message

$banner_message : string

Banner Message

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

Type

string

$is_timeout

$is_timeout : boolean

Did read() timeout or return normally?

Type

boolean

$log_boundary

$log_boundary : string

Log Boundary

Type

string

$log_long_width

$log_long_width : integer

Log Long Width

Type

integer

$log_short_width

$log_short_width : integer

Log Short Width

Type

integer

$host

$host : string

Hostname

Type

string

$port

$port : integer

Port Number

Type

integer

$windowColumns

$windowColumns : integer

Number of columns for terminal window size

Type

integer

$windowRows

$windowRows : integer

Number of columns for terminal window size

Type

integer

$crypto_engine

$crypto_engine : integer

Crypto Engine

Type

integer

$agent

$agent : \phpseclib\Net\System_SSH_Agent

A System_SSH_Agent for use in the SSH2 Agent Forwarding scenario

Type

\phpseclib\Net\System_SSH_Agent

$send_id_string_first

$send_id_string_first : boolean

Send the identification string first?

Type

boolean

$send_kex_first

$send_kex_first : boolean

Send the key exchange initiation packet first?

Type

boolean

$bad_key_size_fix

$bad_key_size_fix : boolean

Some versions of OpenSSH incorrectly calculate the key size

Type

boolean

$decrypt_algorithm

$decrypt_algorithm : string

The selected decryption algorithm

Type

string

$retry_connect

$retry_connect : boolean

Should we try to re-connect to re-establish keys?

Type

boolean

$binary_packet_buffer

$binary_packet_buffer : string|false

Binary Packet Buffer

Type

string|false

$preferred_signature_format

$preferred_signature_format : string|false

Preferred Signature Format

Type

string|false

$auth

$auth : array

Authentication Credentials

Type

array

Methods

__construct()

__construct(mixed  $host, integer  $port = 22, integer  $timeout = 10) : \phpseclib\Net\SSH2

Default Constructor.

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

Parameters

mixed $host
integer $port
integer $timeout

Returns

\phpseclib\Net\SSH2

setCryptoEngine()

setCryptoEngine(integer  $engine) 

Set Crypto Engine Mode

Possible $engine values: CRYPT_MODE_INTERNAL, CRYPT_MODE_MCRYPT

Parameters

integer $engine

sendIdentificationStringFirst()

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

sendIdentificationStringLast()

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

sendKEXINITFirst()

sendKEXINITFirst() 

Send SSH_MSG_KEXINIT First

https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending sending the [SSH_MSG_KEXINIT] 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

sendKEXINITLast()

sendKEXINITLast() 

Send SSH_MSG_KEXINIT Last

https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending sending the [SSH_MSG_KEXINIT] 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

_connect()

_connect() : boolean

Connect to an SSHv2 server

Returns

boolean

_generate_identifier()

_generate_identifier() : string

Generates the SSH identifier

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

Returns

string

_key_exchange()

_key_exchange(string  $kexinit_payload_server = false) 

Key Exchange

Parameters

string $kexinit_payload_server

optional

_encryption_algorithm_to_key_size()

_encryption_algorithm_to_key_size(string  $algorithm) : integer|null

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

Parameters

string $algorithm

Name of the encryption algorithm

Returns

integer|null —

Number of bytes as an integer or null for unknown

_encryption_algorithm_to_crypt_instance()

_encryption_algorithm_to_crypt_instance(string  $algorithm) : mixed

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

Parameters

string $algorithm

Name of the encryption algorithm

Returns

mixed —

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

_bad_algorithm_candidate()

_bad_algorithm_candidate(  $algorithm) 

Parameters

$algorithm

login()

login(string  $username) : boolean

Login

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

Parameters

string $username

Returns

boolean

_login()

_login(string  $username) : boolean

Login Helper

Parameters

string $username

Returns

boolean

_keyboard_interactive_login()

_keyboard_interactive_login(string  $username, string  $password) : boolean

Login via keyboard-interactive authentication

See RFC4256 for details. This is not a full-featured keyboard-interactive authenticator.

Parameters

string $username
string $password

Returns

boolean

_keyboard_interactive_process()

_keyboard_interactive_process() : boolean

Handle the keyboard-interactive requests / responses.

Returns

boolean

_ssh_agent_login()

_ssh_agent_login(string  $username, \phpseclib\System\SSH\Agent  $agent) : boolean

Login with an ssh-agent provided key

Parameters

string $username
\phpseclib\System\SSH\Agent $agent

Returns

boolean

setTimeout()

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

getStdError()

getStdError() 

Get the output from stdError

exec()

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

Execute Command

If $callback is set to false then \phpseclib\Net\SSH2::_get_channel_packet(self::CHANNEL_EXEC) 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

Returns

string

_initShell()

_initShell() : boolean

Creates an interactive shell

Returns

boolean

_get_interactive_channel()

_get_interactive_channel() : integer

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

Returns

integer

_get_open_channel()

_get_open_channel() : integer

Return an available open channel

Returns

integer

read()

read(string  $expect = '', integer  $mode = self::READ_SIMPLE) : string

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
integer $mode

Returns

string

write()

write(string  $cmd) : boolean

Inputs a command into an interactive shell.

Parameters

string $cmd

Returns

boolean

startSubsystem()

startSubsystem(string  $subsystem) : boolean

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

Returns

boolean

stopSubsystem()

stopSubsystem() : boolean

Stops a subsystem.

Returns

boolean

reset()

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

isTimeout()

isTimeout() 

Is timeout?

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

disconnect()

disconnect() 

Disconnect

__destruct()

__destruct() 

Destructor.

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

isConnected()

isConnected() : boolean

Is the connection still active?

Returns

boolean

isAuthenticated()

isAuthenticated() : boolean

Have you successfully been logged in?

Returns

boolean

_reconnect()

_reconnect() : boolean

In situ reconnect method

Returns

boolean

_reset_connection()

_reset_connection(integer  $reason) 

Resets a connection for re-use

Parameters

integer $reason

_get_binary_packet()

_get_binary_packet(  $skip_channel_filter = false) : string

Gets Binary Packets

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

Parameters

$skip_channel_filter

Returns

string

_filter()

_filter(  $payload,   $skip_channel_filter) : string

Filter Binary Packets

Because some binary packets need to be ignored...

Parameters

$payload
$skip_channel_filter

Returns

string

enableQuietMode()

enableQuietMode() 

Enable Quiet Mode

Suppress stderr from output

disableQuietMode()

disableQuietMode() 

Disable Quiet Mode

Show stderr in output

isQuietModeEnabled()

isQuietModeEnabled() : boolean

Returns whether Quiet Mode is enabled or not

Returns

boolean

enablePTY()

enablePTY() 

Enable request-pty when using exec()

disablePTY()

disablePTY() 

Disable request-pty when using exec()

isPTYEnabled()

isPTYEnabled() : boolean

Returns whether request-pty is enabled or not

Returns

boolean

_get_channel_packet()

_get_channel_packet(  $client_channel,   $skip_extended = false) : mixed

Gets channel data

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

Parameters

$client_channel
$skip_extended

Returns

mixed

_send_binary_packet()

_send_binary_packet(string  $data, string  $logged = null) : boolean

Sends Binary Packets

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

Parameters

string $data
string $logged

Returns

boolean

_append_log()

_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

_send_channel_packet()

_send_channel_packet(integer  $client_channel, string  $data) : boolean

Sends channel data

Spans multiple SSH_MSG_CHANNEL_DATAs if appropriate

Parameters

integer $client_channel
string $data

Returns

boolean

_close_channel()

_close_channel(integer  $client_channel, boolean  $want_reply = false) : boolean

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

integer $client_channel
boolean $want_reply

Returns

boolean

_disconnect()

_disconnect(integer  $reason) : boolean

Disconnect

Parameters

integer $reason

Returns

boolean

_string_shift()

_string_shift(string  $string, integer  $index = 1) : string

String Shift

Inspired by array_shift

Parameters

string $string
integer $index

Returns

string

_define_array()

_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.

getLog()

getLog() : array|false|string

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

Returns a string if NET_SSH2_LOGGING == self::LOG_COMPLEX, an array if NET_SSH2_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SSH2_LOGGING')

Returns

array|false|string

_format_log()

_format_log(array  $message_log, array  $message_number_log) : string

Formats a log for printing

Parameters

array $message_log
array $message_number_log

Returns

string

_format_log_helper()

_format_log_helper(array  $matches) : string

Helper function for _format_log

For use with preg_replace_callback()

Parameters

array $matches

Returns

string

_on_channel_open()

_on_channel_open() 

Helper function for agent->_on_channel_open()

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

_array_intersect_first()

_array_intersect_first(array  $array1, array  $array2) : mixed

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

Returns

mixed —

False if intersection is empty, else intersected value.

getErrors()

getErrors() : array<mixed,string>

Returns all errors

Returns

array<mixed,string>

getLastError()

getLastError() : string

Returns the last error

Returns

string

getServerIdentification()

getServerIdentification() : string

Return the server identification.

Returns

string

getKexAlgorithms()

getKexAlgorithms() : array

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

Returns

array

getServerHostKeyAlgorithms()

getServerHostKeyAlgorithms() : array

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

Returns

array

getEncryptionAlgorithmsClient2Server()

getEncryptionAlgorithmsClient2Server() : array

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

Returns

array

getEncryptionAlgorithmsServer2Client()

getEncryptionAlgorithmsServer2Client() : array

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

Returns

array

getMACAlgorithmsClient2Server()

getMACAlgorithmsClient2Server() : array

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

Returns

array

getMACAlgorithmsServer2Client()

getMACAlgorithmsServer2Client() : array

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

Returns

array

getCompressionAlgorithmsClient2Server()

getCompressionAlgorithmsClient2Server() : array

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

Returns

array

getCompressionAlgorithmsServer2Client()

getCompressionAlgorithmsServer2Client() : array

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

Returns

array

getLanguagesServer2Client()

getLanguagesServer2Client() : array

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

Returns

array

getLanguagesClient2Server()

getLanguagesClient2Server() : array

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

Returns

array

getBannerMessage()

getBannerMessage() : string

Returns the banner message.

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

Returns

string

getServerPublicHostKey()

getServerPublicHostKey() : mixed

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.

Returns

mixed

getExitStatus()

getExitStatus() : false|integer

Returns the exit status of an SSH command or false.

Returns

false|integer

getWindowColumns()

getWindowColumns() : integer

Returns the number of columns for the terminal window size.

Returns

integer

getWindowRows()

getWindowRows() : integer

Returns the number of rows for the terminal window size.

Returns

integer

setWindowColumns()

setWindowColumns(integer  $value) 

Sets the number of columns for the terminal window size.

Parameters

integer $value

setWindowRows()

setWindowRows(integer  $value) 

Sets the number of rows for the terminal window size.

Parameters

integer $value

setWindowSize()

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

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

Parameters

integer $columns
integer $rows