我在使用 phpseclib 的 SSH2 时遇到了麻烦。当我尝试使用此代码连接到路由器时,它无法连接。
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
$nKCon = new Net_SSH2($nkIP);
if(!$nKCon->login($nKUser,$nKPass)){
print_r($nKCon->getLog()."<br><br>");
//print_r($nKCon->getErrors());
exit('Login Failed');
} else {
echo 'Connected <br>';}
它给我的错误是这个'SSH_MSG_DISCONNECT:NET_SSH2_DISCONNECT_BY_APPLICATION'。我试图通过 ssh 连接到设备并进入并能够运行我的所有命令,但由于某种原因它不喜欢该代码。
00000000 53:53:48:2d:31:2e:39:39:2d:43:69:73:63:6f:2d:32 SSH-1.99-Cisco-2 00000010 2e:30:0a .0。-> 00000000 53:53:48:2d:32:2e:30:2d:70:68:70:73:65:63:6c:69 SSH-2.0-phpsecli 00000010 62:5f:30:2e:33: 20:28:6d:63:72:79:70:74:2c:20:62 b_0.3 (mcrypt, b 00000020 63:6d:61:74:68:29:0d:0a cmath).. <- NET_SSH2_MSG_KEXINIT(自上次:0.051,网络:0.005s)00000000 62:76:6d:f6:ca:16:9e:50:9f:08:7b:4a:9d:79:f0:d2 bvm....P ..{Jy。00000010 00:00:00:1a: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:00:00 an-group1-sha1.. 00000030 00:07:73:73:68:2d:72:73:61:00:00 :00:29:61:65:73 ..ssh-rsa...)aes 00000040 31:32:38:2d:63:62:63:2c:61:65:73:31:39:32:2d :63 128-cbc,aes192-c 00000050 62:63:2c:61:65:73:32:35:36:2d:63:62:63:2c:33:64 bc,aes256-cbc,3d 00000060 65 :73:2d:63:62:63:00:00:00:29:61:65:73:31:32: 38 es-cbc...)aes128 00000070 2d:63:62:63:2c:61:65:73:31:39:32:2d:63:62:63:2c -cbc,aes192-cbc, 00000080 61 :65:73:32:35:36:2d:63:62:63:2c:33:64:65:73:2d aes256-cbc,3des-00000090 63:62:63:00:00:00:12 :68:6d:61:63:2d:6d:64:35:2c cbc....hmac-md5, 000000a0 68:6d:61:63:2d:73:68:61:31:00:00: 00:12:68:6d:61 hmac-sha1....hma 000000b0 63:2d:6d:64:35:2c:68:6d:61:63:2d:73:68:61:31:00 c -md5,hmac-sha1。000000c0 00:00:04:6e:6f:6e:65:00:00:00:04:6e:6f:6e:65:00 ...无....无。000000d0 00:00:00:00:00:00:00:00:00:00:00:00 .... -> NET_SSH2_MSG_KEXINIT(自上次:0.014,网络:0s)00000000广告:4e:12:92:6c:77:4b:2d:59:45:c3:ed:38:cc:2b:22 .N..lwK-YE..8.+" 00000010 00:00:00 :36:64:69:66:66:69:65:2d:68:65:6c:6c:6d ...6diffie-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: c3:1c mm.[I....... 00000040 72:b0:ca:dc:8f:e8:71:ec:6b:43:d1:62:3f:06:71:ae r. ....q.kC.b?.q. 00000050 5b:81:cb:26:d5:09:c0:17:51:ff:35:0a:35:9e:e8:d6 [..&....Q.5.5... 00000060 ba:da :f9:c6:1f:49:3c:4a:19:91:e3:83:22:ec:23:66 .....IJ...".#f 00000070 87:d0:23:c1: 44:5b:36:00:0a:f0:83:95:45:08:9e:56 ..#.D[6.....E..V 00000080 d5:f8:33:e9 ..3 . <- NET_SSH2_MSG_KEXDH_REPLY(自上次:0.263,网络:0.262s)00000000 00:00:01:17:00:00:00:07:73:73:68:2d:72:73:61:00 ... .....ssh-rsa. 00000010 00:00:03:01:00:01:00:00:01:01:00:b9:fa:f6:be:c2 ......... ....... 00000020 00:3d:77:b6:f7:c1:75:86:1c:8f:ac:7d:06:5a:79:92 .=w...u.... }.Zy. 00000030 f5:ec:ff:06:4f:24:1b:14:3b:31:c3:0e:76:9a:03:af ....O$..;1..v. .. 00000040 1e:60:bd:35:f1:37:29:f1:c2:6b:59:dd:0b:b3:e0:47 。..q.kC.b?.q. 00000050 5b:81:cb:26:d5:09:c0:17:51:ff:35:0a:35:9e:e8:d6 [..&....Q.5.5... 00000060 ba:da :f9:c6:1f:49:3c:4a:19:91:e3:83:22:ec:23:66 .....IJ...".#f 00000070 87:d0:23:c1: 44:5b:36:00:0a:f0:83:95:45:08:9e:56 ..#.D[6.....E..V 00000080 d5:f8:33:e9 ..3 . <- NET_SSH2_MSG_KEXDH_REPLY(自上次:0.263,网络:0.262s)00000000 00:00:01:17:00:00:00:07:73:73:68:2d:72:73:61:00 ... .....ssh-rsa. 00000010 00:00:03:01:00:01:00:00:01:01:00:b9:fa:f6:be:c2 ......... ....... 00000020 00:3d:77:b6:f7:c1:75:86:1c:8f:ac:7d:06:5a:79:92 .=w...u.... }.Zy. 00000030 f5:ec:ff:06:4f:24:1b:14:3b:31:c3:0e:76:9a:03:af ....O$..;1..v. .. 00000040 1e:60:bd:35:f1:37:29:f1:c2:6b:59:dd:0b:b3:e0:47 。..q.kC.b?.q. 00000050 5b:81:cb:26:d5:09:c0:17:51:ff:35:0a:35:9e:e8:d6 [..&....Q.5.5... 00000060 ba:da :f9:c6:1f:49:3c:4a:19:91:e3:83:22:ec:23:66 .....IJ...".#f 00000070 87:d0:23:c1: 44:5b:36:00:0a:f0:83:95:45:08:9e:56 ..#.D[6.....E..V 00000080 d5:f8:33:e9 ..3 . <- NET_SSH2_MSG_KEXDH_REPLY(自上次:0.263,网络:0.262s)00000000 00:00:01:17:00:00:00:07:73:73:68:2d:72:73:61:00 ... .....ssh-rsa. 00000010 00:00:03:01:00:01:00:00:01:01:00:b9:fa:f6:be:c2 ......... ....... 00000020 00:3d:77:b6:f7:c1:75:86:1c:8f:ac:7d:06:5a:79:92 .=w...u.... }.Zy. 00000030 f5:ec:ff:06:4f:24:1b:14:3b:31:c3:0e:76:9a:03:af ....O$..;1..v. .. 00000040 1e:60:bd:35:f1:37:29:f1:c2:6b:59:dd:0b:b3:e0:47 。#f 00000070 87:d0:23:c1:44:5b:36:00:0a:f0:83:95:45:08:9e:56 ..#.D[6.....E..V 00000080 d5:f8:33:e9 ..3。<- NET_SSH2_MSG_KEXDH_REPLY(自上次:0.263,网络:0.262s)00000000 00:00:01:17:00:00:00:07:73:73:68:2d:72:73:61:00 .... ....ssh-rsa。00000010 00:00:03:01:00:01:00:00:01:01:00:b9:fa:f6:be:c2 ...... 00000020 00 :3d:77:b6:f7:c1:75:86:1c:8f:ac:7d:06:5a:79:92 .=w...u....}.Zy。00000030 f5:ec:ff:06:4f:24:1b:14:3b:31:c3:0e:76:9a:03:af ....O$..;1..v... 00000040 1e :60:bd:35:f1:37:29:f1:c2:6b:59:dd:0b:b3:e0:47 。#f 00000070 87:d0:23:c1:44:5b:36:00:0a:f0:83:95:45:08:9e:56 ..#.D[6.....E..V 00000080 d5:f8:33:e9 ..3。<- NET_SSH2_MSG_KEXDH_REPLY(自上次:0.263,网络:0.262s)00000000 00:00:01:17:00:00:00:07:73:73:68:2d:72:73:61:00 .... ....ssh-rsa。00000010 00:00:03:01:00:01:00:00:01:01:00:b9:fa:f6:be:c2 ...... 00000020 00 :3d:77:b6:f7:c1:75:86:1c:8f:ac:7d:06:5a:79:92 .=w...u....}.Zy。00000030 f5:ec:ff:06:4f:24:1b:14:3b:31:c3:0e:76:9a:03:af ....O$..;1..v... 00000040 1e :60:bd:35:f1:37:29:f1:c2:6b:59:dd:0b:b3:e0:47 。77:b6:f7:c1:75:86:1c:8f:ac:7d:06:5a:79:92 .=w...u....}.Zy。00000030 f5:ec:ff:06:4f:24:1b:14:3b:31:c3:0e:76:9a:03:af ....O$..;1..v... 00000040 1e :60:bd:35:f1:37:29:f1:c2:6b:59:dd:0b:b3:e0:47 。77:b6:f7:c1:75:86:1c:8f:ac:7d:06:5a:79:92 .=w...u....}.Zy。00000030 f5:ec:ff:06:4f:24:1b:14:3b:31:c3:0e:76:9a:03:af ....O$..;1..v... 00000040 1e :60:bd:35:f1:37:29:f1:c2:6b:59:dd:0b:b3:e0:47 。
.5.7)..kY....G 00000050 fd:3e:1a:e4:a9:46:d1:fb:52:83:07:d8:2d:6b:a8:94 .>...F..R...-k.. 00000060 c1:cf:a7:db:0f:f3:06:ba:89:34:0a:57:c0:54:82:58 .........4.W.T.X 00000070 2a:89:e0:f3:d8:70:e0:1e:7e:d1:95:23:ef:d7:33:eb *....p..~..#..3. 00000080 d2:46:bb:bd:fa:1c:8c:c7:d9:4d:60:29:fb:9e:50:c9 .F.......M
)..P。00000090 94:5a:c8:c4:7b:a0:e7:6c:1a:eb:8f:24:ef:4e:7b:f8 .Z..{..l...$.N{. 000000a0 7d:f6:c3:b1:74:1c:66:70:6d:23:eb:2f:fd:3e:4f:4a }...t.fpm#./.>OJ 000000b0 00:ac: 47:97:4f:bf:24:a9:a4:ba:e2:61:85:a0:17:75 ..GO$..a...u 000000c0 a5:fa:04:d4:6e :fb:e1:a9:07:c2:37:55:3a:27:75:17 ....n.....7U:'u. 000000d0 da:37:db:10:d3:77:e3:e7:61:6c:98:09:70:b5:bb:cb .7...w..al..p... 000000e0 b8: c5:c5:68:c4:72:69:ca:cf:cf:16:69:a3:e7:97:25 ...h.ri....i...% 000000f0 c2:bb:cf :6d:71:b8:d0:da:e4:e8:09:52:a9:ff:fd:8b ...mq......R.... 00000100 d3:5e:58:88: 1f:6e:53:98:18:cd:5b:49:a8:d3:d7:00 .^X..nS...[I.... 00000110 84:e6:ef:a7:1b:1d :65:12:21:23:b5:00:00:00:80:62 ......e.!#......b 00000120 82:74:8d:7d:6d:03:87 :f1:d7:da:4b:b8:38:fa:63:59 .t.}m.....K.8.cY 00000130 e3:83:54:91:4c:24:c9:33: fe:cf:b2:0d:c0:5a:52:49 ..TL$.3 .....ZRI 00000140 2f:e0:ba:d0:a8:3c:3f:7b: 79 t....@9.8.._y 00000200 c2:b7:b1:38:64:63:87:87:ac:de:29:d4:e7:d0:38:a1 ...8dc ......)...... 8。00000210 81:cb:ab:07:17:a8:53:9d:17:09:51:42:02:8f:91:d2 ......S......QB.... 00000220 92: 2c:79:1e:4d:6a:1d:7d:05:89:6f:33:aa:fe:7e:7c .,y.Mj.}..o3..~| 00000230 6f:37:f4:78:3a:c9:da:06:a4:e2:0f:82:cc:03:a0:a8 o7.x:............ 00000240 b3: fb:fb:27:a3:4d:9d:8a:11:e1:41:50:68:1a:74:63 ...'.M..APh.tc 00000250 ce:88:76:a6 :4b:58:40:bc:73:5a:39:bb:9a:e3:1b:ac ..v.KX@.sZ9 ..... 00000260 db:97:1d:a3:69:a1: ae:a3:4f:b5:4c:02:08:e3:6c:32 ....i...OL..l2 00000270 f8:5d:48:db:13:43:5e:0d:06: 95:a3:59:2d:9e:c8:e7 .]H..C^..Y-... 00000280 1f:20:11:8e:64:59:23:76:57:d8: fe:ef:ad:e1:8c:05 。..dY#vW........ 00000290 a4:95:18:16:c7:44:93:8a:b0:5b:e9:15:0c:ab:c9:29 .....D ...[.....) 000002a0 a8:8f:a5:46:e7:3a:91:cf:98:30:ab:bc:e4:85:95:87 ...F.:.. .0...... 000002b0 93:7a .