public
Net_SSH1
|
#
Net_SSH1( String $host, optional $port = 22, optional $timeout = 10, optional $cipher = NET_SSH1_CIPHER_3DES )
Default Constructor.
Connects to an SSHv1 server
Parameters
- $host
String $host
- $port
optional Integer $port
- $timeout
optional Integer $timeout
- $cipher
optional Integer $cipher
Returns
|
public
Boolean
|
#
login( String $username, optional $password = '' )
Login
Parameters
- $username
String $username
- $password
optional String $password
Returns
Boolean
|
public
mixed
|
#
exec( String $cmd, mixed $block = true )
Executes a command on a non-interactive shell, returns the output, and
quits.
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 Net_SSH1 object will need to be
created.
Returns false on failure and the output, otherwise.
Parameters
Returns
mixed
See
|
public
Boolean
|
#
_initShell( )
Creates an interactive shell
Creates an interactive shell
Returns
Boolean
See
|
public
Boolean
|
#
write( String $cmd )
Inputs a command into an interactive shell.
Inputs a command into an interactive shell.
Parameters
Returns
Boolean
See
|
public
Boolean
|
#
read( String $expect, Integer $mode = NET_SSH1_READ_SIMPLE )
Returns the output of an interactive shell when there's a match for
$expect
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 ==
NET_SSH1_READ_REGEX, a regular expression.
Parameters
- $expect
String $expect
- $mode
Integer $mode
Returns
Boolean
See
|
public
Boolean
|
#
interactiveWrite( String $cmd )
Inputs a command into an interactive shell.
Inputs a command into an interactive shell.
Parameters
Returns
Boolean
See
|
public
String
|
#
interactiveRead( )
Returns the output of an interactive shell when no more output is
available.
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.
Returns
String
See
|
public
|
|
public
|
#
__destruct( )
Destructor.
Will be called, automatically, if you're supporting just PHP5. If you're
supporting PHP4, you'll need to call disconnect().
|
public
|
#
_disconnect( String $msg = 'Client Quit' )
|
public
Array
|
|
public
Boolean
|
#
_send_binary_packet( String $data )
Sends Binary Packets
Returns true on success, false on failure.
Parameters
Returns
Boolean
See
|
public
Integer
|
#
_crc( String $data )
Cyclic Redundancy Check (CRC)
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.
Parameters
Returns
Integer
See
|
public
String
|
#
_string_shift( String & $string, optional $index = 1 )
String Shift
Inspired by array_shift
Parameters
- $string
String $string
- $index
optional Integer $index
Returns
String
|
public
Math_BigInteger
|
#
_rsa_crypt( Math_BigInteger $m, Array $key )
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...
Parameters
Returns
See
|
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.
|
public
String
|
#
getLog( )
Returns a log of the packets that have been sent and received.
Returns a log of the packets that have been sent and received.
Returns a string if NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX, an array if
NET_SSH2_LOGGING == NET_SSH2_LOG_SIMPLE and false if
!defined('NET_SSH2_LOGGING')
Returns
String or Array
|
public
String
|
#
_format_log( Array $message_log, Array $message_number_log )
Formats a log for printing
Formats a log for printing
Parameters
- $message_log
Array $message_log
- $message_number_log
Array $message_number_log
Returns
String
|
public
String
|
#
getServerKeyPublicExponent( optional $raw_output = false )
Return the server key public exponent
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.
Parameters
- $raw_output
optional Boolean $raw_output
Returns
String
|
public
String
|
#
getServerKeyPublicModulus( optional $raw_output = false )
Return the server key public modulus
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.
Parameters
- $raw_output
optional Boolean $raw_output
Returns
String
|
public
String
|
#
getHostKeyPublicExponent( optional $raw_output = false )
Return the host key public exponent
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.
Parameters
- $raw_output
optional Boolean $raw_output
Returns
String
|
public
String
|
#
getHostKeyPublicModulus( optional $raw_output = false )
Return the host key public modulus
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.
Parameters
- $raw_output
optional Boolean $raw_output
Returns
String
|
public
Array
|
#
getSupportedCiphers( optional $raw_output = false )
Return a list of ciphers supported by SSH1 server.
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(NET_SSH1_CIPHER_3DES).
Parameters
- $raw_output
optional Boolean $raw_output
Returns
Array
|
public
Array
|
#
getSupportedAuthentications( optional $raw_output = false )
Return a list of authentications supported by SSH1 server.
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(NET_SSH1_AUTH_PASSWORD).
Parameters
- $raw_output
optional Boolean $raw_output
Returns
Array
|
public
String
|
#
getServerIdentification( )
Return the server identification.
Return the server identification.
Returns
String
|
public
String
|
$identifier |
|
public
Object
|
$fsock |
|
public
Object
|
$crypto |
|
public
Integer
|
$bitmap |
#
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.
|
public
String
|
$server_key_public_exponent |
#
The Server Key Public Exponent
The Server Key Public Exponent
Logged for debug purposes
See
|
public
String
|
$server_key_public_modulus |
#
The Server Key Public Modulus
The Server Key Public Modulus
Logged for debug purposes
See
|
public
String
|
$host_key_public_exponent |
#
The Host Key Public Exponent
The Host Key Public Exponent
Logged for debug purposes
See
|
public
String
|
$host_key_public_modulus |
#
The Host Key Public Modulus
The Host Key Public Modulus
Logged for debug purposes
See
|
public
Array
|
$supported_ciphers |
#
Supported Ciphers
Logged for debug purposes
See
|
public
Array
|
$supported_authentications |
#
Supported Authentications
Supported Authentications
Logged for debug purposes
See
|
public
String
|
$server_identification |
#
Server Identification
See
|
public
Array
|
$protocol_flags |
|
public
Array
|
$protocol_flag_log |
|
public
Array
|
$message_log |
|
public
Array
|
$interactive_buffer |
|