note 71766 added to function.ssh2-fetch-stream
| From: | ricardophpatyahoocombr at osu1 dot php dot net | Date: | Thu, 14 Dec 2006 22:30:08 +0000 |
| Subject: | note 71766 added to function.ssh2-fetch-stream | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120616@lists.php.net to get a copy of this message | ||
Sweet toy!
Could not make it work with fwrite like webmaster at spectreanime dot com shows at the ssh2_shell
help page, althought i got it working this way
<?php
echo "Connexion SSH ";
if (!($connection=@ssh2_connect("69.69.69.69", 22))) { echo "[FAILED]\n";
exit(1); } echo "[OK]\nAuthentification ";
if (!@ssh2_auth_password($connection,"root","YourPassword")) { echo
"[FAILED]\n"; exit(1); } echo "[OK]\n";
$stdout_stream = ssh2_exec($connection, "/bin/lssss -la /tmp");
sleep(1);
$stderr_stream = ssh2_fetch_stream($stdout_stream, SSH2_STREAM_STDERR);
echo "Erros encontrados!\n------------\n";
while($line = fgets($stderr_stream)) { flush(); echo $line."\n"; }
echo "------------\n";
while($line = fgets($stdout_stream)) { flush(); echo $line."\n";}
fclose($stdout_stream);
?>
which shows as ...
Connexion SSH [OK]
Authentification [OK]
Erros encontrados!
------------
bash: line 1: /bin/lssss: No such file or directory
------------
----
Server IP: 66.163.161.117
Probable Submitter: 200.175.3.170
----
Manual Page -- http://www.php.net/manual/en/function.ssh2-fetch-stream.php
Edit -- https://master.php.net/note/edit/71766
Del: integrated -- https://master.php.net/note/delete/71766/integrated
Del: useless -- https://master.php.net/note/delete/71766/useless
Del: bad code -- https://master.php.net/note/delete/71766/bad+code
Del: spam -- https://master.php.net/note/delete/71766/spam
Del: non-english -- https://master.php.net/note/delete/71766/non-english
Del: in docs -- https://master.php.net/note/delete/71766/in+docs
Del: other reasons-- https://master.php.net/note/delete/71766
Reject -- https://master.php.net/note/reject/71766
Search -- https://master.php.net/manage/user-notes.php