Net_SSH2

# Procedural File: SSH2.php

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

## Classes:

Net_SSH2
  Pure-PHP implementation of SSHv2.

## Page Details:

Pure-PHP implementation of SSHv2.

PHP versions 4 and 5

Here are some examples of how to use this library:

1. <?php
2. include('Net/SSH2.php');
4. $ssh = new Net_SSH2 ('www.domain.tld');
5. if (!$ssh->login('username', 'password')) {
6. exit('Login Failed');
7. }
9. echo $ssh-> exec ('pwd');
10. echo $ssh-> exec ('ls -la');
11. ?>

1. <?php
2. include('Crypt/RSA.php');
3. include('Net/SSH2.php');
5. $key = new Crypt_RSA ();
6. //$key->setPassword('whatever');
7. $key->loadKey( file_get_contents ('privatekey'));
9. $ssh = new Net_SSH2 ('www.domain.tld');
10. if (!$ssh->login('username', $key)) {
11. exit('Login Failed');
12. }
14. echo $ssh->read('username@username:~$');
15. $ssh->write("ls -la\n");
16. echo $ssh->read('username@username:~$');
17. ?>

LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#### Tags:

author: | Jim Wigginton <terrafrost@php.net>
version: | $Id: SSH2.php,v 1.3 2011/05/31 16:32:25 gruberroland Exp $
copyright: | MMVII Jim Wigginton
link: | http://phpseclib.sourceforge.net
license: | MIT License

#### Includes:

require_once('Crypt/RC4.php') [line 96]
Include Crypt_RC4
require_once('Crypt/AES.php') [line 101]
Include Crypt_AES
require_once('Math/BigInteger.php') [line 76]
Include Math_BigInteger

Used to do Diffie-Hellman key exchange and DSA/RSA signature verification.

require_once('Crypt/TripleDES.php') [line 91]
Include Crypt_TripleDES
require_once('Crypt/Random.php') [line 81]
Include Crypt_Random
require_once('Crypt/Hash.php') [line 86]
Include Crypt_Hash

### NET_SSH2_LOG_COMPLEX [line 145]

`NET_SSH2_LOG_COMPLEX = 2`

Returns the message content

#### Tags:

see: | Net_SSH2::getLog()
access: | public

[ Top ]

### NET_SSH2_LOG_SIMPLE [line 141]

`NET_SSH2_LOG_SIMPLE = 1`

Returns the message numbers

#### Tags:

see: | Net_SSH2::getLog()
access: | public

[ Top ]

### NET_SSH2_READ_REGEX [line 159]

`NET_SSH2_READ_REGEX = 2`

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

#### Tags:

see: | Net_SSH2::read()
access: | public

[ Top ]

### NET_SSH2_READ_SIMPLE [line 155]

`NET_SSH2_READ_SIMPLE = 1`

Returns when a string matching $expect exactly is found

#### Tags:

see: | Net_SSH2::read()
access: | public

[ Top ]

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