duanmu8911 2019-03-11 08:47
浏览 308

phpseclib SSH2写入不执行长命令

I am trying to execute an SSH command to a device (firewall). Command is executed when the length is short. When the length is about 1000 characters, command is not being executed.

When I execute the command via putty, that is working as well.

After reading few solutions, I tried to set timeout to 5 seconds. Still, no help.

In the device logs, I can see SSH login and logout. But no activity.

I am using phpseclib ssh version 2.0

$ssh = new SSH2(ip_address);
$ssh->login($user, $password);
$ssh->write($command);
$ssh->setTimeout(5);
$ssh->read()
  • 写回答

2条回答 默认 最新

  • dpxnrx11199 2019-03-11 09:47
    关注

    Juddging the source code of the library https://github.com/phpseclib/phpseclib/blob/master/phpseclib/Net/SSH2.php#L4244 we can see, that the waiting time is in-built in the library, so you do not have to set a timeout.

    If this doesn't work, you can open an issue on the github, providing your command. IF the library is being supported, you'll get a fix or an answer from the library developers.

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!