CIPHER_NONE
CIPHER_NONE
No encryption
Not supported.
Pure-PHP implementation of SSHv1.
$connectionTimeout : integer
Timeout for initial connection
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.
__construct(string $host, integer $port = 22, integer $timeout = 10, integer $cipher = self::CIPHER_3DES) : \phpseclib\Net\SSH1
Default Constructor.
Connects to an SSHv1 server
string | $host | |
integer | $port | |
integer | $timeout | |
integer | $cipher |
exec(string $cmd, $block = true) : mixed
Executes a command on a non-interactive shell, returns the output, and quits.
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:
http://www.faqs.org/docs/bashman/bashref_65.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.
string | $cmd | |
$block |
read(string $expect, integer $mode = self::READ_SIMPLE) : boolean
Returns the output of an interactive shell when there's a match for $expect
$expect can take the form of a string literal or, if $mode == self::READ_REGEX, a regular expression.
string | $expect | |
integer | $mode |
interactiveRead() : string
Returns the output of an interactive shell when no more output is available.
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 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.
_get_binary_packet() : array
Gets Binary Packets
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
_crc(string $data) : integer
Cyclic Redundancy Check (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.
string | $data |
_rsa_crypt(\phpseclib\Math\BigInteger $m, array $key) : \phpseclib\Math\BigInteger
RSA Encrypt
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...
\phpseclib\Math\BigInteger | $m | |
array | $key |
_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.
getServerKeyPublicExponent(boolean $raw_output = false) : string
Return the server key public exponent
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.
boolean | $raw_output |
getServerKeyPublicModulus(boolean $raw_output = false) : string
Return the server key public modulus
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.
boolean | $raw_output |
getHostKeyPublicExponent(boolean $raw_output = false) : string
Return the host key public exponent
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.
boolean | $raw_output |
getHostKeyPublicModulus(boolean $raw_output = false) : string
Return the host key public modulus
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.
boolean | $raw_output |
getSupportedCiphers(boolean $raw_output = false) : array
Return a list of ciphers supported by SSH1 server.
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).
boolean | $raw_output |
getSupportedAuthentications(boolean $raw_output = false) : array
Return a list of authentications supported by SSH1 server.
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).
boolean | $raw_output |