Using phpseclib "write" in order to send Linux commands to a web server -


i'm trying use phpseclib in order connect ssh web server through web proxy. php file simple doesn't work, problem?

after several seconds while server seems hang, result is:

cd /home/web/sqladmin\nls -la\n

i tried using \r\n , \r instead of \n. php filename "ssh.php".

<?php ini_set("display_errors",1);  include('net/ssh2.php');  $ssh = new net_ssh2('127.0.0.1'); if (!$ssh->login('username', 'password')) {     exit('login failed'); }  ?> <br> <form action="ssh.php" method="get" name="salvarouting"> comando: <input name="comando" type="text"> <br><input name="avanti" type="submit" value="ok"> </form> <br>  <?php  $ssh->read('/.*@.*[$|#]/', net_ssh2_read_regex); $ssh->write('cd /home/web/sqladmin\n'); if(isset($_get['comando'])) {     $ssh->write($_get['comando'].'\n');     $ssh->settimeout(10);     echo '<pre>'.htmlspecialchars($ssh->read()).'</pre>'; } ?> 


Comments