Advertisement
Guest User

Untitled

a guest
Feb 1st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1.  
  2. <?php
  3.     $user = "testauser";
  4.     $password = "TestUser123";
  5.     $host = "83.220.174.89";
  6.  
  7.     echo '123';
  8.  
  9.     $connection = ssh2_connect($host);
  10.     if (false === $connection) {
  11.         die('connection failed');
  12.     }
  13.  
  14.     echo '321';
  15.  
  16.     $auth = @ssh2_auth_password($connection, $user, $password);
  17.     if (false === $connection) {
  18.         die('authentication failed');
  19.     }
  20.  
  21.     $stream = ssh2_exec($connection, "touch testauser_launch");
  22.     stream_set_blocking($stream, true);
  23.     $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
  24.     echo stream_get_contents($stream_out);
  25.  
  26.     ssh2_exec($connection, "exit");
  27.  
  28.     unset($connection);
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement