Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $server = "host";
- $username = "login";
- $password = "haslo";
- $methods = array('kex' => 'diffie-hellman-group1-sha1');
- $connection = ssh2_connect($server, 22, $methods);
- ssh2_auth_password($connection, $username, $password);
- $shell = ssh2_shell($connection);
- $cmd = "df -h";
- $output = user_exec($shell,$cmd);
- function user_exec($shell,$cmd)
- {
- fwrite($shell, $cmd . "\r");
- sleep(1);
- while($line = fgets($output)){
- flush();
- $tab[]= $line;
- }
- fclose($shell);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement