- split off some of _get_binary_packet to _filter in SSH2.php

- updated URL to SSH-1 specs in SSH1.php


git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@8 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2007-07-26 14:53:45 +00:00
parent 29ee82e67b
commit 79944da3ed
2 changed files with 21 additions and 8 deletions

View File

@ -43,7 +43,7 @@
* </code>
*
* More information on the SSHv1 specification can be found by reading
* {@link http://web.archive.org/web/20010417045724/http://www.tigerlair.com/ssh/faq/ssh1-draft.txt ssh1-draft.txt}.
* {@link http://www.snailbook.com/docs/protocol-1.5.txt protocol-1.5.txt}.
*
* LICENSE: This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -65,7 +65,7 @@
* @author Jim Wigginton <terrafrost@php.net>
* @copyright MMVII Jim Wigginton
* @license http://www.gnu.org/licenses/lgpl.txt
* @version $Id: SSH1.php,v 1.4 2007-07-25 21:55:48 terrafrost Exp $
* @version $Id: SSH1.php,v 1.5 2007-07-26 14:53:45 terrafrost Exp $
* @link http://phpseclib.sourceforge.net
*/
@ -613,7 +613,7 @@ class Net_SSH1 {
return false;
}
// connect using the sample parameters in ssh1-draft.txt.
// connect using the sample parameters in protocol-1.5.txt.
// according to wikipedia.org's entry on text terminals, "the fundamental type of application running on a text
// terminal is a command line interpreter or shell". thus, opening a terminal session to run the shell.
$data = pack('CNa*N4C', NET_SSH1_CMSG_REQUEST_PTY, strlen('vt100'), 'vt100', 24, 80, 0, 0, NET_SSH1_TTY_OP_END);
@ -783,7 +783,7 @@ class Net_SSH1 {
/**
* Gets Binary Packets
*
* See 'The Binary Packet Protocol' of ssh1-draft.txt for more info.
* 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
@ -995,7 +995,7 @@ class Net_SSH1 {
*/
function _rsa_crypt($m, $key)
{
// To quote from ssh1-draft.txt:
// To quote from protocol-1.5.txt:
// The most significant byte (which is only partial as the value must be
// less than the public modulus, which is never a power of two) is zero.
//

View File

@ -41,7 +41,7 @@
* @author Jim Wigginton <terrafrost@php.net>
* @copyright MMVII Jim Wigginton
* @license http://www.gnu.org/licenses/lgpl.txt
* @version $Id: SSH2.php,v 1.2 2007-07-25 21:49:33 terrafrost Exp $
* @version $Id: SSH2.php,v 1.3 2007-07-26 14:53:45 terrafrost Exp $
* @link http://phpseclib.sourceforge.net
*/
@ -1243,8 +1243,7 @@ class Net_SSH2 {
* See '6. Binary Packet Protocol' of rfc4253 for more info.
*
* @see Net_SSH2::_send_binary_packet()
* @param optional Integer $message
* @return Array
* @return String
* @access private
*/
function _get_binary_packet()
@ -1282,6 +1281,20 @@ class Net_SSH2 {
$seq++;
return $this->_filter($payload);
}
/**
* Filter Binary Packets
*
* Because some binary packets need to be ignored...
*
* @see Net_SSH2::_get_binary_packet()
* @return String
* @access private
*/
function _filter($payload)
{
switch (ord($payload[0])) {
case NET_SSH2_MSG_DISCONNECT:
$this->_string_shift($payload, 5);