From 093a18290493635a697471a8a67ace5335001335 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 26 Jul 2013 09:57:20 -0500 Subject: [PATCH] SSH2: Logging updates --- phpseclib/Net/SSH2.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index bf15182e..d8218d17 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2869,6 +2869,11 @@ class Net_SSH2 { */ function _append_log($message_number, $message) { + // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) + if (strlen($message_number) > 2) { + $this->_string_shift($message); + } + switch (NET_SSH2_LOGGING) { // useful for benchmarks case NET_SSH2_LOG_SIMPLE: @@ -2888,7 +2893,15 @@ class Net_SSH2 { // passwords won't be filtered out and select other packets may not be correctly // identified case NET_SSH2_LOG_REALTIME: - echo "
\r\n" . $this->_format_log(array($message), array($message_number)) . "\r\n
\r\n"; + switch (PHP_SAPI) { + case 'cli': + $start = $stop = "\r\n"; + break; + default: + $start = '
';
+                            $stop = '
'; + } + echo $start . $this->_format_log(array($message), array($message_number)) . $stop; @flush(); @ob_flush(); break;