hp-server-monitoring/includes/ssh_functions.php

21 lines
468 B
PHP
Raw Permalink Normal View History

2019-11-11 15:45:17 +01:00
<?php
/* SSH Connection Functions */
function ssh_Connect($server_ip, $username, $password) {
global $data;
$connection = new Net_SSH2($server_ip);
if (!$connection->login($username, $password)) {
return 2;
}
return $connection;
}
function ssh_sendCommand($connection, $command) {
ob_start();
//Hier wird das echo eingefangen und in die variable gespeichert.
echo $connection->exec($command);
$data = ob_get_contents();
ob_end_clean();
return $data;
}
?>