0
试图使用phpseclib替换我的服务器上的SSH2 DLL,以便我可以移动到PHP 5.6及更高版本。我使用SSH登录到Sonicwall防火墙并导出配置文件。使用phpseclib连接到Sonicwall设备
通过SSH登录并不像远程访问Linux的一个盒子。例如,腻子在第一次连接时要求提供用户名,但sonicwall会忽略该用户名,显示其欢迎横幅,然后询问用户名和密码。
我能目前连接使用下面的代码:
$connection = ssh2_connect($host);
ssh2_auth_none($connection,$user);
$shell = ssh2_shell($connection,'vt102',null,80,40,SSH2_TERM_UNIT_CHARS);
fwrite($shell, $user."\n");
fwrite($shell, $pass."\n");
// etc
我试图使用从http://phpseclib.sourceforge.net/ssh/auth.html#noauth的例子与phpseclib如下:
$ssh = new \Net_SSH2('172.17.1.99');
$ssh->login("admin");
$ssh->read('User:');
$ssh->write('admin');
$ssh->read('Password:');
$ssh->write('password');
但有些事情是越来越挂了,我也得到直到我的执行超时命中为止。