mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-18 19:25:13 +00:00
Fixed /e preg_replace modifier exactly like in 0dc8b27a6a
This commit is contained in:
parent
c5f8bab065
commit
ea8cadddad
@ -434,6 +434,30 @@ class Net_SSH1
|
|||||||
*/
|
*/
|
||||||
var $curTimeout;
|
var $curTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log Boundary
|
||||||
|
*
|
||||||
|
* @see Net_SSH2::_format_log
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $log_boundary = ':';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log Long Width
|
||||||
|
*
|
||||||
|
* @see Net_SSH2::_format_log
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $log_long_width = 65;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log Short Width
|
||||||
|
*
|
||||||
|
* @see Net_SSH2::_format_log
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $log_short_width = 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
*
|
*
|
||||||
@ -1351,8 +1375,6 @@ class Net_SSH1
|
|||||||
*/
|
*/
|
||||||
function _format_log($message_log, $message_number_log)
|
function _format_log($message_log, $message_number_log)
|
||||||
{
|
{
|
||||||
static $boundary = ':', $long_width = 65, $short_width = 16;
|
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
for ($i = 0; $i < count($message_log); $i++) {
|
for ($i = 0; $i < count($message_log); $i++) {
|
||||||
$output.= $message_number_log[$i] . "\r\n";
|
$output.= $message_number_log[$i] . "\r\n";
|
||||||
@ -1362,19 +1384,13 @@ class Net_SSH1
|
|||||||
if (strlen($current_log)) {
|
if (strlen($current_log)) {
|
||||||
$output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 ';
|
$output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 ';
|
||||||
}
|
}
|
||||||
$fragment = $this->_string_shift($current_log, $short_width);
|
$fragment = $this->_string_shift($current_log, $this->log_short_width);
|
||||||
$hex = substr(
|
$hex = substr(preg_replace_callback('#.#s', array($this, '_format_log_helper'), $fragment), strlen($this->log_boundary));
|
||||||
preg_replace(
|
|
||||||
'#(.)#es',
|
|
||||||
'"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
|
|
||||||
$fragment),
|
|
||||||
strlen($boundary)
|
|
||||||
);
|
|
||||||
// replace non ASCII printable characters with dots
|
// replace non ASCII printable characters with dots
|
||||||
// http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
// http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
||||||
// also replace < with a . since < messes up the output on web browsers
|
// also replace < with a . since < messes up the output on web browsers
|
||||||
$raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment);
|
$raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment);
|
||||||
$output.= str_pad($hex, $long_width - $short_width, ' ') . $raw . "\r\n";
|
$output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n";
|
||||||
$j++;
|
$j++;
|
||||||
} while (strlen($current_log));
|
} while (strlen($current_log));
|
||||||
$output.= "\r\n";
|
$output.= "\r\n";
|
||||||
@ -1383,6 +1399,20 @@ class Net_SSH1
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for _format_log
|
||||||
|
*
|
||||||
|
* For use with preg_replace_callback()
|
||||||
|
*
|
||||||
|
* @param Array $matches
|
||||||
|
* @access private
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
function _format_log_helper($matches)
|
||||||
|
{
|
||||||
|
return $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, '0', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the server key public exponent
|
* Return the server key public exponent
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user