duanjuhuo8772 2014-12-02 13:14
浏览 25

phplibsec等待时间已过期

I'm afraid this question looks trivial, but I'm working on it one entire day and can't understand what happen.

Im using the SSH library phpseclib to connect to a ssh host, and after that, doing a telnet connection

    <?php
    set_include_path(get_include_path() . "\\" . 'phpseclib');
    include('Net/SSH2.php');


    $ssh = new Net_SSH2('10.10.10.10');

    if (!$ssh->login('user', 'password'))
        {
        exit('Login Failed');
        }

    echo $ssh->read('$');
    echo "<hr />";

    echo $ssh->write("telnet 10.10.20.20
");
    echo "<hr />";

    echo $ssh->read('User');
    echo "<hr />";

    echo $ssh->write('admin
');
    echo"<hr />";

    echo $ssh->read('Password');
    $ssh->write('admin
');
    ?>

Well, debugging it stops after detect User. I think I send the user, but I wait forever for the string Password.

The exit I have in HTML code is the following

    Last login: Tue Dec 2 14:06:11 2014 from 10.10.10.2 $1 
    telnet 10.10.20.20 Telnet escape character is 'off'. Trying 10.10.20.20...         
    Connected to 10.10.20.20. Escape character is 'off'. ****Hello User1
    Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\php\pear\phpseclib\Net\SSH2.php on line 2699

Well, note that 1 appears twice, after the line of last login and the Hello User, that was not intentioned.

Well, any ideas?

On the other hand, I tried to use "exec" command, but with not success too.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法