PHP 클래스 phpseclib\Net\SSH1

저자: Jim Wigginton ([email protected])
파일 보기 프로젝트 열기: phpseclib/phpseclib

공개 프로퍼티들

프로퍼티 타입 설명
$bitmap integer 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.
$cipher integer Default cipher
$connectionTimeout integer Set by the constructor call. Calling setTimeout() is optional. If it's not called functions like exec() won't timeout unless some PHP setting forces it too. The timeout specified in the constructor, however, is non-optional. There will be a timeout, whether or not you set it. If you don't it'll be 10 seconds. It is used by fsockopen() in that function.
$crypto object The cryptography object
$curTimeout Current Timeout
$fsock object The Socket Object
$host string Hostname
$host_key_public_exponent string Logged for debug purposes
$host_key_public_modulus string Logged for debug purposes
$identifier string The SSH identifier
$interactiveBuffer array Interactive Buffer
$log_boundary Log Boundary
$log_long_width Log Long Width
$log_short_width Log Short Width
$message_log array Message Log
$port integer Port Number
$protocol_flag_log array Protocol Flag Log
$protocol_flags array Protocol Flags
$realtime_log_file resource Real-time log file pointer
$realtime_log_size integer Real-time log file size
$realtime_log_wrap boolean Real-time log file wrap boolean
$server_identification string Server Identification
$server_key_public_exponent string Logged for debug purposes
$server_key_public_modulus string Logged for debug purposes
$supported_authentications array Logged for debug purposes
$supported_ciphers array Logged for debug purposes
$timeout Timeout

공개 메소드들

메소드 설명
__construct ( string $host, integer $port = 22, integer $timeout = 10, integer $cipher = self::CIPHER_3DES ) : SSH1 Default Constructor.
__destruct ( ) Destructor.
_append_log ( $protocol_flags, $message ) Logs data packets
_connect ( ) : boolean Connect to an SSHv1 server
_crc ( string $data ) : integer Cyclic Redundancy Check (CRC)
_define_array ( ) Define Array
_disconnect ( string $msg = 'Client Quit' ) Disconnect
_format_log ( array $message_log, array $message_number_log ) : string Formats a log for printing
_format_log_helper ( array $matches ) : string Helper function for _format_log
_get_binary_packet ( ) : array Gets Binary Packets
_initShell ( ) : boolean Creates an interactive shell
_rsa_crypt ( phpseclib\Math\BigInteger $m, array $key ) : phpseclib\Math\BigInteger RSA Encrypt
_send_binary_packet ( string $data ) : boolean Sends Binary Packets
disconnect ( ) Disconnect
exec ( string $cmd, $block = true ) : mixed Executes a command on a non-interactive shell, returns the output, and quits.
getHostKeyPublicExponent ( boolean $raw_output = false ) : string Return the host key public exponent
getHostKeyPublicModulus ( boolean $raw_output = false ) : string Return the host key public modulus
getLog ( ) : array | false | string Returns a log of the packets that have been sent and received.
getServerIdentification ( ) : string Return the server identification.
getServerKeyPublicExponent ( boolean $raw_output = false ) : string Return the server key public exponent
getServerKeyPublicModulus ( boolean $raw_output = false ) : string Return the server key public modulus
getSupportedAuthentications ( boolean $raw_output = false ) : array Return a list of authentications supported by SSH1 server.
getSupportedCiphers ( boolean $raw_output = false ) : array Return a list of ciphers supported by SSH1 server.
interactiveRead ( ) : string Returns the output of an interactive shell when no more output is available.
interactiveWrite ( string $cmd ) : boolean Inputs a command into an interactive shell.
login ( string $username, string $password = '' ) : boolean Login
read ( string $expect, integer $mode = self::READ__SIMPLE ) : boolean Returns the output of an interactive shell when there's a match for $expect
setTimeout ( mixed $timeout ) Set Timeout
write ( string $cmd ) : boolean Inputs a command into an interactive shell.

메소드 상세

__construct() 공개 메소드

Connects to an SSHv1 server
public __construct ( string $host, integer $port = 22, integer $timeout = 10, integer $cipher = self::CIPHER_3DES ) : SSH1
$host string
$port integer
$timeout integer
$cipher integer
리턴 SSH1

__destruct() 공개 메소드

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

_append_log() 공개 메소드

Makes sure that only the last 1MB worth of packets will be logged
public _append_log ( $protocol_flags, $message )

_connect() 공개 메소드

Connect to an SSHv1 server
public _connect ( ) : boolean
리턴 boolean

_crc() 공개 메소드

PHP's crc32 function is implemented slightly differently than the one that SSH v1 uses, so we've reimplemented it. A more detailed discussion of the differences can be found after $crc_lookup_table's initialization.
또한 보기: self::_get_binary_packet()
또한 보기: self::_send_binary_packet()
public _crc ( string $data ) : integer
$data string
리턴 integer

_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.
public _define_array ( )

_disconnect() 공개 메소드

Disconnect
public _disconnect ( string $msg = 'Client Quit' )
$msg string

_format_log() 공개 메소드

Formats a log for printing
public _format_log ( array $message_log, array $message_number_log ) : string
$message_log array
$message_number_log array
리턴 string

_format_log_helper() 공개 메소드

For use with preg_replace_callback()
public _format_log_helper ( array $matches ) : string
$matches array
리턴 string

_get_binary_packet() 공개 메소드

See 'The Binary Packet Protocol' of protocol-1.5.txt for more info. Also, this function could be improved upon by adding detection for the following exploit: http://www.securiteam.com/securitynews/5LP042K3FY.html
또한 보기: self::_send_binary_packet()
public _get_binary_packet ( ) : array
리턴 array

_initShell() 공개 메소드

Creates an interactive shell
또한 보기: self::interactiveRead()
또한 보기: self::interactiveWrite()
public _initShell ( ) : boolean
리턴 boolean

_rsa_crypt() 공개 메소드

Returns mod(pow($m, $e), $n), where $n should be the product of two (large) primes $p and $q and where $e should be a number with the property that gcd($e, ($p - 1) * ($q - 1)) == 1. Could just make anything that calls this call modexp, instead, but I think this makes things clearer, maybe...
또한 보기: self::__construct()
public _rsa_crypt ( phpseclib\Math\BigInteger $m, array $key ) : phpseclib\Math\BigInteger
$m phpseclib\Math\BigInteger
$key array
리턴 phpseclib\Math\BigInteger

_send_binary_packet() 공개 메소드

Returns true on success, false on failure.
또한 보기: self::_get_binary_packet()
public _send_binary_packet ( string $data ) : boolean
$data string
리턴 boolean

disconnect() 공개 메소드

Disconnect
public disconnect ( )

exec() 공개 메소드

An SSH1 server will close the connection after a command has been executed on a non-interactive shell. SSH2 servers don't, however, this isn't an SSH2 client. The way this works, on the server, is by initiating a shell with the -s option, as discussed in the following links: {@link http://www.faqs.org/docs/bashman/bashref_65.html http://www.faqs.org/docs/bashman/bashref_65.html} {@link http://www.faqs.org/docs/bashman/bashref_62.html http://www.faqs.org/docs/bashman/bashref_62.html} To execute further commands, a new \phpseclib\Net\SSH1 object will need to be created. Returns false on failure and the output, otherwise.
또한 보기: self::interactiveRead()
또한 보기: self::interactiveWrite()
public exec ( string $cmd, $block = true ) : mixed
$cmd string
리턴 mixed

getHostKeyPublicExponent() 공개 메소드

Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, the raw bytes. This behavior is similar to PHP's md5() function.
public getHostKeyPublicExponent ( boolean $raw_output = false ) : string
$raw_output boolean
리턴 string

getHostKeyPublicModulus() 공개 메소드

Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, the raw bytes. This behavior is similar to PHP's md5() function.
public getHostKeyPublicModulus ( boolean $raw_output = false ) : string
$raw_output boolean
리턴 string

getLog() 공개 메소드

Returns a string if NET_SSH1_LOGGING == self::LOG_COMPLEX, an array if NET_SSH1_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SSH1_LOGGING')
public getLog ( ) : array | false | string
리턴 array | false | string

getServerIdentification() 공개 메소드

Return the server identification.
public getServerIdentification ( ) : string
리턴 string

getServerKeyPublicExponent() 공개 메소드

Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, the raw bytes. This behavior is similar to PHP's md5() function.
public getServerKeyPublicExponent ( boolean $raw_output = false ) : string
$raw_output boolean
리턴 string

getServerKeyPublicModulus() 공개 메소드

Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, the raw bytes. This behavior is similar to PHP's md5() function.
public getServerKeyPublicModulus ( boolean $raw_output = false ) : string
$raw_output boolean
리턴 string

getSupportedAuthentications() 공개 메소드

Just because a cipher is supported by an SSH1 server doesn't mean it's supported by this library. If $raw_output is set to true, returns, instead, an array of constants. ie. instead of array('password authentication'), you'll get array(self::AUTH_PASSWORD).
public getSupportedAuthentications ( boolean $raw_output = false ) : array
$raw_output boolean
리턴 array

getSupportedCiphers() 공개 메소드

Just because a cipher is supported by an SSH1 server doesn't mean it's supported by this library. If $raw_output is set to true, returns, instead, an array of constants. ie. instead of array('Triple-DES in CBC mode'), you'll get array(self::CIPHER_3DES).
public getSupportedCiphers ( boolean $raw_output = false ) : array
$raw_output boolean
리턴 array

interactiveRead() 공개 메소드

Requires PHP 4.3.0 or later due to the use of the stream_select() function. If you see stuff like "^[[00m", you're seeing ANSI escape codes. According to {@link http://support.microsoft.com/kb/101875 How to Enable ANSI.SYS in a Command Window}, "Windows NT does not support ANSI escape sequences in Win32 Console applications", so if you're a Windows user, there's not going to be much recourse.
또한 보기: self::interactiveRead()
public interactiveRead ( ) : string
리턴 string

interactiveWrite() 공개 메소드

Inputs a command into an interactive shell.
또한 보기: self::interactiveRead()
public interactiveWrite ( string $cmd ) : boolean
$cmd string
리턴 boolean

login() 공개 메소드

Login
public login ( string $username, string $password = '' ) : boolean
$username string
$password string
리턴 boolean

read() 공개 메소드

$expect can take the form of a string literal or, if $mode == self::READ__REGEX, a regular expression.
또한 보기: self::write()
public read ( string $expect, integer $mode = self::READ__SIMPLE ) : boolean
$expect string
$mode integer
리턴 boolean

setTimeout() 공개 메소드

$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.
public setTimeout ( mixed $timeout )
$timeout mixed

write() 공개 메소드

Inputs a command into an interactive shell.
또한 보기: self::interactiveWrite()
public write ( string $cmd ) : boolean
$cmd string
리턴 boolean

프로퍼티 상세

$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.
public int $bitmap
리턴 integer

$cipher 공개적으로 프로퍼티

Default cipher
또한 보기: self::__construct()
또한 보기: self::_connect()
public int $cipher
리턴 integer

$connectionTimeout 공개적으로 프로퍼티

Set by the constructor call. Calling setTimeout() is optional. If it's not called functions like exec() won't timeout unless some PHP setting forces it too. The timeout specified in the constructor, however, is non-optional. There will be a timeout, whether or not you set it. If you don't it'll be 10 seconds. It is used by fsockopen() in that function.
또한 보기: self::__construct()
또한 보기: self::_connect()
public int $connectionTimeout
리턴 integer

$crypto 공개적으로 프로퍼티

The cryptography object
public object $crypto
리턴 object

$curTimeout 공개적으로 프로퍼티

Current Timeout
또한 보기: self::_get_channel_packet()
public $curTimeout

$fsock 공개적으로 프로퍼티

The Socket Object
public object $fsock
리턴 object

$host 공개적으로 프로퍼티

Hostname
또한 보기: self::__construct()
또한 보기: self::_connect()
public string $host
리턴 string

$host_key_public_exponent 공개적으로 프로퍼티

Logged for debug purposes
또한 보기: self::getHostKeyPublicExponent()
public string $host_key_public_exponent
리턴 string

$host_key_public_modulus 공개적으로 프로퍼티

Logged for debug purposes
또한 보기: self::getHostKeyPublicModulus()
public string $host_key_public_modulus
리턴 string

$identifier 공개적으로 프로퍼티

The SSH identifier
public string $identifier
리턴 string

$interactiveBuffer 공개적으로 프로퍼티

Interactive Buffer
또한 보기: self::read()
public array $interactiveBuffer
리턴 array

$log_boundary 공개적으로 프로퍼티

Log Boundary
또한 보기: self::_format_log()
public $log_boundary

$log_long_width 공개적으로 프로퍼티

Log Long Width
또한 보기: self::_format_log()
public $log_long_width

$log_short_width 공개적으로 프로퍼티

Log Short Width
또한 보기: self::_format_log()
public $log_short_width

$message_log 공개적으로 프로퍼티

Message Log
또한 보기: self::getLog()
public array $message_log
리턴 array

$port 공개적으로 프로퍼티

Port Number
또한 보기: self::__construct()
또한 보기: self::_connect()
public int $port
리턴 integer

$protocol_flag_log 공개적으로 프로퍼티

Protocol Flag Log
또한 보기: self::getLog()
public array $protocol_flag_log
리턴 array

$protocol_flags 공개적으로 프로퍼티

Protocol Flags
또한 보기: self::__construct()
public array $protocol_flags
리턴 array

$realtime_log_file 공개적으로 프로퍼티

Real-time log file pointer
또한 보기: self::_append_log()
public resource $realtime_log_file
리턴 resource

$realtime_log_size 공개적으로 프로퍼티

Real-time log file size
또한 보기: self::_append_log()
public int $realtime_log_size
리턴 integer

$realtime_log_wrap 공개적으로 프로퍼티

Real-time log file wrap boolean
또한 보기: self::_append_log()
public bool $realtime_log_wrap
리턴 boolean

$server_identification 공개적으로 프로퍼티

Server Identification
또한 보기: self::getServerIdentification()
public string $server_identification
리턴 string

$server_key_public_exponent 공개적으로 프로퍼티

Logged for debug purposes
또한 보기: self::getServerKeyPublicExponent()
public string $server_key_public_exponent
리턴 string

$server_key_public_modulus 공개적으로 프로퍼티

Logged for debug purposes
또한 보기: self::getServerKeyPublicModulus()
public string $server_key_public_modulus
리턴 string

$supported_authentications 공개적으로 프로퍼티

Logged for debug purposes
또한 보기: self::getSupportedAuthentications()
public array $supported_authentications
리턴 array

$supported_ciphers 공개적으로 프로퍼티

Logged for debug purposes
또한 보기: self::getSupportedCiphers()
public array $supported_ciphers
리턴 array

$timeout 공개적으로 프로퍼티

Timeout
또한 보기: self::setTimeout()
public $timeout