public function getIndex()
 {
     SSH::into('production')->run(array('cd ~/public_html/yorubawebsite', 'git pull origin master'), function ($line) {
         echo $line . PHP_EOL;
         // outputs server feedback
     });
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $commands = array('cd /home/elegefacil/web/elegefacil.com/', 'php artisan down', 'php artisan clear-compiled', 'git pull origin master', 'php -d memory_limit=-1 /usr/bin/composer install --no-scripts', 'php artisan migrate', 'php artisan optimize', 'php artisan up');
     SSH::run($commands, function ($line) {
         Log::info($line);
     });
 }
Exemple #3
0
 public function deploy()
 {
     \SSH::into('local')->run(array('cd /var/www/html', 'git pull origin master'), function ($line) {
         echo $line . PHP_EOL;
         // outputs server feedback
     });
 }
Exemple #4
0
 public function deploy()
 {
     SSH::into('production')->run(array('cd /var/www/html/papayaheaderlabs.WhortleberryMobileBE', 'git pull origin master-starting_jan13'), function ($line) {
         echo $line . PHP_EOL;
         // outputs server feedback
     });
 }
 public function getIndex()
 {
     \SSH::into('production')->run(array('cd ~/sample', 'git pull origin master'), function ($line) {
         echo $line . PHP_EOL;
         // outputs server feedback
     });
     //return "Mail Sent !!";
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $packageName = 'laravel-deploy';
     $appName = \Config::get("{$packageName}::application-name");
     $basePath = \Config::get("{$packageName}::base-path");
     $appPath = "{$basePath}/{$appName}/current";
     echo "Running: " . 'LARAVEL_ENV=production ' . $this->argument('remoteCommand') . " inside {$appPath}\n";
     \SSH::run(array("cd {$appPath}", "pwd", "LARAVEL_ENV=production " . $this->argument('remoteCommand')));
 }
Exemple #7
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $me = $this;
     $remote = $this->argument('remote');
     $config = app()->config['remote.connections.' . $remote];
     $commands = array('cd ' . $config['root'], 'php artisan down', 'git fetch --all', 'git reset --hard origin/master', 'composer install --optimize-autoloader --no-dev', 'php artisan migrate --package=cartalyst/sentry --force', 'php artisan migrate --force', 'grunt build', 'php artisan cache:clear', 'php artisan up');
     SSH::into($remote)->run($commands, function ($line) use($me) {
         $me->info($line);
     });
     $this->info('All done!');
 }
 /**
  * This method copies the dhcpd.conf file from storage and then restarts dhcp
  */
 public function deployDhcpConfig()
 {
     logThis('Deploying dhcpd.conf');
     // The next three lines copies the local dhcpd.conf to the server
     $localFile = storage_path() . '/app/dhcp/dhcpd.conf';
     $remotePath = '/etc/dhcp/dhcpd.conf';
     \SSH::into('dhcp_server')->put($localFile, $remotePath);
     logThis('New dhcpd.conf copied to dhcp server at ' . env('DHCP_SERVER'));
     // Now let's restart dhcp
     \SSH::into('dhcp_server')->run(['service isc-dhcp-server restart']);
     logThis('isc-dhcp-server restarted on dhcp server at ' . env('DHCP_SERVER'));
 }
Exemple #9
0
 /**
  * Gets command generated for this current
  * rsync configuration. You can use it to test
  * or execute it later without using the sync method
  *
  * @param $origin
  * @param $target
  *
  * @return Command
  */
 public function getCommand($origin, $target)
 {
     $command = new Command($this->executable);
     if ($this->skipNewerFiles) {
         $command->addOption("u");
     }
     if ($this->followSymLinks) {
         $command->addOption("L");
     }
     if ($this->dryRun) {
         $command->addOption("n");
     }
     if ($this->verbose) {
         $command->addOption("v");
     }
     if ($this->times) {
         $command->addArgument('times');
     }
     if ($this->deleteFromTarget) {
         $command->addArgument('delete');
     }
     if ($this->deleteExcluded) {
         $command->addArgument('delete-excluded');
     }
     if (!empty($this->exclude)) {
         foreach ($this->exclude as $excluded) {
             $command->addArgument('exclude', $excluded);
         }
     }
     if ($this->archive) {
         $command->addOption("a");
     }
     if (!$this->archive && $this->recursive) {
         $command->addOption("r");
     }
     if (!is_null($this->ssh)) {
         $ssh = $this->ssh->getConnectionOptions();
         $command->addArgument("rsh", $ssh);
     }
     $command->addParameter($origin);
     if (is_null($this->ssh)) {
         $command->addParameter($target);
     } else {
         $command->addParameter($this->ssh->getHostConnection() . ":" . $target);
     }
     return $command;
 }
Exemple #10
0
 public function pull()
 {
     if ($this->auth()) {
         $payload = json_decode(Input::get("payload"));
         // only do this on master
         if ($payload["ref"] != "refs/heads/master") {
             return;
         }
         $forced = $payload["forced"] ? " (forced)" : "";
         $git = $payload["forced"] ? "git pull origin master -- force" : "git pull origin master";
         // log updates
         Log::info("[git] updating master from {$payload["before"]} to {$payload["after"]}" . $forced);
         // update the repo
         SSH::run(["cd " . base_path(), $git]);
         return;
     }
 }
Exemple #11
0
Fichier : SSH.php Projet : jasny/Q
 /**
  * Get information about the RPC client.
  *
  * @param boolean|string $command  Include command 
  * @return string
  */
 public function about($command = true)
 {
     if ($command === true) {
         $command = $this->command;
     }
     return parent::about($command);
 }
 protected function detectDrivers()
 {
     $this->interfaces['\\Illuminate\\Contracts\\Auth\\Authenticatable'] = config('auth.model', 'App\\User');
     try {
         if (class_exists('Auth') && is_a('Auth', '\\Illuminate\\Support\\Facades\\Auth', true)) {
             $authMethod = version_compare(Application::VERSION, '5.2', '>=') ? 'guard' : 'driver';
             $class = get_class(\Auth::$authMethod());
             $this->extra['Auth'] = array($class);
             $this->interfaces['\\Illuminate\\Auth\\UserProviderInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('DB') && is_a('DB', '\\Illuminate\\Support\\Facades\\DB', true)) {
             $class = get_class(\DB::connection());
             $this->extra['DB'] = array($class);
             $this->interfaces['\\Illuminate\\Database\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Cache') && is_a('Cache', '\\Illuminate\\Support\\Facades\\Cache', true)) {
             $driver = get_class(\Cache::driver());
             $store = get_class(\Cache::getStore());
             $this->extra['Cache'] = array($driver, $store);
             $this->interfaces['\\Illuminate\\Cache\\StoreInterface'] = $store;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Queue') && is_a('Queue', '\\Illuminate\\Support\\Facades\\Queue', true)) {
             $class = get_class(\Queue::connection());
             $this->extra['Queue'] = array($class);
             $this->interfaces['\\Illuminate\\Queue\\QueueInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('SSH') && is_a('SSH', '\\Illuminate\\Support\\Facades\\SSH', true)) {
             $class = get_class(\SSH::connection());
             $this->extra['SSH'] = array($class);
             $this->interfaces['\\Illuminate\\Remote\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
 }
Exemple #13
0
 /**
  * Gets a Net_SFTP connection as Laravels SSH doesn't have all the functionality
  * 
  * @return Net_SFTP connection
  */
 protected function getConnection()
 {
     return \SSH::into($this->connectionName)->getGateway()->getConnection();
 }
Exemple #14
0
<?php

require_once __DIR__ . '/lib/SSH.php';
require_once __DIR__ . '/lib/Iptables.php';
$ssh = new SSH('192.168.20.127');
$ssh->setUsername('root');
$ssh->setPassword('root');
$iptables = new Iptables($ssh);
$iptables->setOnFly(FALSE);
$flashes = array();
$editDialogDisplayed = FALSE;
$editDialogAction = './index.php';
function buildQueryFromRule(\stdClass $rule, $table, $chain)
{
    $rule = clone $rule;
    $parameters = array();
    $parameters['protocol'] = $rule->protocol;
    $parameters['in'] = $rule->in;
    $parameters['out'] = $rule->out;
    $parameters['source'] = $rule->source;
    $parameters['destination'] = $rule->destination;
    $parameters['target'] = $rule->target;
    if (preg_match('~--(d|s)port ([0-9:]+)~i', $rule->additional, $matches)) {
        $parameters[$matches[1] . 'port'] = $matches[2];
        $rule->additional = str_replace($matches[0], '', $rule->additional);
    }
    $parameters['additional'] = trim($rule->additional);
    $parameters['table'] = $table;
    $parameters['chain'] = $chain;
    return http_build_query($parameters);
}
Exemple #15
0
 protected function detectDrivers()
 {
     try {
         if (class_exists('Auth') && is_a('Auth', '\\Illuminate\\Support\\Facades\\Auth', true)) {
             $class = get_class(\Auth::driver());
             $this->extra['Auth'] = array($class);
             $this->interfaces['\\Illuminate\\Auth\\UserProviderInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('DB') && is_a('DB', '\\Illuminate\\Support\\Facades\\DB', true)) {
             $class = get_class(\DB::connection());
             $this->extra['DB'] = array($class);
             $this->interfaces['\\Illuminate\\Database\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Cache') && is_a('Cache', '\\Illuminate\\Support\\Facades\\Cache', true)) {
             $driver = get_class(\Cache::driver());
             $store = get_class(\Cache::getStore());
             $this->extra['Cache'] = array($driver, $store);
             $this->interfaces['\\Illuminate\\Cache\\StoreInterface'] = $store;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Queue') && is_a('Queue', '\\Illuminate\\Support\\Facades\\Queue', true)) {
             $class = get_class(\Queue::connection());
             $this->extra['Queue'] = array($class);
             $this->interfaces['\\Illuminate\\Queue\\QueueInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('SSH') && is_a('SSH', '\\Illuminate\\Support\\Facades\\SSH', true)) {
             $class = get_class(\SSH::connection());
             $this->extra['SSH'] = array($class);
             $this->interfaces['\\Illuminate\\Remote\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
 }
Exemple #16
0
<?php

// Dependencies: libssh2-php package
require_once 'ssh.php';
$ssh = SSH::connect('linuxvm196.mi.hdm-stuttgart.de', 'root', 'test.pub', 'test');
$ssh->upload('check', 'check', 0700)->exec('./check', $output, $status)->rm('check');
unset($con);
var_dump($output, $status);
/*
$con = ssh2_connect('linuxvm196.mi.hdm-stuttgart.de');
var_dump($con);

$result = ssh2_auth_pubkey_file($con, 'root', 'test.pub', 'test');
var_dump($result);


$result = ssh2_scp_send($con, 'check', 'check', 0700);
var_dump($result);

$io_stream = ssh2_exec($con, '( ./check ) 2>&1; echo $?');
var_dump($io_stream);
stream_set_blocking($io_stream, true);

$output = '';
while(true){
	$stdout_line = fgets($io_stream);
	$output .= $stdout_line;
	if ($stdout_line === false)
		break;
}
Exemple #17
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['address'], $_POST['port'], $_POST['username']));
$ssh = new SSH($_POST['address'], $_POST['port']);
$ssh_auth = $ssh->auth($_POST['username'], SSH_PUBLIC_KEY_PATH, SSH_PRIVATE_KEY_PATH);
echo '{"ssh_connected":true}';
Exemple #18
0
 protected function detectDrivers()
 {
     $this->interfaces['\\Illuminate\\Contracts\\Auth\\Authenticatable'] = config('auth.providers.users.model', config('auth.model', 'App\\User'));
     try {
         if (class_exists('Auth') && is_a('Auth', '\\Illuminate\\Support\\Facades\\Auth', true)) {
             if (class_exists('\\Illuminate\\Foundation\\Application')) {
                 $authMethod = version_compare(\Illuminate\Foundation\Application::VERSION, '5.2', '>=') ? 'guard' : 'driver';
             } else {
                 $refClass = new ReflectionClass('\\Laravel\\Lumen\\Application');
                 $versionStr = $refClass->newInstanceWithoutConstructor()->version();
                 $authMethod = strpos($versionStr, 'Lumen (5.0') === 0 ? 'driver' : (strpos($versionStr, 'Lumen (5.1') === 0 ? 'driver' : 'guard');
             }
             $class = get_class(\Auth::$authMethod());
             $this->extra['Auth'] = array($class);
             $this->interfaces['\\Illuminate\\Auth\\UserProviderInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('DB') && is_a('DB', '\\Illuminate\\Support\\Facades\\DB', true)) {
             $class = get_class(\DB::connection());
             $this->extra['DB'] = array($class);
             $this->interfaces['\\Illuminate\\Database\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Cache') && is_a('Cache', '\\Illuminate\\Support\\Facades\\Cache', true)) {
             $driver = get_class(\Cache::driver());
             $store = get_class(\Cache::getStore());
             $this->extra['Cache'] = array($driver, $store);
             $this->interfaces['\\Illuminate\\Cache\\StoreInterface'] = $store;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Queue') && is_a('Queue', '\\Illuminate\\Support\\Facades\\Queue', true)) {
             $class = get_class(\Queue::connection());
             $this->extra['Queue'] = array($class);
             $this->interfaces['\\Illuminate\\Queue\\QueueInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('SSH') && is_a('SSH', '\\Illuminate\\Support\\Facades\\SSH', true)) {
             $class = get_class(\SSH::connection());
             $this->extra['SSH'] = array($class);
             $this->interfaces['\\Illuminate\\Remote\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
 }
 public function dailyBackup($job, $data)
 {
     if ($job->attempts() > 3) {
         $job->delete();
     }
     //################################### select each backup
     $hosts = Host::where('id', '=', $data["id"])->where('state', '!=', 'disabled')->where('cron', '=', 'yes')->get(array('id', 'parent', 'name', 'host', 'type', 'ssh_login', 'ssh_pwd', 'storage', 'source', 'db_name', 'db_user', 'db_pwd'));
     foreach ($hosts as $host) {
         $backup = new Backup();
         $backup->host_id = $host["id"];
         $backup->hostname = $host["host"];
         $backup->type = "cron";
         //################################### folders check
         $dir = $host["storage"] . "/auto/";
         if (!is_dir($dir)) {
             // creating if not exists and setting owner
             $cmd = "mkdir -p " . $dir . " && chown -R ftpuser:ftpgroup /backups/web " . $dir;
             exec($cmd);
         }
         //##################################### --
         //##################################### generating ssh configuration
         Config::set('remote.connections.runtime.host', $host->host);
         Config::set('remote.connections.runtime.port', '22');
         Config::set('remote.connections.runtime.username', $host->ssh_login);
         if (!$host->ssh_pwd) {
             Config::set('remote.connections.runtime.password', '');
             Config::set('remote.connections.runtime.key', '/root/.ssh/id_rsa');
         } else {
             Config::set('remote.connections.runtime.password', $host->ssh_pwd);
             Config::set('remote.connections.runtime.key', '');
         }
         Config::set('remote.connections.runtime.keyphrase', '');
         Config::set('remote.connections.runtime.root', '~/');
         $dtime = date('d.m.y_H.i');
         $FileName = $host->host . "_" . $dtime;
         $path = $dir . $host->host . "_" . $dtime . ".tar";
         $dbpath = $dir . $host->host . "_" . $dtime . ".sql";
         //##################################### --
         //##################################### backup type: ssh-all
         if ($host->type == "ssh-all") {
             SSH::into('runtime')->run(array("tar -cf ~/" . $FileName . ".tar " . $host->source, "mysqldump -u" . $host->db_user . " -p" . $host->db_pwd . " --lock-tables --databases " . $host->db_name . "> ~/" . $FileName . ".sql"));
             // downloading files
             SSH::into('runtime')->get($FileName . ".tar", $path);
             SSH::into('runtime')->get($FileName . ".sql", $dbpath);
             // continue to local actions if success
             if (file_exists($dbpath) && file_exists($path)) {
                 // adding sql file to archive
                 exec("tar -rf " . $path . " " . $dbpath);
                 // compressing
                 exec("bzip2 -zfkv9 " . $path);
                 $backup->file = $path . ".bz2";
                 $backup->total_size = filesize($path . ".bz2");
                 // cleanup local and remote files
                 SSH::into('runtime')->run(array("rm ~/" . $FileName . ".tar", "rm ~/" . $FileName . ".sql"));
                 $backup->status = "ok";
                 exec("rm " . $path);
                 exec("rm " . $dbpath);
             } else {
                 $backup->status = "broken";
             }
             $backup->save();
             //##################################### permissions
             $set_perm = "chown -R ftpuser:ftpgroup /backups/web " . $dir;
             exec($set_perm);
         }
         //##################################### --
         //##################################### backup type: ssh-files
         if ($host->type == "ssh-files") {
             SSH::into('runtime')->run(array("tar -cf ~/" . $FileName . ".tar " . $host->source));
             // downloading files
             SSH::into('runtime')->get($FileName . ".tar", $path);
             // continue to local actions if success
             if (file_exists($path)) {
                 // compressing
                 exec("bzip2 -zfkv9 " . $path);
                 $backup->file = $path . ".bz2";
                 $backup->total_size = filesize($path . ".bz2");
                 // cleanup local and remote files
                 SSH::into('runtime')->run(array("rm ~/" . $FileName . ".tar"));
                 $backup->status = "ok";
                 exec("rm " . $path);
             } else {
                 $backup->status = "broken";
             }
             //##################################### permissions
             $set_perm = "chown -R ftpuser:ftpgroup /backups/web " . $dir;
             exec($set_perm);
             $backup->save();
         }
         //##################################### --
         //##################################### backup type: ssh-db
         if ($host->type == "ssh-db") {
             SSH::into('runtime')->run(array("mysqldump -u" . $host->db_user . " -p" . $host->db_pwd . " --lock-tables --databases " . $host->db_name . "> ~/" . $FileName . ".sql", "tar -cf ~/" . $FileName . ".tar " . "~/" . $FileName . ".sql"));
             // downloading files
             SSH::into('runtime')->get($FileName . ".tar", $path);
             // continue to local actions if success
             if (file_exists($path)) {
                 // compressing
                 exec("bzip2 -zfkv9 " . $path);
                 $backup->file = $path . ".bz2";
                 $backup->total_size = filesize($path . ".bz2");
                 // cleanup local and remote files
                 SSH::into('runtime')->run(array("rm ~/" . $FileName . ".tar", "rm ~/" . $FileName . ".sql"));
                 $backup->status = "ok";
                 exec("rm " . $path);
             } else {
                 $backup->status = "broken";
             }
             //##################################### permissions
             $set_perm = "chown -R ftpuser:ftpgroup /backups/web " . $dir;
             exec($set_perm);
             $backup->save();
         }
         //##################################### --
     }
     $job->delete();
 }
Exemple #20
0
 /**
  * @param string $parameters
  * @return string
  */
 private function execute($parameters)
 {
     return $this->ssh->execute($this->executable . ' ' . $parameters);
 }
 private function runCommandList($commandList)
 {
     $this->info("Will run following commands:");
     foreach ($commandList as $command) {
         $this->info($command);
     }
     \SSH::run($commandList);
 }
Exemple #22
0
 /**
  * Gets command generated for this current
  * rsync configuration. You can use it to test
  * or execute it later without using the sync method
  *
  * @param $origin
  * @param $target
  *
  * @return Command
  */
 public function getCommand($origin, $target)
 {
     $command = new Command($this->executable);
     if ($this->skipNewerFiles) {
         $command->addOption("u");
     }
     if ($this->followSymLinks) {
         $command->addOption("L");
     }
     if ($this->dryRun) {
         $command->addOption("n");
     }
     if ($this->verbose) {
         $command->addOption("v");
     }
     if ($this->compression) {
         $command->addOption("z");
     }
     // add any optional options we've specified
     $extra_options = $this->getOptionalParameters();
     if (!empty($extra_options)) {
         // if the extra options were given as a flat string, then convert it to an array
         if (is_string($extra_options)) {
             $extra_options = str_split($extra_options);
         }
         // add each extra option we've defined.
         if (is_array($extra_options)) {
             foreach ($extra_options as $option) {
                 $command->addOption($option);
             }
         }
     }
     if ($this->times) {
         $command->addArgument('times');
     }
     if ($this->deleteFromTarget) {
         $command->addArgument('delete');
     }
     if ($this->removeSource) {
         $command->addArgument('remove-source-files');
     }
     if ($this->deleteExcluded) {
         $command->addArgument('delete-excluded');
     }
     if ($this->info) {
         $command->addArgument('info', $this->info);
     }
     if ($this->compareDest) {
         $command->addArgument('compare-dest', $this->compareDest);
     }
     if (!empty($this->exclude)) {
         foreach ($this->exclude as $excluded) {
             $command->addArgument('exclude', $excluded);
         }
     }
     if (!empty($this->excludeFrom)) {
         $command->addArgument('exclude-from', $this->excludeFrom);
     }
     if ($this->archive) {
         $command->addOption("a");
     }
     if (!$this->archive && $this->recursive) {
         $command->addOption("r");
     }
     if (!is_null($this->ssh)) {
         $ssh = $this->ssh->getConnectionOptions();
         $command->addArgument("rsh", $ssh);
     }
     if (is_null($this->ssh)) {
         $command->addParameter($origin);
         $command->addParameter($target);
     } elseif ($this->remoteOrigin) {
         $command->addParameter($this->ssh->getHostConnection() . ":" . $origin);
         $command->addParameter($target);
     } else {
         $command->addParameter($origin);
         $command->addParameter($this->ssh->getHostConnection() . ":" . $target);
     }
     return $command;
 }
Exemple #23
0
    //Output error details
    Error::halt(400, 'bad request', 'The recipe \'' . $_POST['recipe'] . '\' does not exist.');
}
//Default group handling
if (count($_POST['groups']) === 1 && empty($_POST['groups'][0])) {
    $_POST['groups'] = array();
}
$servers = array();
$results = MySQLQueries::get_servers_by_groups($_POST['groups']);
while ($row = MySQLConnection::fetch_object($results)) {
    $servers[] = $row;
}
$returned_results = array();
foreach ($servers as $server) {
    try {
        $ssh = new SSH($server->address, $server->ssh_port, THROW_ERROR);
    } catch (Exception $ex) {
        $ex = json_decode($ex->getMessage());
        $returned_results[] = array("server" => $server->id, "server_label" => $server->label, "stream" => "error", "result" => $ex->error->message);
        continue;
    }
    try {
        $ssh_auth = $ssh->auth($server->ssh_username, SSH_PUBLIC_KEY_PATH, SSH_PRIVATE_KEY_PATH, THROW_ERROR);
    } catch (Exception $ex) {
        $ex = json_decode($ex->getMessage());
        $returned_results[] = array("server" => $server->id, "server_label" => $server->label, "stream" => "error", "result" => $ex->error->message);
        continue;
    }
    ////
    // Build the correct interpreter and command
    ////
Exemple #24
0
 protected function detectDrivers()
 {
     try {
         if (class_exists('Cache')) {
             $class = get_class(\Auth::driver());
             $this->extra['Auth'] = array($class);
             $this->interfaces['\\Illuminate\\Auth\\UserProviderInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('DB')) {
             $class = get_class(\DB::connection());
             $this->extra['DB'] = array($class);
             $this->interfaces['\\Illuminate\\Database\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Cache')) {
             $driver = get_class(\Cache::driver());
             $store = get_class(\Cache::getStore());
             $this->extra['Cache'] = array($driver, $store);
             $this->interfaces['\\Illuminate\\Cache\\StoreInterface'] = $store;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('Queue')) {
             $class = get_class(\Queue::connection());
             $this->extra['Queue'] = array($class);
             $this->interfaces['\\Illuminate\\Queue\\QueueInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     try {
         if (class_exists('SSH')) {
             $class = get_class(\SSH::connection());
             $this->extra['SSH'] = array($class);
             $this->interfaces['\\Illuminate\\Remote\\ConnectionInterface'] = $class;
         }
     } catch (\Exception $e) {
     }
     // Make all interface classes absolute
     foreach ($this->interfaces as &$interface) {
         $interface = '\\' . ltrim($interface, '\\');
     }
 }
Exemple #25
-1
function conectarSSH($config)
{
    global $configService;
    global $request;
    echo "<pre>";
    var_dump($request);
    echo "</pre>";
    $ssh = new SSH();
    $ssh->host($request['conexao']['host'])->user($request['conexao']['user'])->pass($request['conexao']['pass'])->port($request['conexao']['port']);
    $configService->conectarSSH($ssh);
}