我在使用 phpseclib Net SSH2 库时遇到问题,无法连接到服务器,我试图找到解决方案但找不到。
注意:从第 3494 行 C:\wamp64\www\v5\library\backend\global\class\lib\Net\SSH2.php 中的套接字读取错误
注意:第 1497 行 C:\wamp64\www\v5\library\backend\global\class\lib\Net\SSH2.php 中的服务器关闭连接
include('lib/Net/SSH2.php');
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
$ssh = new Net_SSH2('IP');
if (!$ssh->login('root', 'password')) {
echo $ssh->isConnected() ? 'bad username or password' : 'unable to establish connection';
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
echo $ssh->getLog();
以下是恢复的错误日志:
<-
00000000 53:53:48:2d:32:2e:30:2d:4f:70:65:6e:53:53:48:5f SSH-2.0-OpenSSH_
00000010 36:2e:37:70:31:20:44:65:62:69:61:6e:2d:35:2b:64 6.7p1 Debian-5+d
00000020 65:62:38:75:38:0d:0a eb8u8..
->
00000000 53:53:48:2d:32:2e:30:2d:70:68:70:73:65:63:6c:69 SSH-2.0-phpsecli
00000010 62:5f:31:2e:30:20:28:6f:70:65:6e:73:73:6c:2c:20 b_1.0 (openssl,
00000020 67:6d:70:29:0d:0a gmp)..
-> NET_SSH2_MSG_KEXINIT (since last: 0.1796, network: 0s)
00000000 d8:18:e9:65:85:2a:0e:6c:0c:3d:be:0b:b7:89:94:92 ...e.*.l.=......
00000010 00:00:00:7e:64:69:66:66:69:65:2d:68:65:6c:6c:6d ...~diffie-hellm
00000020 61:6e:2d:67:72:6f:75:70:31:2d:73:68:61:31:2c:64 an-group1-sha1,d
00000030 69:66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72 iffie-hellman-gr
00000040 6f:75:70:31:34:2d:73:68:61:31:2c:64:69:66:66:69 oup14-sha1,diffi
00000050 65:2d:68:65:6c:6c:6d:61:6e:2d:67:72:6f:75:70:2d e-hellman-group-
00000060 65:78:63:68:61:6e:67:65:2d:73:68:61:31:2c:64:69 exchange-sha1,di
00000070 66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72:6f ffie-hellman-gro
00000080 75:70:2d:65:78:63:68:61:6e:67:65:2d:73:68:61:32 up-exchange-sha2
00000090 35:36:00:00:00:29:72:73:61:2d:73:68:61:32:2d:32 56...)rsa-sha2-2
000000a0 35:36:2c:72:73:61:2d:73:68:61:32:2d:35:31:32:2c 56,rsa-sha2-512,
000000b0 73:73:68:2d:72:73:61:2c:73:73:68:2d:64:73:73:00 ssh-rsa,ssh-dss.
000000c0 00:00:00:00:00:00:00:00:00:00:39:68:6d:61:63:2d ..........9hmac-
000000d0 73:68:61:32:2d:32:35:36:2c:68:6d:61:63:2d:73:68 sha2-256,hmac-sh
000000e0 61:31:2d:39:36:2c:68:6d:61:63:2d:73:68:61:31:2c a1-96,hmac-sha1,
000000f0 68:6d:61:63:2d:6d:64:35:2d:39:36:2c:68:6d:61:63 hmac-md5-96,hmac
00000100 2d:6d:64:35:00:00:00:39:68:6d:61:63:2d:73:68:61 -md5...9hmac-sha
00000110 32:2d:32:35:36:2c:68:6d:61:63:2d:73:68:61:31:2d 2-256,hmac-sha1-
00000120 39:36:2c:68:6d:61:63:2d:73:68:61:31:2c:68:6d:61 96,hmac-sha1,hma
00000130 63:2d:6d:64:35:2d:39:36:2c:68:6d:61:63:2d:6d:64 c-md5-96,hmac-md
00000140 35:00:00:00:04:6e:6f:6e:65:00:00:00:04:6e:6f:6e 5....none....non
00000150 65:00:00:00:00:00:00:00:00:00:00:00:00:00 e.............
谢谢你的帮助。问候。