313        self::CIPHER_NONE       => 
'No encryption',
 
  314        self::CIPHER_IDEA       => 
'IDEA in CFB mode',
 
  315        self::CIPHER_DES        => 
'DES in CBC mode',
 
  316        self::CIPHER_3DES       => 
'Triple-DES in CBC mode',
 
  317        self::CIPHER_BROKEN_TSS => 
'TRI\'s Simple Stream encryption CBC',
 
  318        self::CIPHER_RC4        => 
'RC4',
 
  319        self::CIPHER_BLOWFISH   => 
'Blowfish' 
  332        self::AUTH_RHOSTS     => 
'.rhosts or /etc/hosts.equiv',
 
  333        self::AUTH_RSA        => 
'pure RSA authentication',
 
  334        self::AUTH_PASSWORD   => 
'password authentication',
 
  335        self::AUTH_RHOSTS_RSA => 
'.rhosts with RSA host authentication' 
  509        $this->protocol_flags = array(
 
  510            1  => 
'NET_SSH1_MSG_DISCONNECT',
 
  511            2  => 
'NET_SSH1_SMSG_PUBLIC_KEY',
 
  512            3  => 
'NET_SSH1_CMSG_SESSION_KEY',
 
  513            4  => 
'NET_SSH1_CMSG_USER',
 
  514            9  => 
'NET_SSH1_CMSG_AUTH_PASSWORD',
 
  515            10 => 
'NET_SSH1_CMSG_REQUEST_PTY',
 
  516            12 => 
'NET_SSH1_CMSG_EXEC_SHELL',
 
  517            13 => 
'NET_SSH1_CMSG_EXEC_CMD',
 
  518            14 => 
'NET_SSH1_SMSG_SUCCESS',
 
  519            15 => 
'NET_SSH1_SMSG_FAILURE',
 
  520            16 => 
'NET_SSH1_CMSG_STDIN_DATA',
 
  521            17 => 
'NET_SSH1_SMSG_STDOUT_DATA',
 
  522            18 => 
'NET_SSH1_SMSG_STDERR_DATA',
 
  523            19 => 
'NET_SSH1_CMSG_EOF',
 
  524            20 => 
'NET_SSH1_SMSG_EXITSTATUS',
 
  525            33 => 
'NET_SSH1_CMSG_EXIT_CONFIRMATION' 
  532        $this->connectionTimeout = 
$timeout;
 
  544        $this->fsock = @fsockopen($this->host, $this->port, $errno, $errstr, $this->connectionTimeout);
 
  546            user_error(rtrim(
"Cannot connect to {$this->host}:{$this->port}. Error $errno. $errstr"));
 
  550        $this->server_identification = $init_line = fgets($this->fsock, 255);
 
  552        if (defined(
'NET_SSH1_LOGGING')) {
 
  553            $this->
_append_log(
'<-', $this->server_identification);
 
  554            $this->
_append_log(
'->', $this->identifier . 
"\r\n");
 
  557        if (!preg_match(
'#SSH-([0-9\.]+)-(.+)#', $init_line, $parts)) {
 
  558            user_error(
'Can only connect to SSH servers');
 
  561        if ($parts[1][0] != 1) {
 
  562            user_error(
"Cannot connect to SSH $parts[1] servers");
 
  566        fputs($this->fsock, $this->identifier.
"\r\n");
 
  569        if (
$response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_PUBLIC_KEY) {
 
  570            user_error(
'Expected SSH_SMSG_PUBLIC_KEY');
 
  600        foreach ($this->supported_ciphers as 
$mask => 
$name) {
 
  601            if (($supported_ciphers_mask & (1 << 
$mask)) == 0) {
 
  602                unset($this->supported_ciphers[
$mask]);
 
  607        extract(unpack(
'Nsupported_authentications_mask', $this->
_string_shift(
$response[self::RESPONSE_DATA], 4)));
 
  608        foreach ($this->supported_authentications as 
$mask => 
$name) {
 
  609            if (($supported_authentications_mask & (1 << 
$mask)) == 0) {
 
  610                unset($this->supported_authentications[
$mask]);
 
  617        $double_encrypted_session_key = $session_key ^ str_pad($session_id, 32, chr(0));
 
  620            $double_encrypted_session_key = $this->
_rsa_crypt(
 
  621                $double_encrypted_session_key,
 
  627            $double_encrypted_session_key = $this->
_rsa_crypt(
 
  628                $double_encrypted_session_key,
 
  635            $double_encrypted_session_key = $this->
_rsa_crypt(
 
  636                $double_encrypted_session_key,
 
  642            $double_encrypted_session_key = $this->
_rsa_crypt(
 
  643                $double_encrypted_session_key,
 
  652        $data = pack(
'C2a*na*N', NET_SSH1_CMSG_SESSION_KEY, 
$cipher, $anti_spoofing_cookie, 8 * strlen($double_encrypted_session_key), $double_encrypted_session_key, 0);
 
  655            user_error(
'Error sending SSH_CMSG_SESSION_KEY');
 
  664                $this->crypto = 
new DES();
 
  665                $this->crypto->disablePadding();
 
  666                $this->crypto->enableContinuousBuffer();
 
  667                $this->crypto->setKey(substr($session_key, 0,  8));
 
  671                $this->crypto->disablePadding();
 
  672                $this->crypto->enableContinuousBuffer();
 
  673                $this->crypto->setKey(substr($session_key, 0, 24));
 
  684        if (
$response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) {
 
  685            user_error(
'Expected SSH_SMSG_SUCCESS');
 
  704        if (!($this->bitmap & self::MASK_CONSTRUCTOR)) {
 
  711        if (!($this->bitmap & self::MASK_CONNECTED)) {
 
  715        $data = pack(
'CNa*', NET_SSH1_CMSG_USER, strlen($username), $username);
 
  718            user_error(
'Error sending SSH_CMSG_USER');
 
  727        if (
$response[self::RESPONSE_TYPE] == NET_SSH1_SMSG_SUCCESS) {
 
  730        } elseif (
$response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_FAILURE) {
 
  731            user_error(
'Expected SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE');
 
  738            user_error(
'Error sending SSH_CMSG_AUTH_PASSWORD');
 
  743        if (defined(
'NET_SSH1_LOGGING') && NET_SSH1_LOGGING == self::LOG_COMPLEX) {
 
  744            $data = pack(
'CNa*', NET_SSH1_CMSG_AUTH_PASSWORD, strlen(
'password'), 
'password');
 
  745            $this->message_log[count($this->message_log) - 1] = 
$data;
 
  753        if (
$response[self::RESPONSE_TYPE] == NET_SSH1_SMSG_SUCCESS) {
 
  756        } elseif (
$response[self::RESPONSE_TYPE] == NET_SSH1_SMSG_FAILURE) {
 
  759            user_error(
'Expected SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE');
 
  774        $this->timeout = $this->curTimeout = 
$timeout;
 
  797    function exec($cmd, $block = 
true)
 
  799        if (!($this->bitmap & self::MASK_LOGIN)) {
 
  800            user_error(
'Operation disallowed prior to login()');
 
  804        $data = pack(
'CNa*', NET_SSH1_CMSG_EXEC_CMD, strlen($cmd), $cmd);
 
  807            user_error(
'Error sending SSH_CMSG_EXEC_CMD');
 
  822            } 
while (is_array(
$response) && 
$response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_EXITSTATUS);
 
  825        $data = pack(
'C', NET_SSH1_CMSG_EXIT_CONFIRMATION);
 
  830        fclose($this->fsock);
 
  851        $data = pack(
'CNa*N4C', NET_SSH1_CMSG_REQUEST_PTY, strlen(
'vt100'), 
'vt100', 24, 80, 0, 0, self::TTY_OP_END);
 
  854            user_error(
'Error sending SSH_CMSG_REQUEST_PTY');
 
  863        if (
$response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) {
 
  864            user_error(
'Expected SSH_SMSG_SUCCESS');
 
  868        $data = pack(
'C', NET_SSH1_CMSG_EXEC_SHELL);
 
  871            user_error(
'Error sending SSH_CMSG_EXEC_SHELL');
 
  907    function read($expect, $mode = self::READ__SIMPLE)
 
  909        if (!($this->bitmap & self::MASK_LOGIN)) {
 
  910            user_error(
'Operation disallowed prior to login()');
 
  914        if (!($this->bitmap & self::MASK_SHELL) && !$this->
_initShell()) {
 
  915            user_error(
'Unable to initiate an interactive shell session');
 
  921            if ($mode == self::READ__REGEX) {
 
  922                preg_match($expect, $this->interactiveBuffer, $matches);
 
  923                $match = isset($matches[0]) ? $matches[0] : 
'';
 
  925            $pos = strlen($match) ? strpos($this->interactiveBuffer, $match) : 
false;
 
  926            if ($pos !== 
false) {
 
  927                return $this->
_string_shift($this->interactiveBuffer, $pos + strlen($match));
 
  932                return $this->
_string_shift($this->interactiveBuffer, strlen($this->interactiveBuffer));
 
  934            $this->interactiveBuffer.= substr(
$response[self::RESPONSE_DATA], 4);
 
  948        if (!($this->bitmap & self::MASK_LOGIN)) {
 
  949            user_error(
'Operation disallowed prior to login()');
 
  953        if (!($this->bitmap & self::MASK_SHELL) && !$this->
_initShell()) {
 
  954            user_error(
'Unable to initiate an interactive shell session');
 
  958        $data = pack(
'CNa*', NET_SSH1_CMSG_STDIN_DATA, strlen($cmd), $cmd);
 
  961            user_error(
'Error sending SSH_CMSG_STDIN');
 
  983        if (!($this->bitmap & self::MASK_LOGIN)) {
 
  984            user_error(
'Operation disallowed prior to login()');
 
  988        if (!($this->bitmap & self::MASK_SHELL) && !$this->
_initShell()) {
 
  989            user_error(
'Unable to initiate an interactive shell session');
 
  993        $read = array($this->fsock);
 
  994        $write = $except = 
null;
 
  995        if (stream_select($read, $write, $except, 0)) {
 
  997            return substr(
$response[self::RESPONSE_DATA], 4);
 
 1034        if ($this->bitmap) {
 
 1035            $data = pack(
'C', NET_SSH1_CMSG_EOF);
 
 1050            $data = pack(
'CNa*', NET_SSH1_MSG_DISCONNECT, strlen($msg), $msg);
 
 1053            fclose($this->fsock);
 
 1072        if (feof($this->fsock)) {
 
 1077        if ($this->curTimeout) {
 
 1078            $read = array($this->fsock);
 
 1079            $write = $except = 
null;
 
 1081            $start = strtok(microtime(), 
' ') + strtok(
''); 
 
 1082            $sec = floor($this->curTimeout);
 
 1083            $usec = 1000000 * ($this->curTimeout - $sec);
 
 1085            if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) {
 
 1089            $elapsed = strtok(microtime(), 
' ') + strtok(
'') - 
$start;
 
 1090            $this->curTimeout-= $elapsed;
 
 1093        $start = strtok(microtime(), 
' ') + strtok(
''); 
 
 1094        $temp = unpack(
'Nlength', fread($this->fsock, 4));
 
 1096        $padding_length = 8 - ($temp[
'length'] & 7);
 
 1097        $length = $temp[
'length'] + $padding_length;
 
 1100        while ($length > 0) {
 
 1101            $temp = fread($this->fsock, $length);
 
 1103            $length-= strlen($temp);
 
 1105        $stop = strtok(microtime(), 
' ') + strtok(
'');
 
 1107        if (strlen($raw) && $this->crypto !== 
false) {
 
 1108            $raw = $this->crypto->decrypt($raw);
 
 1111        $padding = substr($raw, 0, $padding_length);
 
 1112        $type = $raw[$padding_length];
 
 1113        $data = substr($raw, $padding_length + 1, -4);
 
 1115        $temp = unpack(
'Ncrc', substr($raw, -4));
 
 1124        if (defined(
'NET_SSH1_LOGGING')) {
 
 1125            $temp = isset($this->protocol_flags[
$type]) ? $this->protocol_flags[
$type] : 
'UNKNOWN';
 
 1126            $temp = 
'<- ' . $temp .
 
 1127                    ' (' . round($stop - 
$start, 4) . 
's)';
 
 1132            self::RESPONSE_TYPE => 
$type,
 
 1133            self::RESPONSE_DATA => 
$data 
 1149        if (feof($this->fsock)) {
 
 1154        $length = strlen(
$data) + 4;
 
 1162        if ($this->crypto !== 
false) {
 
 1166        $packet = pack(
'Na*', $length, 
$data);
 
 1168        $start = strtok(microtime(), 
' ') + strtok(
''); 
 
 1169        $result = strlen($packet) == fputs($this->fsock, $packet);
 
 1170        $stop = strtok(microtime(), 
' ') + strtok(
'');
 
 1172        if (defined(
'NET_SSH1_LOGGING')) {
 
 1173            $temp = isset($this->protocol_flags[ord($orig[0])]) ? $this->protocol_flags[ord($orig[0])] : 
'UNKNOWN';
 
 1174            $temp = 
'-> ' . $temp .
 
 1175                    ' (' . round($stop - 
$start, 4) . 
's)';
 
 1197        static $crc_lookup_table = array(
 
 1198            0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
 
 1199            0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
 
 1200            0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
 
 1201            0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
 
 1202            0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
 
 1203            0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
 
 1204            0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
 
 1205            0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
 
 1206            0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
 
 1207            0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
 
 1208            0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
 
 1209            0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
 
 1210            0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
 
 1211            0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
 
 1212            0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
 
 1213            0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
 
 1214            0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
 
 1215            0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
 
 1216            0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
 
 1217            0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
 
 1218            0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
 
 1219            0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
 
 1220            0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
 
 1221            0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
 
 1222            0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
 
 1223            0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
 
 1224            0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
 
 1225            0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
 
 1226            0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
 
 1227            0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
 
 1228            0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
 
 1229            0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
 
 1230            0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
 
 1231            0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
 
 1232            0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
 
 1233            0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
 
 1234            0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
 
 1235            0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
 
 1236            0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
 
 1237            0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
 
 1238            0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
 
 1239            0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
 
 1240            0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
 
 1241            0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
 
 1242            0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
 
 1243            0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
 
 1244            0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
 
 1245            0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
 
 1246            0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
 
 1247            0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
 
 1248            0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
 
 1249            0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
 
 1250            0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
 
 1251            0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
 
 1252            0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
 
 1253            0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
 
 1254            0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
 
 1255            0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
 
 1256            0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
 
 1257            0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
 
 1258            0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
 
 1259            0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
 
 1260            0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
 
 1261            0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
 
 1267        $length = strlen(
$data);
 
 1269        for (
$i=0; 
$i<$length; 
$i++) {
 
 1274            $crc = (($crc >> 8) & 0x00FFFFFF) ^ $crc_lookup_table[($crc & 0xFF) ^ ord(
$data[
$i])];
 
 1294        $substr = substr($string, 0, 
$index);
 
 1295        $string = substr($string, 
$index);
 
 1334        $modulus = 
$key[1]->toBytes();
 
 1335        $length = strlen($modulus) - strlen(
$m) - 3;
 
 1337        while (strlen($random) != $length) {
 
 1339            $block = str_replace(
"\x00", 
'', $block);
 
 1342        $temp = chr(0) . chr(2) . $random . chr(0) . 
$m;
 
 1347        return $m->toBytes();
 
 1362        $args = func_get_args();
 
 1363        foreach ($args as $arg) {
 
 1364            foreach ($arg as 
$key => $value) {
 
 1365                if (!defined($value)) {
 
 1366                    define($value, 
$key);
 
 1384        if (!defined(
'NET_SSH1_LOGGING')) {
 
 1388        switch (NET_SSH1_LOGGING) {
 
 1390                return $this->message_number_log;
 
 1393                return $this->
_format_log($this->message_log, $this->protocol_flags_log);
 
 1412            $output.= $message_number_log[
$i] . 
"\r\n";
 
 1416                if (strlen($current_log)) {
 
 1417                    $output.= str_pad(dechex($j), 7, 
'0', STR_PAD_LEFT) . 
'0  ';
 
 1419                $fragment = $this->
_string_shift($current_log, $this->log_short_width);
 
 1420                $hex = substr(preg_replace_callback(
'#.#s', array($this, 
'_format_log_helper'), $fragment), strlen($this->log_boundary));
 
 1424                $raw = preg_replace(
'#[^\x20-\x7E]|<#', 
'.', $fragment);
 
 1425                $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, 
' ') . $raw . 
"\r\n";
 
 1427            } 
while (strlen($current_log));
 
 1445        return $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, 
'0', STR_PAD_LEFT);
 
 1460        return $raw_output ? $this->server_key_public_exponent->toBytes() : $this->server_key_public_exponent->toString();
 
 1475        return $raw_output ? $this->server_key_public_modulus->toBytes() : $this->server_key_public_modulus->toString();
 
 1490        return $raw_output ? $this->host_key_public_exponent->toBytes() : $this->host_key_public_exponent->toString();
 
 1505        return $raw_output ? $this->host_key_public_modulus->toBytes() : $this->host_key_public_modulus->toString();
 
 1521        return $raw_output ? array_keys($this->supported_ciphers) : array_values($this->supported_ciphers);
 
 1537        return $raw_output ? array_keys($this->supported_authentications) : array_values($this->supported_authentications);
 
 1548        return rtrim($this->server_identification);
 
 1561        switch (NET_SSH1_LOGGING) {
 
 1570                $this->log_size+= strlen(
$message);
 
 1572                while ($this->log_size > self::LOG_MAX_SIZE) {
 
 1573                    $this->log_size-= strlen(array_shift($this->message_log));
 
 1574                    array_shift($this->protocol_flags_log);
 
 1590                if (!isset($this->realtime_log_file)) {
 
 1594                    $this->realtime_log_file = $fp;
 
 1596                if (!is_resource($this->realtime_log_file)) {
 
 1600                if ($this->realtime_log_wrap) {
 
 1601                    $temp = 
"<<< START >>>\r\n";
 
 1603                    fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp));
 
 1605                $this->realtime_log_size+= strlen($entry);
 
 1606                if ($this->realtime_log_size > self::LOG_MAX_SIZE) {
 
 1607                    fseek($this->realtime_log_file, 0);
 
 1608                    $this->realtime_log_size = strlen($entry);
 
 1609                    $this->realtime_log_wrap = 
true;
 
 1611                fputs($this->realtime_log_file, $entry);
 
An exception for terminatinating execution or to throw for unit testing.
static string($length)
Generate a random string.
const MODE_3CBC
Encrypt / decrypt using inner chaining.
getHostKeyPublicModulus($raw_output=false)
Return the host key public modulus.
_define_array()
Define Array.
_crc($data)
Cyclic Redundancy Check (CRC)
const READ_REGEX
Returns when a string matching the regular expression $expect is found.
const LOG_REALTIME
Outputs the content real-time.
const AUTH_PASSWORD
password authentication
setTimeout($timeout)
Set Timeout.
$curTimeout
Current Timeout.
const CIPHER_3DES
Triple-DES in CBC mode.
const AUTH_RHOSTS_RSA
.rhosts with RSA host authentication
getHostKeyPublicExponent($raw_output=false)
Return the host key public exponent.
write($cmd)
Inputs a command into an interactive shell.
const AUTH_RSA
pure RSA authentication
const LOG_COMPLEX
Returns the message content.
getSupportedAuthentications($raw_output=false)
Return a list of authentications supported by SSH1 server.
const CIPHER_IDEA
IDEA in CFB mode.
read($expect, $mode=self::READ__SIMPLE)
Returns the output of an interactive shell when there's a match for $expect.
$host_key_public_exponent
_format_log($message_log, $message_number_log)
Formats a log for printing.
const LOG_REALTIME_FILE
Dumps the content real-time to a file.
_initShell()
Creates an interactive shell.
__construct($host, $port=22, $timeout=10, $cipher=self::CIPHER_3DES)
Default Constructor.
$server_key_public_modulus
const CIPHER_NONE
#+ Encryption Methods
$log_short_width
Log Short Width.
$log_long_width
Log Long Width.
interactiveRead()
Returns the output of an interactive shell when no more output is available.
interactiveWrite($cmd)
Inputs a command into an interactive shell.
_get_binary_packet()
Gets Binary Packets.
const RESPONSE_DATA
The Response Data.
_disconnect($msg='Client Quit')
Disconnect.
const MASK_CONSTRUCTOR
#+ Execution Bitmap Masks
const CIPHER_DES
DES in CBC mode.
getServerKeyPublicModulus($raw_output=false)
Return the server key public modulus.
getLog()
Returns a log of the packets that have been sent and received.
login($username, $password='')
Login.
_append_log($protocol_flags, $message)
Logs data packets.
$log_boundary
Log Boundary.
_connect()
Connect to an SSHv1 server.
exec($cmd, $block=true)
Executes a command on a non-interactive shell, returns the output, and quits.
const CIPHER_BROKEN_TSS
TRI's Simple Stream encryption CBC.
getServerKeyPublicExponent($raw_output=false)
Return the server key public exponent.
$server_key_public_exponent
_string_shift(&$string, $index=1)
String Shift.
$supported_authentications
getSupportedCiphers($raw_output=false)
Return a list of ciphers supported by SSH1 server.
const CIPHER_BLOWFISH
Blowfish.
_send_binary_packet($data)
Sends Binary Packets.
_format_log_helper($matches)
Helper function for _format_log.
getServerIdentification()
Return the server identification.
_rsa_crypt($m, $key)
RSA Encrypt.
catch(Exception $e) $message
Pure-PHP arbitrary precision integer arithmetic library.
Pure-PHP implementation of DES.
Pure-PHP implementation of SSHv1.
Pure-PHP implementation of Triple DES.