Advertisement
Guest User

Untitled

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