Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Net_SSH1

Class Net_SSH1

Pure-PHP implementation of SSHv1.

Package: Net\SSH1
Copyright: MMVII Jim Wigginton
License: MIT License
Author: Jim Wigginton <terrafrost@php.net>
Version: 0.1.0
Located at vendors/phpseclib/Net/SSH1.php

Methods summary

public Net_SSH1
# Net_SSH1( String $host, optional $port = 22, optional $timeout = 10, optional $cipher = NET_SSH1_CIPHER_3DES )

Default Constructor.

Default Constructor.

Connects to an SSHv1 server

Parameters

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

Returns

Net_SSH1
public Boolean
# login( String $username, optional $password = '' )

Login

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

$cmd
String
$cmd
$block

Returns

mixed

See

Net_SSH1::interactiveRead()
Net_SSH1::interactiveWrite()
public Boolean
# _initShell( )

Creates an interactive shell

Creates an interactive shell

Returns

Boolean

See

Net_SSH1::interactiveRead()
Net_SSH1::interactiveWrite()
public Boolean
# write( String $cmd )

Inputs a command into an interactive shell.

Inputs a command into an interactive shell.

Parameters

$cmd
String
$cmd

Returns

Boolean

See

Net_SSH1::interactiveWrite()
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

Net_SSH1::write()
public Boolean
# interactiveWrite( String $cmd )

Inputs a command into an interactive shell.

Inputs a command into an interactive shell.

Parameters

$cmd
String
$cmd

Returns

Boolean

See

Net_SSH1::interactiveRead()
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

Net_SSH1::interactiveRead()
public
# disconnect( )

Disconnect

Disconnect

public
# __destruct( )

Destructor.

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

Disconnect

Disconnect

Parameters

$msg
String
$msg
public Array
# _get_binary_packet( )

Gets Binary Packets

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

Returns

Array

See

Net_SSH1::_send_binary_packet()
public Boolean
# _send_binary_packet( String $data )

Sends Binary Packets

Sends Binary Packets

Returns true on success, false on failure.

Parameters

$data
String
$data

Returns

Boolean

See

Net_SSH1::_get_binary_packet()
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

$data
String
$data

Returns

Integer

See

Net_SSH1::_get_binary_packet()
Net_SSH1::_send_binary_packet()
public String
# _string_shift( String & $string, optional $index = 1 )

String Shift

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

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

$m
Math_BigInteger
$m
$key
Array
$key

Returns

Math_BigInteger

See

Net_SSH1::Net_SSH1()
public
# _define_array( )

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

Magic methods summary

Properties summary

public String $identifier
#

The SSH identifier

The SSH identifier

public Object $fsock
#

The Socket Object

The Socket Object

public Object $crypto
#

The cryptography object

The cryptography object

public Integer $bitmap
#

Execution 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

Net_SSH1::getServerKeyPublicExponent()
public String $server_key_public_modulus
#

The Server Key Public Modulus

The Server Key Public Modulus

Logged for debug purposes

See

Net_SSH1::getServerKeyPublicModulus()
public String $host_key_public_exponent
#

The Host Key Public Exponent

The Host Key Public Exponent

Logged for debug purposes

See

Net_SSH1::getHostKeyPublicExponent()
public String $host_key_public_modulus
#

The Host Key Public Modulus

The Host Key Public Modulus

Logged for debug purposes

See

Net_SSH1::getHostKeyPublicModulus()
public Array $supported_ciphers
#

Supported Ciphers

Supported Ciphers

Logged for debug purposes

See

Net_SSH1::getSupportedCiphers()
public Array $supported_authentications
#

Supported Authentications

Supported Authentications

Logged for debug purposes

See

Net_SSH1::getSupportedAuthentications()
public String $server_identification
#

Server Identification

Server Identification

See

Net_SSH1::getServerIdentification()
public Array $protocol_flags
#

Protocol Flags

Protocol Flags

See

Net_SSH1::Net_SSH1()
public Array $protocol_flag_log
#

Protocol Flag Log

Protocol Flag Log

See

Net_SSH1::getLog()
public Array $message_log
#

Message Log

Message Log

See

Net_SSH1::getLog()
public Array $interactive_buffer
#

Interactive Buffer

Interactive Buffer

See

Net_SSH1::read()
Blesta API documentation generated by ApiGen 2.8.0