Net_SSH1

# Class: Net_SSH1

Source Location: /lib/3rdParty/phpseclib/Net/SSH1.php

### Class Overview

Pure-PHP implementation of SSHv1.

#### Author(s):

- Jim Wigginton <terrafrost@php.net>

#### Version:

- 0.1.0

### Methods

- Net_SSH1
- __destruct
- disconnect
- exec
- getHostKeyPublicExponent
- getHostKeyPublicModulus
- getLog
- getServerIdentification
- getServerKeyPublicExponent
- getServerKeyPublicModulus
- getSupportedAuthentications
- getSupportedCiphers
- interactiveRead
- interactiveWrite
- login
- read
- write

### Class Details

[line 259]
Pure-PHP implementation of SSHv1.

#### Tags:

author: | Jim Wigginton <terrafrost@php.net>
version: | 0.1.0
access: | public

[ Top ]

### Class Methods

### constructor Net_SSH1 [line 431]

`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

#### Tags:

access: | public

#### Parameters:

String | $host |
optional | $port | Integer $port
optional | $timeout | Integer $timeout
optional | $cipher | Integer $cipher

[ Top ]

### destructor __destruct [line 902]

`void __destruct( )`

Destructor.

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

#### Tags:

access: | public

[ Top ]

### method disconnect [line 889]

`void disconnect( )`

Disconnect

#### Tags:

access: | public

[ Top ]

### method exec [line 687]

`mixed exec( String $cmd, [ $block = true])`

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.

#### Tags:

see: | Net_SSH1::interactiveRead()
see: | Net_SSH1::interactiveWrite()
access: | public

#### Parameters:

String | $cmd |
| $block |

[ Top ]

### method getHostKeyPublicExponent [line 1345]

`String getHostKeyPublicExponent( [optional $raw_output = false])`

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.

#### Tags:

access: | public

#### Parameters:

optional | $raw_output | Boolean $raw_output

[ Top ]

### method getHostKeyPublicModulus [line 1360]

`String getHostKeyPublicModulus( [optional $raw_output = false])`

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.

#### Tags:

access: | public

#### Parameters:

optional | $raw_output | Boolean $raw_output

[ Top ]

### method getLog [line 1245]

`String getLog( )`

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

#### Tags:

return: | or Array
access: | public

[ Top ]

### method getServerIdentification [line 1403]

`String getServerIdentification( )`

Return the server identification.

#### Tags:

access: | public

[ Top ]

### method getServerKeyPublicExponent [line 1315]

`String getServerKeyPublicExponent( [optional $raw_output = false])`

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.

#### Tags:

access: | public

#### Parameters:

optional | $raw_output | Boolean $raw_output

[ Top ]

### method getServerKeyPublicModulus [line 1330]

`String getServerKeyPublicModulus( [optional $raw_output = false])`

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.

#### Tags:

access: | public

#### Parameters:

optional | $raw_output | Boolean $raw_output

[ Top ]

### method getSupportedAuthentications [line 1392]

`Array getSupportedAuthentications( [optional $raw_output = false])`

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

#### Tags:

access: | public

#### Parameters:

optional | $raw_output | Boolean $raw_output

[ Top ]

### method getSupportedCiphers [line 1376]

`Array getSupportedCiphers( [optional $raw_output = false])`

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

#### Tags:

access: | public

#### Parameters:

optional | $raw_output | Boolean $raw_output

[ Top ]

### method interactiveRead [line 862]

`String interactiveRead( )`

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.

#### Tags:

see: | Net_SSH1::interactiveRead()
access: | public

[ Top ]

### method interactiveWrite [line 827]

`Boolean interactiveWrite( String $cmd)`

Inputs a command into an interactive shell.

#### Tags:

see: | Net_SSH1::interactiveRead()
access: | public

#### Parameters:

String | $cmd |

[ Top ]

### method login [line 618]

`Boolean login( String $username, [optional $password = ''])`

Login

#### Tags:

access: | public

#### Parameters:

String | $username |
optional | $password | String $password

[ Top ]

### method read [line 792]

`Boolean read( String $expect, [Integer $mode = NET_SSH1_READ_SIMPLE])`

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.

#### Tags:

see: | Net_SSH1::write()
access: | public

#### Parameters:

String | $expect |
Integer | $mode |

[ Top ]

### method write [line 775]

`Boolean write( String $cmd)`

Inputs a command into an interactive shell.

#### Tags:

see: | Net_SSH1::interactiveWrite()
access: | public

#### Parameters:

String | $cmd |

[ Top ]

Documentation generated on Tue, 22 Nov 2011 16:30:12 +0100 by phpDocumentor 1.4.1