Beispiel #1
0
 public function getRemoteIp(CommandExecutor $executor)
 {
     $matches['ip'] = '127.0.0.1';
     $decorator = $executor->getDecorator();
     if ($decorator instanceof SSHDecorator) {
         $verbose = $decorator->getVerbose();
         $decorator->setVerbose(true);
         try {
             $executor->executeCommand('exit');
         } catch (ProcessFailedException $e) {
         }
         $output = $executor->getLastErrorOutput();
         $decorator->setVerbose($verbose);
         preg_match('/^debug1: Connecting to [\\w\\d.-]+ \\[(?<ip>[\\d.]+)\\] port \\d+/m', $output, $matches);
     }
     return $matches['ip'];
 }
Beispiel #2
0
 public function getLastError()
 {
     return $this->executor->getLastErrorOutput();
 }