Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe SSH2
+ Graphe d'héritage de SSH2:

Fonctions membres publiques

 sendIdentificationStringFirst ()
 
 sendIdentificationStringLast ()
 
 sendKEXINITFirst ()
 
 sendKEXINITLast ()
 
 login ($username,... $args)
 
 setTimeout ($timeout)
 
 setKeepAlive ($interval)
 
 getStdError ()
 
 exec ($command, callable $callback=null)
 
 requestAgentForwarding ()
 
 read ($expect='', $mode=self::READ_SIMPLE)
 
 write ($cmd)
 
 startSubsystem ($subsystem)
 
 stopSubsystem ()
 
 reset ()
 
 isTimeout ()
 
 disconnect ()
 
 __destruct ()
 
 isConnected ()
 
 isAuthenticated ()
 
 ping ()
 
 enableQuietMode ()
 
 disableQuietMode ()
 
 isQuietModeEnabled ()
 
 enablePTY ()
 
 disablePTY ()
 
 isPTYEnabled ()
 
 getLog ()
 
 getErrors ()
 
 getLastError ()
 
 getServerIdentification ()
 
 getServerAlgorithms ()
 
 getAlgorithmsNegotiated ()
 
 setTerminal ($term)
 
 setPreferredAlgorithms (array $methods)
 
 getBannerMessage ()
 
 getServerPublicHostKey ()
 
 getExitStatus ()
 
 getWindowColumns ()
 
 getWindowRows ()
 
 setWindowColumns ($value)
 
 setWindowRows ($value)
 
 setWindowSize ($columns=80, $rows=24)
 
 __toString ()
 
 getResourceId ()
 
 getAuthMethodsToContinue ()
 
 enableSmartMFA ()
 
 disableSmartMFA ()
 

Fonctions membres publiques statiques

static setCryptoEngine ($engine)
 
static getSupportedKEXAlgorithms ()
 
static getSupportedHostKeyAlgorithms ()
 
static getSupportedEncryptionAlgorithms ()
 
static getSupportedMACAlgorithms ()
 
static getSupportedCompressionAlgorithms ()
 
static getConnectionByResourceId ($id)
 

Champs de données

const NET_SSH2_COMPRESSION_NONE = 1
 
const NET_SSH2_COMPRESSION_ZLIB = 2
 
const NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH = 3
 
const MASK_CONSTRUCTOR = 0x00000001
 
const MASK_CONNECTED = 0x00000002
 
const MASK_LOGIN_REQ = 0x00000004
 
const MASK_LOGIN = 0x00000008
 
const MASK_SHELL = 0x00000010
 
const MASK_WINDOW_ADJUST = 0x00000020
 
const CHANNEL_EXEC = 1
 
const CHANNEL_SHELL = 2
 
const CHANNEL_SUBSYSTEM = 3
 
const CHANNEL_AGENT_FORWARD = 4
 
const CHANNEL_KEEP_ALIVE = 5
 
const LOG_SIMPLE = 1
 
const LOG_COMPLEX = 2
 
const LOG_REALTIME = 3
 
const LOG_REALTIME_FILE = 4
 
const LOG_MAX_SIZE = 1048576
 
const READ_SIMPLE = 1
 
const READ_REGEX = 2
 
const READ_NEXT = 3
 
 $fsock
 

Fonctions membres protégées

 sublogin ($username,... $args)
 
 reset_connection ($reason)
 
 get_channel_packet ($client_channel, $skip_extended=false)
 
 send_binary_packet ($data, $logged=null)
 
 send_channel_packet ($client_channel, $data)
 
 disconnect_helper ($reason)
 
 define_array (... $args)
 
 format_log ($message_log, $message_number_log)
 

Attributs protégés

 $bitmap = 0
 
 $server_identifier = false
 
 $server_channels = []
 
 $channel_status = []
 
 $window_size = 0x7FFFFFFF
 
 $window_size_server_to_client = []
 
 $timeout
 
 $curTimeout
 
 $preferred_signature_format = false
 
 $auth = []
 

Fonctions membres privées

 connect ()
 
 generate_identifier ()
 
 key_exchange ($kexinit_payload_server=false)
 
 encryption_algorithm_to_key_size ($algorithm)
 
 login_helper ($username, $password=null)
 
 keyboard_interactive_login ($username, $password)
 
 keyboard_interactive_process (... $responses)
 
 ssh_agent_login ($username, Agent $agent)
 
 privatekey_login ($username, PrivateKey $privatekey)
 
 initShell ()
 
 get_interactive_channel ()
 
 get_open_channel ()
 
 reconnect ()
 
 read_remaining_bytes ($remaining_length)
 
 filter ($payload, $skip_channel_filter)
 
 append_log ($message_number, $message)
 
 close_channel ($client_channel, $want_reply=false)
 
 on_channel_open ()
 
 updateLogHistory ($old, $new)
 

Fonctions membres privées statiques

static encryption_algorithm_to_crypt_instance ($algorithm)
 
static mac_algorithm_to_hash_instance ($algorithm)
 
static bad_algorithm_candidate ($algorithm)
 
static array_intersect_first ($array1, $array2)
 

Attributs privés

 $identifier
 
 $errors = []
 
 $kex_algorithms = false
 
 $kex_algorithm = false
 
 $kex_dh_group_size_min = 1536
 
 $kex_dh_group_size_preferred = 2048
 
 $kex_dh_group_size_max = 4096
 
 $server_host_key_algorithms = false
 
 $encryption_algorithms_client_to_server = false
 
 $encryption_algorithms_server_to_client = false
 
 $mac_algorithms_client_to_server = false
 
 $mac_algorithms_server_to_client = false
 
 $compression_algorithms_client_to_server = false
 
 $compression_algorithms_server_to_client = false
 
 $languages_server_to_client = false
 
 $languages_client_to_server = false
 
 $preferred = []
 
 $encrypt_block_size = 8
 
 $decrypt_block_size = 8
 
 $decrypt = false
 
 $decryptName
 
 $decryptInvocationCounter
 
 $decryptFixedPart
 
 $lengthDecrypt = false
 
 $encrypt = false
 
 $encryptName
 
 $encryptInvocationCounter
 
 $encryptFixedPart
 
 $lengthEncrypt = false
 
 $hmac_create = false
 
 $hmac_create_name
 
 $hmac_create_etm
 
 $hmac_check = false
 
 $hmac_check_name
 
 $hmac_check_etm
 
 $hmac_size = false
 
 $server_public_host_key
 
 $session_id = false
 
 $exchange_hash = false
 
 $message_numbers = []
 
 $disconnect_reasons = []
 
 $channel_open_failure_reasons = []
 
 $terminal_modes = []
 
 $channel_extended_data_type_codes = []
 
 $send_seq_no = 0
 
 $get_seq_no = 0
 
 $channel_buffers = []
 
 $packet_size_client_to_server = []
 
 $message_number_log = []
 
 $message_log = []
 
 $window_resize = 0x40000000
 
 $window_size_client_to_server = []
 
 $signature = ''
 
 $signature_format = ''
 
 $interactiveBuffer = ''
 
 $log_size
 
 $keepAlive
 
 $realtime_log_file
 
 $realtime_log_size
 
 $signature_validated = false
 
 $realtime_log_wrap
 
 $quiet_mode = false
 
 $last_packet
 
 $exit_status
 
 $request_pty = false
 
 $in_request_pty_exec = false
 
 $in_subsystem
 
 $stdErrorLog
 
 $last_interactive_response = ''
 
 $keyboard_requests_responses = []
 
 $banner_message = ''
 
 $is_timeout = false
 
 $log_boundary = ':'
 
 $log_long_width = 65
 
 $log_short_width = 16
 
 $host
 
 $port
 
 $windowColumns = 80
 
 $windowRows = 24
 
 $agent
 
 $send_id_string_first = true
 
 $send_kex_first = true
 
 $bad_key_size_fix = false
 
 $retry_connect = false
 
 $binary_packet_buffer = false
 
 $term = 'vt100'
 
 $auth_methods_to_continue = null
 
 $compress = self::NET_SSH2_COMPRESSION_NONE
 
 $decompress = self::NET_SSH2_COMPRESSION_NONE
 
 $compress_context
 
 $decompress_context
 
 $regenerate_compression_context = false
 
 $regenerate_decompression_context = false
 
 $smartMFA = true
 

Attributs privés statiques

static $crypto_engine = false
 
static $connections
 

Documentation des constructeurs et destructeur

◆ __destruct()

__destruct ( )

Destructor.

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

public

Références SSH2\disconnect().

Documentation des fonctions membres

◆ __toString()

__toString ( )

To String Magic Method

Renvoie
string public

Références SSH2\getResourceId().

◆ append_log()

append_log (   $message_number,
  $message 
)
private

Logs data packets

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

Paramètres
string$message_number
string$messageprivate

Références $message, $start, $temp, SSH2\format_log(), et Strings\shift().

Référencé par SSH2\connect(), et SSH2\send_binary_packet().

◆ array_intersect_first()

static array_intersect_first (   $array1,
  $array2 
)
staticprivate

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.

Paramètres
array$array1
array$array2
Renvoie
mixed False if intersection is empty, else intersected value. private

Références $value.

◆ bad_algorithm_candidate()

static bad_algorithm_candidate (   $algorithm)
staticprivate

◆ close_channel()

close_channel (   $client_channel,
  $want_reply = false 
)
private

Closes and flushes a channel

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.

Paramètres
int$client_channel
bool$want_reply
Renvoie
void private

Références SSH2\disconnect(), SSH2\get_channel_packet(), SSH2\MASK_SHELL, et SSH2\send_binary_packet().

Référencé par SSH2\disablePTY(), SSH2\exec(), SSH2\get_channel_packet(), SSH2\ping(), SSH2\reset(), et SSH2\stopSubsystem().

◆ connect()

◆ define_array()

define_array (   $args)
protected

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.

Paramètres
mixed[]...$args protected

Références $key, et $value.

Référencé par SFTP\__construct().

◆ disablePTY()

disablePTY ( )

Disable request-pty when using exec()

public

Références SSH2\close_channel().

◆ disableQuietMode()

disableQuietMode ( )

Disable Quiet Mode

Show stderr in output

public

◆ disableSmartMFA()

disableSmartMFA ( )

Disables "smart" multi-factor authentication (MFA)

◆ disconnect()

disconnect ( )

Disconnect

public

Références SSH2\disconnect_helper(), et SSH2\getResourceId().

Référencé par SSH2\__destruct(), et SSH2\close_channel().

◆ disconnect_helper()

◆ enablePTY()

enablePTY ( )

Enable request-pty when using exec()

public

◆ enableQuietMode()

enableQuietMode ( )

Enable Quiet Mode

Suppress stderr from output

public

◆ enableSmartMFA()

enableSmartMFA ( )

Enables "smart" multi-factor authentication (MFA)

◆ encryption_algorithm_to_crypt_instance()

static encryption_algorithm_to_crypt_instance (   $algorithm)
staticprivate

Maps an encryption algorithm name to an instance of a subclass of .

Paramètres
string$algorithmName of the encryption algorithm
Renvoie
SymmetricKey|null private

Références null.

◆ encryption_algorithm_to_key_size()

encryption_algorithm_to_key_size (   $algorithm)
private

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

Paramètres
string$algorithmName of the encryption algorithm
Renvoie
int|null Number of bytes as an integer or null for unknown private

Références null.

Référencé par SSH2\key_exchange().

◆ exec()

exec (   $command,
callable  $callback = null 
)

Execute Command

If $callback is set to false then ::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.

Paramètres
string$command
Renvoie
string|bool -return ($callback is callable ? bool : string|bool)
Exceptions

Références $output, $temp, SSH2\$terminal_modes, SSH2\$timeout, SSH2\$window_size, SSH2\close_channel(), SSH2\disconnect_helper(), SSH2\get_channel_packet(), SSH2\isAuthenticated(), Strings\packSSH2(), SSH2\send_binary_packet(), et true.

◆ filter()

filter (   $payload,
  $skip_channel_filter 
)
private

Filter Binary Packets

Because some binary packets need to be ignored...

Voir également
self::_get_binary_packet()
Paramètres
string$payload
bool$skip_channel_filter
Renvoie
string|bool private

Références $data, $message, SSH2\$window_size, SSH2\disconnect_helper(), SSH2\get_channel_packet(), SSH2\isAuthenticated(), SSH2\key_exchange(), Strings\packSSH2(), SSH2\send_binary_packet(), Strings\shift(), et Strings\unpackSSH2().

◆ format_log()

format_log (   $message_log,
  $message_number_log 
)
protected

Formats a log for printing

Paramètres
array$message_log
array$message_number_logprivate
Renvoie
string

Références $i, SSH2\$message_log, SSH2\$message_number_log, $output, et Strings\shift().

Référencé par SSH2\append_log(), et SSH2\getLog().

◆ generate_identifier()

generate_identifier ( )
private

Generates the SSH identifier

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

protected

Renvoie
string

Références SSH2\$identifier, et elseif.

Référencé par SSH2\connect().

◆ get_channel_packet()

get_channel_packet (   $client_channel,
  $skip_extended = false 
)
protected

Gets channel data

Returns the data as a string. bool(true) is returned if:

  • the server closes the channel
  • if the connection times out
  • if the channel status is CHANNEL_OPEN and the response was CHANNEL_OPEN_CONFIRMATION
  • if the channel status is CHANNEL_REQUEST and the response was CHANNEL_SUCCESS

bool(false) is returned if:

  • if the channel status is CHANNEL_REQUEST and the response was CHANNEL_FAILURE
Paramètres
int$client_channel
bool$skip_extended
Renvoie
mixed
Exceptions

Références SSH2\$binary_packet_buffer, $data, $i, $result, $type, $value, SSH2\$window_resize, SSH2\$window_size, SSH2\close_channel(), SSH2\disconnect_helper(), SSH2\MASK_SHELL, SSH2\on_channel_open(), SSH2\send_binary_packet(), SSH2\send_channel_packet(), true, et Strings\unpackSSH2().

Référencé par SSH2\close_channel(), SSH2\exec(), SSH2\filter(), SSH2\initShell(), SFTP\partial_init_sftp_connection(), SSH2\ping(), SSH2\read(), SSH2\requestAgentForwarding(), SSH2\send_channel_packet(), et SSH2\startSubsystem().

◆ get_interactive_channel()

get_interactive_channel ( )
private

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

Voir également
self::read()
self::write()
Renvoie
int public

Référencé par SSH2\read(), SSH2\reset(), et SSH2\write().

◆ get_open_channel()

get_open_channel ( )
private

Return an available open channel

Renvoie
int public

Référencé par SSH2\requestAgentForwarding().

◆ getAlgorithmsNegotiated()

getAlgorithmsNegotiated ( )

◆ getAuthMethodsToContinue()

getAuthMethodsToContinue ( )

Return the list of authentication methods that may productively continue authentication.

Voir également
https://tools.ietf.org/html/rfc4252#section-5.1
Renvoie
array|null

Références SSH2\$auth_methods_to_continue.

◆ getBannerMessage()

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

Renvoie
string public

Références SSH2\$banner_message.

◆ getConnectionByResourceId()

static getConnectionByResourceId (   $id)
static

Return existing connection

Paramètres
string$id
Renvoie
bool|SSH2 will return false if no such connection

Références $id.

Référencé par Stream\parse_path().

◆ getErrors()

getErrors ( )

Returns all errors

Renvoie
string[] public

Références SSH2\$errors.

◆ getExitStatus()

getExitStatus ( )

Returns the exit status of an SSH command or false.

Renvoie
false|int public

Références SSH2\$exit_status.

◆ getLastError()

getLastError ( )

Returns the last error

Renvoie
string public

Références $count.

◆ getLog()

getLog ( )

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')

public

Renvoie
array|false|string

Références SSH2\$message_number_log, et SSH2\format_log().

◆ getResourceId()

getResourceId ( )

Get Resource ID

We use {} because that symbols should not be in URL according to RFC. It will safe us from any conflicts, because otherwise regexp will match all alphanumeric domains.

Renvoie
string

Références $this.

Référencé par SSH2\__toString(), et SSH2\disconnect().

◆ getServerAlgorithms()

◆ getServerIdentification()

getServerIdentification ( )

Return the server identification.

Renvoie
string|false public

Références SSH2\$server_identifier, et SSH2\connect().

◆ getServerPublicHostKey()

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.

Renvoie
string|false
Exceptions

Références $hash, $key, SSH2\$server_public_host_key, SSH2\$signature, $this, SSH2\connect(), SSH2\disconnect_helper(), AsymmetricKey\loadFormat(), RSA\SIGNATURE_PKCS1, et Strings\unpackSSH2().

◆ getStdError()

getStdError ( )

Get the output from stdError

public

Références SSH2\$stdErrorLog.

◆ getSupportedCompressionAlgorithms()

static getSupportedCompressionAlgorithms ( )
static

Returns a list of compression algorithms that phpseclib supports

Renvoie
array public

Référencé par SSH2\key_exchange().

◆ getSupportedEncryptionAlgorithms()

static getSupportedEncryptionAlgorithms ( )
static

Returns a list of symmetric key algorithms that phpseclib supports

Renvoie
array public

Référencé par SSH2\key_exchange().

◆ getSupportedHostKeyAlgorithms()

static getSupportedHostKeyAlgorithms ( )
static

Returns a list of host key algorithms that phpseclib supports

Renvoie
array public

Référencé par SSH2\key_exchange().

◆ getSupportedKEXAlgorithms()

static getSupportedKEXAlgorithms ( )
static

Returns a list of KEX algorithms that phpseclib supports

Renvoie
array public

Références SSH2\$kex_algorithms.

Référencé par SSH2\key_exchange().

◆ getSupportedMACAlgorithms()

static getSupportedMACAlgorithms ( )
static

Returns a list of MAC algorithms that phpseclib supports

Renvoie
array public

Référencé par SSH2\key_exchange().

◆ getWindowColumns()

getWindowColumns ( )

Returns the number of columns for the terminal window size.

Renvoie
int public

Références SSH2\$windowColumns.

◆ getWindowRows()

getWindowRows ( )

Returns the number of rows for the terminal window size.

Renvoie
int public

Références SSH2\$windowRows.

◆ initShell()

initShell ( )
private

Creates an interactive shell

Voir également
self::read()
self::write()
Renvoie
bool
Exceptions

Références SSH2\$terminal_modes, SSH2\$window_size, SSH2\get_channel_packet(), Strings\packSSH2(), et SSH2\send_binary_packet().

Référencé par SSH2\read(), et SSH2\write().

◆ isAuthenticated()

isAuthenticated ( )

Have you successfully been logged in?

Renvoie
bool public

Référencé par SSH2\exec(), SSH2\filter(), SSH2\ping(), SSH2\read(), SSH2\send_binary_packet(), et SSH2\write().

◆ isConnected()

isConnected ( )

Is the connection still active?

Renvoie
bool public

◆ isPTYEnabled()

isPTYEnabled ( )

Returns whether request-pty is enabled or not

Voir également
self::enablePTY()
self::disablePTY() public
Renvoie
bool

Références SSH2\$request_pty.

◆ isQuietModeEnabled()

isQuietModeEnabled ( )

Returns whether Quiet Mode is enabled or not

Voir également
self::enableQuietMode()
self::disableQuietMode() public
Renvoie
bool

Références SSH2\$quiet_mode.

◆ isTimeout()

isTimeout ( )

Is timeout?

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

public

Références SSH2\$is_timeout.

Référencé par SFTP\partial_init_sftp_connection().

◆ key_exchange()

◆ keyboard_interactive_login()

keyboard_interactive_login (   $username,
  $password 
)
private

Login via keyboard-interactive authentication

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

Paramètres
string$username
string | array$password
Renvoie
bool private

Références $password, SSH2\keyboard_interactive_process(), Strings\packSSH2(), et SSH2\send_binary_packet().

Référencé par SSH2\login_helper().

◆ keyboard_interactive_process()

keyboard_interactive_process (   $responses)
private

Handle the keyboard-interactive requests / responses.

Paramètres
string|array...$responses
Renvoie
bool
Exceptions

Références $i, $key, SSH2\$last_interactive_response, $type, $value, Strings\packSSH2(), SSH2\send_binary_packet(), Strings\unpackSSH2(), et SSH2\updateLogHistory().

Référencé par SSH2\keyboard_interactive_login(), et SSH2\login_helper().

◆ login()

login (   $username,
  $args 
)

Login

The $password parameter can be a plaintext password, a |EC|DSA object, a object or an array

Paramètres
string$username
string|AsymmetricKey|array[]|Agent|null...$args
Renvoie
bool
Voir également
self::_login() public

Références null, et SSH2\sublogin().

Référencé par SSH2\reconnect().

◆ login_helper()

◆ mac_algorithm_to_hash_instance()

static mac_algorithm_to_hash_instance (   $algorithm)
staticprivate

Maps an encryption algorithm name to an instance of a subclass of .

Paramètres
string$algorithmName of the encryption algorithm
Renvoie
array{Hash, int}|null private

◆ on_channel_open()

on_channel_open ( )
private

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

private

Références $this.

Référencé par SSH2\get_channel_packet().

◆ ping()

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

Renvoie
bool

Références SSH2\$window_size, SSH2\close_channel(), SSH2\get_channel_packet(), SSH2\isAuthenticated(), Strings\packSSH2(), SSH2\reconnect(), et SSH2\send_binary_packet().

◆ privatekey_login()

◆ read()

read (   $expect = '',
  $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.

Voir également
self::write()
Paramètres
string$expect
int$mode
Renvoie
string|bool|null
Exceptions

Références $mode, SSH2\$timeout, SSH2\get_channel_packet(), SSH2\get_interactive_channel(), SSH2\initShell(), SSH2\isAuthenticated(), et Strings\shift().

◆ read_remaining_bytes()

read_remaining_bytes (   $remaining_length)
private

Read Remaining Bytes

Voir également
self::get_binary_packet()
Paramètres
int$remaining_length
Renvoie
string private

Références $buffer, $temp, SSH2\disconnect_helper(), SSH2\MASK_LOGIN, et SSH2\reset_connection().

◆ reconnect()

reconnect ( )
private

In situ reconnect method

Renvoie
boolean

Références SSH2\$auth, $result, SSH2\connect(), SSH2\login(), et SSH2\reset_connection().

Référencé par SSH2\ping().

◆ requestAgentForwarding()

requestAgentForwarding ( )

Request agent forwarding of remote server

Renvoie
bool public

Références SSH2\get_channel_packet(), SSH2\get_open_channel(), Strings\packSSH2(), et SSH2\send_binary_packet().

◆ 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

public

Références SSH2\close_channel(), et SSH2\get_interactive_channel().

◆ reset_connection()

reset_connection (   $reason)
protected

Resets a connection for re-use

Paramètres
int$reasonprivate

Références SSH2\disconnect_helper().

Référencé par SSH2\read_remaining_bytes(), et SSH2\reconnect().

◆ send_binary_packet()

◆ send_channel_packet()

send_channel_packet (   $client_channel,
  $data 
)
protected

Sends channel data

Spans multiple SSH_MSG_CHANNEL_DATAs if appropriate

Paramètres
int$client_channel
string$data
Renvoie
void

Références $data, $temp, SSH2\get_channel_packet(), Strings\packSSH2(), SSH2\send_binary_packet(), et Strings\shift().

Référencé par SSH2\get_channel_packet(), et SSH2\write().

◆ 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

public

◆ 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

public

◆ 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

public

◆ 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

public

◆ setCryptoEngine()

static setCryptoEngine (   $engine)
static

Set Crypto Engine Mode

Possible $engine values: OpenSSL, mcrypt, Eval, PHP

Paramètres
int$enginepublic

◆ setKeepAlive()

setKeepAlive (   $interval)

Set Keep Alive

Sends an SSH2_MSG_IGNORE message every x seconds, if x is a positive non-zero number.

Paramètres
int$intervalpublic

◆ setPreferredAlgorithms()

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

Paramètres
array$methodspublic

Références $key, et SSH2\$preferred.

◆ setTerminal()

setTerminal (   $term)

Allows you to set the terminal

Paramètres
string$termpublic

Références SSH2\$term.

◆ setTimeout()

setTimeout (   $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.

Paramètres
mixed$timeoutpublic

Références SSH2\$timeout.

◆ setWindowColumns()

setWindowColumns (   $value)

Sets the number of columns for the terminal window size.

Paramètres
int$valuepublic

Références $value.

◆ setWindowRows()

setWindowRows (   $value)

Sets the number of rows for the terminal window size.

Paramètres
int$valuepublic

Références $value.

◆ setWindowSize()

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

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

Paramètres
int$columns
int$rowspublic

Références $columns, et $rows.

◆ ssh_agent_login()

ssh_agent_login (   $username,
Agent  $agent 
)
private

Login with an ssh-agent provided key

Paramètres
string$username
\phpseclib3\System\SSH\Agent$agent
Renvoie
bool private

Références SSH2\$agent, $key, et SSH2\privatekey_login().

Référencé par SSH2\login_helper().

◆ startSubsystem()

startSubsystem (   $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.

Voir également
self::stopSubsystem()
Paramètres
string$subsystem
Renvoie
bool public

Références SSH2\$window_size, SSH2\get_channel_packet(), Strings\packSSH2(), et SSH2\send_binary_packet().

◆ stopSubsystem()

stopSubsystem ( )

Stops a subsystem.

Voir également
self::startSubsystem()
Renvoie
bool public

Références SSH2\close_channel().

◆ sublogin()

sublogin (   $username,
  $args 
)
protected

Login Helper

Paramètres
string$username
string...$args
Renvoie
bool
Voir également
self::_login_helper() private

Références $key, $method, SSH2\connect(), Strings\is_stringable(), et SSH2\login_helper().

Référencé par SSH2\login().

◆ updateLogHistory()

updateLogHistory (   $old,
  $new 
)
private

◆ write()

write (   $cmd)

Inputs a command into an interactive shell.

Voir également
SSH2::read()
Paramètres
string$cmd
Renvoie
void
Exceptions

Références SSH2\get_interactive_channel(), SSH2\initShell(), SSH2\isAuthenticated(), et SSH2\send_channel_packet().

Documentation des champs

◆ $agent

$agent
private

Référencé par SSH2\ssh_agent_login().

◆ $auth

$auth = []
protected

Référencé par SSH2\reconnect().

◆ $auth_methods_to_continue

$auth_methods_to_continue = null
private

◆ $bad_key_size_fix

$bad_key_size_fix = false
private

◆ $banner_message

$banner_message = ''
private

Référencé par SSH2\getBannerMessage().

◆ $binary_packet_buffer

$binary_packet_buffer = false
private

Référencé par SSH2\get_channel_packet().

◆ $bitmap

$bitmap = 0
protected

◆ $channel_buffers

$channel_buffers = []
private

◆ $channel_extended_data_type_codes

$channel_extended_data_type_codes = []
private

◆ $channel_open_failure_reasons

$channel_open_failure_reasons = []
private

◆ $channel_status

$channel_status = []
protected

◆ $compress

$compress = self::NET_SSH2_COMPRESSION_NONE
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $compress_context

$compress_context
private

◆ $compression_algorithms_client_to_server

$compression_algorithms_client_to_server = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $compression_algorithms_server_to_client

$compression_algorithms_server_to_client = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $connections

$connections
staticprivate

◆ $crypto_engine

$crypto_engine = false
staticprivate

◆ $curTimeout

$curTimeout
protected

Current Timeout

Voir également
self::get_channel_packet() private

◆ $decompress

$decompress = self::NET_SSH2_COMPRESSION_NONE
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $decompress_context

$decompress_context
private

◆ $decrypt

$decrypt = false
private

Référencé par SSH2\key_exchange().

◆ $decrypt_block_size

$decrypt_block_size = 8
private

◆ $decryptFixedPart

$decryptFixedPart
private

◆ $decryptInvocationCounter

$decryptInvocationCounter
private

◆ $decryptName

$decryptName
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $disconnect_reasons

$disconnect_reasons = []
private

◆ $encrypt

$encrypt = false
private

Référencé par SSH2\key_exchange().

◆ $encrypt_block_size

$encrypt_block_size = 8
private

Référencé par SSH2\send_binary_packet().

◆ $encryptFixedPart

$encryptFixedPart
private

◆ $encryptInvocationCounter

$encryptInvocationCounter
private

◆ $encryption_algorithms_client_to_server

$encryption_algorithms_client_to_server = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $encryption_algorithms_server_to_client

$encryption_algorithms_server_to_client = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $encryptName

$encryptName
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $errors

$errors = []
private

Référencé par SSH2\getErrors().

◆ $exchange_hash

$exchange_hash = false
private

Référencé par SSH2\key_exchange().

◆ $exit_status

$exit_status
private

Référencé par SSH2\getExitStatus().

◆ $fsock

$fsock

Référencé par SSH2\connect().

◆ $get_seq_no

$get_seq_no = 0
private

◆ $hmac_check

$hmac_check = false
private

◆ $hmac_check_etm

$hmac_check_etm
private

◆ $hmac_check_name

$hmac_check_name
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $hmac_create

$hmac_create = false
private

◆ $hmac_create_etm

$hmac_create_etm
private

◆ $hmac_create_name

$hmac_create_name
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $hmac_size

$hmac_size = false
private

◆ $host

$host
private

◆ $identifier

$identifier
private

Référencé par SSH2\generate_identifier().

◆ $in_request_pty_exec

$in_request_pty_exec = false
private

◆ $in_subsystem

$in_subsystem
private

◆ $interactiveBuffer

$interactiveBuffer = ''
private

◆ $is_timeout

$is_timeout = false
private

Référencé par SSH2\isTimeout().

◆ $keepAlive

$keepAlive
private

Keep Alive Interval

Voir également
self::setKeepAlive() private

◆ $kex_algorithm

$kex_algorithm = false
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $kex_algorithms

◆ $kex_dh_group_size_max

$kex_dh_group_size_max = 4096
private

◆ $kex_dh_group_size_min

$kex_dh_group_size_min = 1536
private

◆ $kex_dh_group_size_preferred

$kex_dh_group_size_preferred = 2048
private

◆ $keyboard_requests_responses

$keyboard_requests_responses = []
private

◆ $languages_client_to_server

$languages_client_to_server = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $languages_server_to_client

$languages_server_to_client = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $last_interactive_response

$last_interactive_response = ''
private

◆ $last_packet

$last_packet
private

◆ $lengthDecrypt

$lengthDecrypt = false
private

◆ $lengthEncrypt

$lengthEncrypt = false
private

◆ $log_boundary

$log_boundary = ':'
private

◆ $log_long_width

$log_long_width = 65
private

◆ $log_short_width

$log_short_width = 16
private

◆ $log_size

$log_size
private

◆ $mac_algorithms_client_to_server

$mac_algorithms_client_to_server = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $mac_algorithms_server_to_client

$mac_algorithms_server_to_client = false
private

Référencé par SSH2\getServerAlgorithms().

◆ $message_log

$message_log = []
private

Référencé par SSH2\format_log().

◆ $message_number_log

$message_number_log = []
private

Référencé par SSH2\format_log(), et SSH2\getLog().

◆ $message_numbers

$message_numbers = []
private

◆ $packet_size_client_to_server

$packet_size_client_to_server = []
private

◆ $port

$port
private

◆ $preferred

$preferred = []
private

◆ $preferred_signature_format

$preferred_signature_format = false
protected

◆ $quiet_mode

$quiet_mode = false
private

Flag to suppress stderr from output

Voir également
self::enableQuietMode() private

Référencé par SSH2\isQuietModeEnabled().

◆ $realtime_log_file

$realtime_log_file
private

◆ $realtime_log_size

$realtime_log_size
private

◆ $realtime_log_wrap

$realtime_log_wrap
private

Real-time log file wrap boolean

Voir également
self::_append_log() private

◆ $regenerate_compression_context

$regenerate_compression_context = false
private

◆ $regenerate_decompression_context

$regenerate_decompression_context = false
private

◆ $request_pty

$request_pty = false
private

Référencé par SSH2\isPTYEnabled().

◆ $retry_connect

$retry_connect = false
private

◆ $send_id_string_first

$send_id_string_first = true
private

◆ $send_kex_first

$send_kex_first = true
private

◆ $send_seq_no

$send_seq_no = 0
private

◆ $server_channels

$server_channels = []
protected

◆ $server_host_key_algorithms

$server_host_key_algorithms = false
private

◆ $server_identifier

$server_identifier = false
protected

Référencé par SSH2\getServerIdentification().

◆ $server_public_host_key

$server_public_host_key
private

◆ $session_id

$session_id = false
private

◆ $signature

$signature = ''
private

◆ $signature_format

$signature_format = ''
private

Référencé par SSH2\getAlgorithmsNegotiated().

◆ $signature_validated

$signature_validated = false
private

◆ $smartMFA

$smartMFA = true
private

◆ $stdErrorLog

$stdErrorLog
private

Référencé par SSH2\getStdError().

◆ $term

$term = 'vt100'
private

Référencé par SSH2\setTerminal().

◆ $terminal_modes

$terminal_modes = []
private

Référencé par SSH2\exec(), et SSH2\initShell().

◆ $timeout

$timeout
protected

Timeout

Voir également
self::setTimeout() private

Référencé par SFTP\__construct(), SSH2\connect(), SSH2\exec(), SSH2\read(), et SSH2\setTimeout().

◆ $window_resize

$window_resize = 0x40000000
private

Référencé par SSH2\get_channel_packet().

◆ $window_size

◆ $window_size_client_to_server

$window_size_client_to_server = []
private

◆ $window_size_server_to_client

$window_size_server_to_client = []
protected

◆ $windowColumns

$windowColumns = 80
private

Référencé par SSH2\getWindowColumns().

◆ $windowRows

$windowRows = 24
private

Référencé par SSH2\getWindowRows().

◆ CHANNEL_AGENT_FORWARD

const CHANNEL_AGENT_FORWARD = 4

◆ CHANNEL_EXEC

const CHANNEL_EXEC = 1

◆ CHANNEL_KEEP_ALIVE

const CHANNEL_KEEP_ALIVE = 5

◆ CHANNEL_SHELL

const CHANNEL_SHELL = 2

◆ CHANNEL_SUBSYSTEM

const CHANNEL_SUBSYSTEM = 3

◆ LOG_COMPLEX

const LOG_COMPLEX = 2

Returns the message content

public

Voir également
::getLog()

◆ LOG_MAX_SIZE

const LOG_MAX_SIZE = 1048576

Make sure that the log never gets larger than this

public

Voir également
::getLog()

◆ LOG_REALTIME

const LOG_REALTIME = 3

Outputs the content real-time

public

Voir également
::getLog()

◆ LOG_REALTIME_FILE

const LOG_REALTIME_FILE = 4

Dumps the content real-time to a file

public

Voir également
::getLog()

◆ LOG_SIMPLE

const LOG_SIMPLE = 1

Returns the message numbers

public

Voir également
::getLog()

◆ MASK_CONNECTED

const MASK_CONNECTED = 0x00000002

◆ MASK_CONSTRUCTOR

const MASK_CONSTRUCTOR = 0x00000001

#-

◆ MASK_LOGIN

const MASK_LOGIN = 0x00000008

◆ MASK_LOGIN_REQ

const MASK_LOGIN_REQ = 0x00000004

◆ MASK_SHELL

const MASK_SHELL = 0x00000010

◆ MASK_WINDOW_ADJUST

const MASK_WINDOW_ADJUST = 0x00000020

◆ NET_SSH2_COMPRESSION_NONE

const NET_SSH2_COMPRESSION_NONE = 1

#+ Compression Types

private No compression

◆ NET_SSH2_COMPRESSION_ZLIB

const NET_SSH2_COMPRESSION_ZLIB = 2

zlib compression

◆ NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH

const NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH = 3

◆ READ_NEXT

const READ_NEXT = 3

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

public

Voir également
::read()

◆ READ_REGEX

const READ_REGEX = 2

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

public

Voir également
::read()

◆ READ_SIMPLE

const READ_SIMPLE = 1

Returns when a string matching $expect exactly is found

public

Voir également
::read()

La documentation de cette classe a été générée à partir du fichier suivant :