read() 공개 메소드

Returns when there's a match for $expect, which can take the form of a string literal or, if $mode == NET_SSH2_READ_REGEX, a regular expression.
또한 보기: self::write()
public read ( string $expect = '', integer $mode = NET_SSH2_READ_SIMPLE ) : string
$expect string
$mode integer
리턴 string
예제 #1
0
    public function Exec($command, $stdin = '')
    {
        $database = $this->session->getDatabase();
        $name = $database['name'];
        $engine = $this->session->getSpoolerByName($name, 'waae');
        if (!isset($engine[0]['shell'])) {
            print "?!";
            exit;
        }
        set_include_path('../vendor/phpseclib' . PATH_SEPARATOR . get_include_path());
        include 'Net/SSH2.php';
        include 'Crypt/RSA.php';
        $shell = $engine[0]['shell'];
        $host = $shell['host'];
        $user = $shell['user'];
        $ssh = new \Net_SSH2($host);
        if (isset($shell['key'])) {
            $key = new \Crypt_RSA();
            $ret = $key->loadKey($shell['key']);
            if (!$ret) {
                echo "loadKey failed\n";
                print "<pre>" . $ssh->getLog() . '</pre>';
                exit;
            }
        } elseif (isset($shell['password'])) {
            $key = $shell['password'];
        } else {
            $key = '';
            // ?! possible ?
        }
        if (!$ssh->login('autosys', $key)) {
            print 'Login Failed';
            print "<pre>" . $ssh->getLog() . '</pre>';
            exit;
        }
        if ($stdin == '') {
            return $ssh->exec(". ~/.bash_profile;{$command}");
        }
        // Test STDIN
        $ssh->enablePTY();
        print "profile" . $ssh->exec(". ~/.bash_profile");
        print "sort" . ($exec = $ssh->exec('sort'));
        $ssh->write(<<<EOF
echo "update_job: SE.ERIC.JOB.JobType_UNIX"
echo "description: 'ok!!'
EOF
);
        $ssh->reset(true);
        $ssh->setTimeout(2);
        print $ssh->read();
        return;
        return $ssh->read();
        // outputs the echo above
    }
예제 #2
0
    set_include_path($path);
    @($query = mysqli_query($connect, "SELECT * FROM configureddb where dbuid='{$option}'"));
    while ($query_row = mysqli_fetch_assoc($query)) {
        $hostname = $query_row['server'];
        $sslusername = $query_row['sslusername'];
        $sslpassword = $query_row['sslpassword'];
    }
    set_include_path(get_include_path() . '/' . 'phpsec');
    include 'Net/SSH2.php';
    include 'File/ANSI.php';
    $ssh = new Net_SSH2(@$hostname);
    if (@$ssh->login(@$sslusername, @$sslpassword)) {
        $ssh->enablePTY();
        $ssh->exec('ps axo pid,ppid,%cpu,pmem,user,group,args --sort %cpu');
        $ssh->setTimeout(2);
        $hello = $ssh->read();
        $ps = explode("\n", $hello);
        $proc = array();
        foreach ($ps as $process) {
            $processes[] = preg_split('@\\s+@', trim($process), 7);
        }
        unset($processes[0]);
        foreach ($processes as $pro) {
            $proc[] = @array('pid' => $pro[0], 'ppid' => $pro[1], 'cpu' => $pro[2], 'pmem' => $pro[3], 'user' => $pro[4], 'group' => $pro[5], 'cmd' => $pro[6]);
        }
        echo json_encode($proc);
    } else {
        echo "[]";
    }
} else {
    echo "[]";
function create_client_config_and_send($cert_name, $config_dir, $config_file, $remote_value, $send_type, $key_dir_name)
{
    //will need phpseclib later.... so...
    if (!isset($_SESSION['password'])) {
        start_session('certs.php?action=send_cert&type=$send_type&cert_name=$cert_name');
    }
    $password = stripslashes(trim($_SESSION['password']));
    $username = stripslashes(trim($_SESSION['username']));
    if ($username == "") {
        $username = "******";
    }
    $ssh = new Net_SSH2('localhost');
    if (!$ssh->login($username, $password)) {
        exit('Login Failed');
    }
    //Creating a default client config file
    //TODO have a check to make sure /etc/openvpn.conf exists....
    //If none exists... then you should prolly do some checks when the webui is first launched.... duh
    if (!file_exists("openvpn-client-default.conf")) {
        create_default_client_config();
    }
    $vpn_config = read_openvpn_config($config_dir . $config_file);
    extract($vpn_config);
    echo "Default client file exists... <br />";
    echo "Now copying to new config {$cert_name}.conf<br />";
    copy("openvpn-client-default.conf", "{$cert_name}.conf");
    //New Conf file should exist.... Now edit specifics...
    if (file_exists("{$cert_name}.conf")) {
        $client_config = "{$cert_name}.conf";
        file_put_contents($client_config, "cert " . $cert_name . ".crt" . PHP_EOL, FILE_APPEND | LOCK_EX);
        file_put_contents($client_config, "key " . $cert_name . ".key" . PHP_EOL, FILE_APPEND | LOCK_EX);
    } else {
        echo "Error... client config file not found?<br />";
        exit;
    }
    //Finding what dir
    $curr_work_dir = getcwd();
    echo "Copying needed files...<br />";
    //Now copying all the necc. sh!t to the root folder... then zip it? tar it? idk.. prolly zip
    $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
    $ssh->write("cd {$key_dir_name};cp {$cert_name}.key {$ca_values['1']} {$cert_name}.crt {$curr_work_dir}\n");
    $result = $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
    echo "<pre>{$result}</pre>";
    //HAVE to change the permissions on *.key... or php can't touch it
    echo "Have to change permissions on the *.key file.. or php can't touch..<br />";
    $ssh->write("cd {$curr_work_dir};chmod 555 {$cert_name}.key\n");
    $result = $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
    echo "<pre>{$result}</pre>";
    echo str_repeat(' ', 1024 * 64);
    //create array of files to zip
    $files_to_zip = array("{$cert_name}.crt", "{$cert_name}.key", "{$ca_values['1']}", "{$cert_name}.conf");
    echo "Creating zip file <b>{$cert_name}.zip</b><br />";
    echo str_repeat(' ', 1024 * 64);
    $result = create_zip($files_to_zip, "{$cert_name}.zip", $cert_name);
    // unlink every other file...
    unlink("{$cert_name}.crt");
    unlink("{$cert_name}.key");
    unlink("{$ca_values['1']}");
    unlink("{$cert_name}.conf");
    if ($send_type == "download") {
        echo "<br /> Download transfer type selected!";
        echo "<br />";
        echo "Result:{$result}";
        echo str_repeat(' ', 1024 * 64);
        sleep(5);
        // return name of zip file, will use that to generate download link
        return $result;
        exit;
    }
    if ($send_type == "scp") {
        if (!isset($_SESSION['password'])) {
            start_session('certs.php?action=send_cert&type=$send_type&cert_name=$cert_name');
        }
        $password = stripslashes(trim($_SESSION['password']));
        $username = stripslashes(trim($_SESSION['username']));
        if ($username == "") {
            $username = "******";
        }
        $ssh = new Net_SSH2('localhost');
        if (!$ssh->login($username, $password)) {
            exit('Login Failed');
        }
        echo "SCP transfer type selected!";
        echo "TYPE TOO";
        echo str_repeat(' ', 1024 * 64);
        $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
        $ssh->write("cd {$curr_work_dir};scp {$cert_name}.zip {$username}@{$remote_host}:{$remote_dir}\n");
        $ssh->setTimeout(10);
        sleep(5);
        $result = $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
        echo "<pre>{$result}</pre>";
        echo str_repeat(' ', 1024 * 64);
        exit;
    }
}
예제 #4
0
//attempted to set an ssh timeout, not allowed on UTEP server
$ssh->setTimeout(7200);
//sftp connect to cr2g server
$sftp = new Net_SFTP('cr2g01.cs.utep.edu', 22);
if (!$sftp->login('rlgruver', 'utep$2015')) {
    exit('sftp Login Failed');
}
//send input file to cr2g server
$sftp->mkdir('/code/spopt-stable/tests/' . $session);
$sftp->put($remoteInputFile, $localInputFile, NET_SFTP_LOCAL_FILE);
$sftp->chmod(0777, $remoteInputFile);
//execute python script in this order to run the Solver:
//1. change to directory where solver script is located
$ssh->write("cd /code/spopt-stable\n");
//2. 'read' command to ensure script is called from the proper directory
$ssh->read('rlgruver@cr2g01:/code/spopt-stable$');
//3. run the solver script with the test from the current session
$ssh->write("python SpOpt.py tests/" . $session . "/input.txt\n");
//start timerin case anything gets stuck, will break within 120 minutes (7200 sec)
$starttime = time();
//ssh will break within 120 minutes (7200 sec) regardless of execution status
while ($ssh->isConnected()) {
    $now = time() - $starttime;
    if ($now > 7200) {
        break;
    }
    sleep(3);
    //retrieve all solutions/discarded from cr2g and store in local
    $sftp->get($remoteSolutionsFile, $localSolutionsFile);
    $sftp->get($remoteDiscardedFile, $localDiscardedFile);
    //function to provide discarded solutions during session
예제 #5
0
 chdir('..');
 chdir('..');
 $path = getcwd();
 chdir('php/pear');
 $path = getcwd();
 set_include_path($path);
 set_include_path(get_include_path() . '/' . 'phpsec');
 @(include 'Net/SSH2.php');
 @(include 'File/ANSI.php');
 @($ssh = new Net_SSH2(@$hostname));
 if (@$ssh->login(@$sslusername, @$sslpassword)) {
     $ansi = new File_ANSI();
     $ssh->enablePTY();
     $ssh->exec(' sar 1 1 | tail -1');
     $ssh->setTimeout(2);
     $var = $ssh->read();
     $stripped = preg_replace(array('/\\s{2,}/', '/[\\t\\n]/'), ' ', $var);
     $result = explode(' ', $stripped);
     $idlecpu = $result[7];
     $result = array(array("Free", $idlecpu), array('Used', 100 - $idlecpu));
     $rows = array();
     $table = array();
     $table['cols'] = array(array('label' => 'BLKSIZE', 'type' => 'string'), array('label' => 'total blks', 'type' => 'number'));
     foreach ($result as $r) {
         $temp = array();
         $temp[] = array('v' => (string) $r[0]);
         $temp[] = array('v' => (double) $r[1]);
         $rows[] = array('c' => $temp);
     }
     $table['rows'] = $rows;
     echo $jsonTable = json_encode($table);
예제 #6
0
 if (!$ssh->login($connection["USER"], $connection["PASS"])) {
     $host_connected = false;
     $sql = "UPDATE sshManagerQueue\n\t\t\t\tSET cmdOutput = 'Auth failed!',\n\t\t\t\t\tcmdTimestamp = UNIX_TIMESTAMP()\n\t\t\t\tWHERE memberID = '" . $connection["memberID"] . "'\n\t\t\t\t  AND jobTemplateID = '" . $connection["jobTemplateID"] . "'\n\t\t\t\t  AND deviceID = '" . $connection["deviceID"] . "'\n\t\t\t\t  AND cmdID = '" . $connection["cmdID"] . "'";
     //echo "Running sql auth error cmdID: ".$connection["cmdID"]."\n$sql";
     if ($db_CS->query($sql)) {
     }
 } else {
     // WE GOT A CONNECTION !
     //$ansi->appendString($ssh->read('username@username:~$'));
     $ansi = new File_ANSI();
     $sql = "UPDATE sshManagerQueue\n\t\t\t\tSET cmdOutput = 'Connected!',\n\t\t\t\t\tcmdTimestamp = UNIX_TIMESTAMP()\n\t\t\t\tWHERE memberID = '" . $connection["memberID"] . "'\n\t\t\t\t  AND jobTemplateID = '" . $connection["jobTemplateID"] . "'\n\t\t\t\t  AND cmdID = '" . $connection["cmdID"] . "'\n\t\t\t\t  AND deviceID = '" . $connection["deviceID"] . "'";
     if ($db_CS->query($sql)) {
         $ssh->enablePTY();
         $fwCMD = "cat /http/default/_version.php | grep 'define' | grep 'PRODUCT_VERSION' | awk -F ',' '{print \$2}' | sed 's/[^[:alnum:]\\.[:space:]]\\+//g'";
         $ssh->exec($fwCMD);
         $ansi->appendString($ssh->read());
         $response["cmdOutput"] = trim(htmlspecialchars_decode(strip_tags($ansi->getHistory())));
         //echo "Running sql success cmdID: ".$connection["cmdID"]."\n$sql";
         if ($db_CS->query($sql)) {
             if ($connection["tDeviceFirmware"] != $response["cmdOutput"]) {
                 $sql = "UPDATE sshManagerQueue\n\t\t\t\t\t\t\tSET cmdOutput = 'FW updated from " . $connection["tDeviceFirmware"] . " to " . $response["cmdOutput"] . "',\n\t\t\t\t\t\t\t\tcmdTimestamp = UNIX_TIMESTAMP()\n\t\t\t\t\t\t\tWHERE memberID = '" . $connection["memberID"] . "'\n\t\t\t\t\t\t\t  AND jobTemplateID = '" . $connection["jobTemplateID"] . "'\n\t\t\t\t\t\t\t  AND cmdID = '" . $connection["cmdID"] . "'\n\t\t\t\t\t\t\t  AND deviceID = '" . $connection["deviceID"] . "'";
                 $db_CS->query($sql);
                 $sql = "UPDATE DeviceList\n\t\t\t\t\t\t\tSET tDeviceFirmware = '" . $response["cmdOutput"] . "'\n\t\t\t\t\t\t\tWHERE id = '" . $connection["deviceID"] . "'";
                 if ($db_CS->query($sql) && $db_CS->affected_rows > 0) {
                     if (updateDeviceHistoryMember($connection["deviceID"], 'tDeviceFirmware', $connection["memberID"])) {
                         $db_CS->commit();
                     } else {
                         $db_CS->rollback();
                     }
                 }
             } else {
예제 #7
0
파일: WPN.php 프로젝트: bciv/COMS
function ProgressNote($note, $match)
{
    return;
    $orderday = date('m_d_Y');
    //Set Variables
    $host = '54.83.44.110';
    $username = '******';
    $password = '';
    $login = '******';
    $loginpass = '******';
    $tmatch = trim($match);
    $patientSearch = $tmatch;
    $AC = '1radiologist';
    $VC = 'radiologist1';
    //$AC = 'CPRS1234';
    //$VC = 'CPRS4321$';
    //$Note = "Test Note";
    $ssh = new Net_SSH2($host);
    if (!$ssh->login($username, $password)) {
        exit('Login Failed');
    }
    sleep(4);
    $ssh->write("\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("{$AC}\r");
    $ssh->write("{$VC}\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("OE\r");
    $ssh->write("FD\r");
    $ssh->write("{$patientSearch}\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("Notes\r");
    sleep(1);
    $ssh->write("NW\r");
    sleep(1);
    $ssh->write("N\r");
    sleep(1);
    $ssh->write("Primary Care General Note\r");
    sleep(1);
    $ssh->write("Yes\r");
    sleep(1);
    $ssh->write("Outpatient\r");
    sleep(1);
    $ssh->write("New\r");
    sleep(1);
    $ssh->write("Y\r");
    sleep(1);
    $ssh->write("N\r");
    sleep(1);
    $ssh->write("A\r");
    sleep(1);
    $ssh->write("Y\r");
    sleep(5);
    $ssh->write("{$note}\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("{$VC}\r");
    sleep(1);
    $ssh->write("Radiologist, One\r");
    sleep(1);
    $ssh->write("\r");
    //Set SSH Timeout
    $ssh->setTimeout(1);
    //Read Results
    $SSHresults = $ssh->read();
    //echo $SSHresults;
    $xxx = 'nothing';
    //writeDebug($SSHresults,$note,$patientSearch,$xxx);
}
 //need to use bash commands to do this... permission issues.
 //editing var file using sed
 //define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
 if (!isset($_SESSION['password'])) {
     start_session('create_certs.php?vars=yes');
 }
 $password = stripslashes(trim($_SESSION['password']));
 $username = stripslashes(trim($_SESSION['username']));
 if ($username == "") {
     $username = "******";
 }
 $ssh = new Net_SSH2('localhost');
 if (!$ssh->login($username, $password)) {
     exit('Login Failed');
 }
 echo $ssh->read('/.*@.*/', NET_SSH2_READ_REGEX);
 $ssh->write("sudo killall -v openvpn\n");
 $ssh->setTimeout(10);
 $output = $ssh->read('/.*@.*[$|#]|.*[P|p]assword.*/', NET_SSH2_READ_REGEX);
 //$ssh->read();
 if (preg_match('/.*[P|p]assword.*/', $output)) {
     $ssh->write($password . "\n");
     $ls = $ssh->read('/.*@.*/', NET_SSH2_READ_REGEX);
     echo "<pre>{$ls}</pre>";
 }
 echo $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
 echo str_repeat(' ', 1024 * 64);
 echo "<pre>Editing vars file...{$var_file}</pre>";
 if ($username != "root") {
     echo "NOT ROOT!  Currently root is REQUIRED!<br />";
     echo "ATTEMPTING WORKAROUND (BETA)<br />";
예제 #9
0
     $ssh->exec('apt-get -y install lib32gcc1');
     $ssh->exec('apt-get -y install vsftpd');
     $ssh->exec('apt-get -y install unzip');
     $ssh->exec('apt-get -y install gawk');
     $ssh->exec("apt-get -y install openssl");
     $os_version = "Ubuntu 15.04";
     $os_bit = "64";
 } else {
     msg_error('Something went wrong, Invalid OS');
     exit;
 }
 $ssh->exec('sudo useradd -m -d /home/' . $user . ' -s /bin/bash ' . $user);
 $ssh->enablePTY();
 $ssh->exec('sudo passwd ' . $user);
 if ($language == "English") {
     $ssh->read('Enter new UNIX password:'******'Retype new UNIX password:'******'passwd: password updated successfully');
 } elseif ($language == "Deutsch") {
     $ssh->read('Geben Sie ein neues UNIX-Passwort ein:');
     $ssh->write($password . "\n");
     $ssh->read('Geben Sie das neue UNIX-Passwort erneut ein:');
     $ssh->write($password . "\n");
     $ssh->read('passwd: Passwort erfolgreich geändert');
 }
 $ssh->disablePTY();
 $ssh->read('[prompt]');
 $ssh->exec("usermod -a -G sudo " . $user);
 $ssh->exec('echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers');
 public function fire($job, $data)
 {
     $output = new Symfony\Component\Console\Output\ConsoleOutput();
     $node = Node::find($data['message']['node_id']);
     $s3 = \Aws\S3\S3Client::factory(array('key' => 'AKIAIUCV4E2L4HDCDOUA', 'secret' => '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', 'region' => 'us-east-1'));
     $all_keys = Key::where('integration_id', '=', $data['message']['integration_id'])->get();
     foreach ($all_keys as $pem_key_reference) {
         if ($pem_key_reference->remote_url) {
             $unique_key_name = rand(0, 9999) . $pem_key_reference->remote_url;
             $key_bucket = App::isLocal() ? 'devkeys.nosprawl.software' : 'keys.nosprawl.software';
             $s3->getObject(array('Bucket' => $key_bucket, 'Key' => $pem_key_reference->remote_url, 'SaveAs' => '/tmp/' . $unique_key_name));
             // Shouldn't need these two lines at all.
             exec('chmod 400 /tmp/' . $unique_key_name);
             $empty = null;
             $s3_resource_root = App::isLocal() ? 'http://agent.nosprawl.software/dev/' : 'http://agent.nosprawl.software/';
             $latest_version = exec("curl -s " . $s3_resource_root . "latest", $empty);
             $latest_version_url = $s3_resource_root . $latest_version;
             $ssh = new Net_SSH2($node->public_dns_name);
             $ssh->enableQuietMode();
             $ssh->enablePTY();
             $key = new Crypt_RSA();
             $key->loadKey(file_get_contents('/tmp/' . $unique_key_name));
             exec('rm -rf /tmp/' . $unique_key_name);
             if (!$ssh->login($pem_key_reference->username, $key)) {
                 continue;
             } else {
                 $possible_installers = ["yum", "apt-get"];
                 foreach ($possible_installers as $possible_installer) {
                     $installer_check_result = false;
                     $found = false;
                     $ssh->exec("sudo " . $possible_installer . " -y install ruby");
                     $install_result = $ssh->read();
                     $output->writeln($install_result);
                     $install_exit_status = $ssh->getExitStatus();
                     if ($install_exit_status == 0) {
                         Queue::push('DeployAgentToNode', array('message' => array('node_id' => $node->id, 'integration_id' => $node->integration->id)));
                         return $job->delete();
                     }
                 }
             }
         } else {
             $output->writeln("This is what we do if all we have is a password.");
             continue;
         }
     }
     // If we got to this point we were unable to install Curl automatically.
     $problem = new Problem();
     $problem->description = "Couldn't install Curl.";
     $problem->reason = "Unable to automatically install Curl. Please install it manually.";
     $problem->node_id = $node->id;
     $problem->save();
     $remediation = new Remediation();
     $remediation->name = "Retry Deployment";
     $remediation->queue_name = "DeployAgentToNode";
     $remediation->problem_id = $problem->id;
     $remediation->save();
     $remediation = new Remediation();
     $remediation->name = "Cancel";
     $remediation->queue_name = "CancelDeployAgentToNode";
     $remediation->problem_id = $problem->id;
     $remediation->save();
     return $job->delete();
 }
예제 #11
0
파일: VCFOrder.php 프로젝트: bciv/COMS
function NewOrderPatient($drug, $dose, $Regimen_Dose_Unit, $Description, $match, $NumberofDoses)
{
    if ($Description === 'old') {
    } else {
        $orderday = date('m_d_Y');
        //Set Variables
        $host = '54.83.44.110';
        $username = '******';
        $password = '';
        $login = '******';
        $loginpass = '******';
        $csession = 'csession cache355';
        $cdUnix = 'D ^%CD';
        $instance = 'CPM355';
        $cprsLogin = '******';
        $tmatch = trim($match);
        $patientSearch = $tmatch;
        $patientLocation = 'GEN MED';
        $actingProvider = 'v107';
        $doseorder = "" . $dose . " " . $Regimen_Dose_Unit . "";
        $schedule = 'QDAY';
        $routine = 'ROUTINE';
        $drug = '5-FU  FLUOROURACIL INJ,SOLN';
        $tdrug = trim($drug);
        $AC = '1radiologist';
        $VC = 'radiologist1';
        $Description = 'OutPatient';
        $ssh = new Net_SSH2($host);
        if (!$ssh->login($username, $password)) {
            exit('Login Failed');
        }
        $ssh->write("{$login}\r");
        $ssh->write("{$loginpass}\r");
        sleep(3);
        $ssh->write("{$AC}\r");
        $ssh->write("{$VC}\r");
        sleep(3);
        $ssh->write("\r");
        $ssh->write("AD\r");
        $ssh->write("FD\r");
        $ssh->write("{$patientSearch}\r");
        sleep(1);
        $ssh->write("{$patientLocation}\r");
        if ($Description === 'InPatient') {
            $ssh->write("15\r");
        } elseif ($Description === 'OutPatient') {
            $ssh->write("20\r");
        }
        $ssh->write("Provider, One\r");
        $ssh->write("1\r");
        sleep(1);
        sleep(1);
        $ssh->write("{$tdrug}");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("n");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$doseorder}");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("1");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$schedule}");
        $ssh->write("\r");
        sleep(1);
        if ($Description === 'InPatient') {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("N");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(1);
            $ssh->write("P");
            $ssh->write("\r");
        } else {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("0");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("C");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(1);
            $ssh->write("P");
            $ssh->write("\r");
        }
        //Set SSH Timeout
        $ssh->setTimeout(1);
        //Read Results
        $SSHresults = $ssh->read();
        echo $SSHresults;
        writeDebug($SSHresults, $tdrug, $patientSearch, $orderday);
    }
}
예제 #12
0
 public function checkDeviceFW($deviceID = false)
 {
     global $db_CS;
     global $access;
     global $allowedParams;
     global $allowedGroupsDeviceList;
     global $allowedGroupsArray;
     $deviceID = isset($_REQUEST['deviceID']) ? htmlspecialchars($_REQUEST['deviceID']) : $deviceID;
     $sql = "SELECT tLastAliveIP,tDeviceVPNName,tDeviceFirmware,tRootPwd FROM DeviceList WHERE id = '{$deviceID}'";
     $db_CS->autocommit(FALSE);
     $data["rstatus"] = false;
     if ($rs = $db_CS->query($sql)) {
         if ($connection = $rs->fetch_assoc()) {
             set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/html/sacp/includes/phpseclib');
             include 'Net/SSH2.php';
             include 'File/ANSI.php';
             $data["tDeviceVPNName"] = $connection["tDeviceVPNName"];
             if (filter_var($connection["tLastAliveIP"], FILTER_VALIDATE_IP)) {
                 $ssh = new Net_SSH2($connection["tLastAliveIP"], '22');
                 if (!$ssh->login('root', $connection["tRootPwd"])) {
                     $host_connected = false;
                     $data["result"] = "Auth failed!";
                     $data["alert_type"] = "danger alert";
                 } else {
                     // WE GOT A CONNECTION !
                     $ansi = new File_ANSI();
                     $ssh->enablePTY();
                     $fwCMD = "cat /http/default/_version.php | grep 'define' | grep 'PRODUCT_VERSION' | awk -F ',' '{print \$2}' | sed 's/[^[:alnum:]\\.[:space:]]\\+//g'";
                     $ssh->exec($fwCMD);
                     $ansi->appendString($ssh->read());
                     $response["cmdOutput"] = htmlspecialchars_decode(strip_tags($ansi->getHistory()));
                     if ($connection["tDeviceFirmware"] != $response["cmdOutput"]) {
                         $sql = "UPDATE DeviceList\n\t\t\t\t\t\t\t\t\tSET tDeviceFirmware = '" . $response["cmdOutput"] . "'\n\t\t\t\t\t\t\t\t\tWHERE id = '{$deviceID}'";
                         if ($db_CS->query($sql) && $db_CS->affected_rows > 0) {
                             if ($this->updateDeviceHistoryMember($deviceID, 'tDeviceFirmware')) {
                                 $db_CS->commit();
                                 $data["rstatus"] = true;
                                 $data["alert_type"] = "success alert";
                                 $data["result"] = "FW updated from " . $connection["tDeviceFirmware"] . " to " . $response["cmdOutput"] . "";
                             } else {
                                 $data["rstatus"] = true;
                                 //$data["sql"] = $sql;
                                 $data["alert_type"] = "danger alert";
                                 $data["result"] = 'Ошибка сохранения или такого устройства не существует';
                             }
                         }
                     } else {
                         $data["rstatus"] = true;
                         $data["alert_type"] = "success alert";
                         $data["result"] = "FW is up to date! (Answer: " . addslashes($response["cmdOutput"]) . ")";
                     }
                 }
             } else {
                 $data["result"] = "Wrong IP! (" . $connection["tLastAliveIP"] . ")";
             }
             header('Content-Type: application/json');
             echo json_encode($data);
         }
     }
 }
예제 #13
0
 set_include_path(get_include_path() . '/' . 'phpsec');
 include 'Net/SSH2.php';
 include 'File/ANSI.php';
 $rows = array();
 $table = array();
 $query = mysqli_query($connect, "SELECT  distinct server ,sslusername,sslpassword FROM configureddb");
 while ($query_row = mysqli_fetch_assoc($query)) {
     $hostname = $query_row['server'];
     $sslusername = $query_row['sslusername'];
     $sslpassword = $query_row['sslpassword'];
     $ssh = new Net_SSH2($hostname);
     if (@$ssh->login($sslusername, $sslpassword)) {
         $ansi = new File_ANSI();
         $ssh->enablePTY();
         $ssh->exec('free|grep -i "Mem" |tail -1');
         $mem = $ssh->read();
         $memstrip = preg_replace(array('/\\s{2,}/', '/[\\t\\n]/'), ' ', $mem);
         $resultmem = explode(' ', $memstrip);
         $totalmem = $resultmem[1];
         $freemem = $resultmem[3];
         $mem = $freemem / $totalmem * 100;
         $result = array(array($hostname, $mem));
         $table['cols'] = array(array('label' => 'MEMORY', 'type' => 'string'), array('label' => '% Free', 'type' => 'number'));
         foreach ($result as $r) {
             $temp = array();
             $temp[] = array('v' => (string) $r[0]);
             $temp[] = array('v' => (double) $r[1]);
             $rows[] = array('c' => $temp);
         }
     }
 }
예제 #14
0
 /**
  *  Write a config snippet to to a device using SSH
  */
 public function writeSnippetSSH($snippetArr, $prompt)
 {
     $log = ADLog::getInstance();
     if (!($ssh = new Net_SSH2($this->_hostname, 22, $this->_timeout))) {
         $output = "Failure: Unable to connect to {$this->_hostname}\n";
         $log->Conn("Failure: Unable to connect to " . $this->_hostname . " - (File: " . $_SERVER['PHP_SELF'] . ")");
         return false;
     }
     if (!$ssh->login($this->_username, $this->_password)) {
         $output = "Error: Authentication Failed for {$this->_hostname}\n";
         $log->Conn("Error: Authentication Failed for {$this->_hostname} (File: " . $_SERVER['PHP_SELF'] . ")");
         return false;
     }
     $output = '';
     if ($this->_enableMode === 'on') {
         // $ssh->write("\n"); // 1st linebreak after above prompt check
         $ssh->read('/.*>/', NET_SSH2_READ_REGEX);
         // read out to '>'
         $ssh->write("enable\n");
         $ssh->read('/.*:/', NET_SSH2_READ_REGEX);
         $ssh->write($this->_enableModePassword . "\n");
         $ssh->read('/' . $prompt . '/', NET_SSH2_READ_REGEX);
         foreach ($snippetArr as $key => $command) {
             $ssh->write($command . "\n");
             $output .= $ssh->read('/.*#/', NET_SSH2_READ_REGEX);
             // read out to '#'
         }
         $ssh->write("\n");
         // to line break after command output
         $ssh->read('/' . $prompt . '/', NET_SSH2_READ_REGEX);
     } else {
         // $ssh->write("\n"); // 1st linebreak after above prompt check
         $ssh->read('/' . $prompt . '/', NET_SSH2_READ_REGEX);
         foreach ($snippetArr as $key => $command) {
             $ssh->write($command . "\n");
             $output .= $ssh->read('/.*#/', NET_SSH2_READ_REGEX);
             // read out to '#' because the prompt will change depending on the deployed config
         }
         $ssh->write("\n");
         // to line break after command output
         $ssh->read('/' . $prompt . '/', NET_SSH2_READ_REGEX);
     }
     $ssh->disconnect();
     return $output;
 }
예제 #15
0
파일: NWPatient.php 프로젝트: bciv/COMS
function NewOrderPatient($drug, $dose, $Regimen_Dose_Unit, $Description, $match, $NumberofDoses)
{
    if ($Description === 'old') {
    } else {
        $orderday = date('m_d_Y');
        //Set Variables
        $host = $_SESSION['vista'];
        $username = $_SESSION['sshusr'];
        $AC = $_SESSION['AC'];
        $VC = $_SESSION['VC'];
        $password = '';
        $csession = 'csession cache355';
        $cdUnix = 'D ^%CD';
        $instance = 'CPM355';
        $cprsLogin = '******';
        $tmatch = trim($match);
        $patientSearch = $tmatch;
        $patientLocation = 'GEN MED';
        $actingProvider = 'v107';
        $doseorder = "" . $dose . " " . $Regimen_Dose_Unit . "";
        $schedule = 'QDAY';
        $routine = 'ROUTINE';
        $tdrug = trim($drug);
        $ssh = new Net_SSH2($host);
        if (!$ssh->login($username, $password)) {
            exit('Login Failed');
        }
        $ssh->write("\r");
        sleep(3);
        sleep(3);
        $ssh->write("\r");
        $ssh->write("{$AC}\r");
        $ssh->write("{$VC}\r");
        sleep(3);
        $ssh->write("\r");
        $ssh->write("OE\r");
        $ssh->write("FD\r");
        $ssh->write("{$patientSearch}\r");
        sleep(1);
        $ssh->write("AD\r");
        sleep(1);
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$patientLocation}\r");
        if ($Description === 'InPatient') {
            $ssh->write("15\r");
        } elseif ($Description === 'OutPatient') {
            $ssh->write("20\r");
        }
        $ssh->write("Provider, One\r");
        $ssh->write("1\r");
        sleep(1);
        sleep(1);
        if ($tdrug === '5-FU  FLUOROURACIL INJ,SOLN') {
            $ssh->write("5");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } elseif ($tdrug === '5-FLUOROURACIL  FLUOROURACIL INJ,SOLN') {
            $ssh->write("5");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } elseif ($tdrug === 'RANITIDINE TAB') {
            $ssh->write("RANITIDINE TAB ");
            /* Block below vvvvvvvvvvvvvvvvvv changed to match Sandbox - 30 May 2014 */
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } elseif ($tdrug === 'DEXAMETHASONE TAB') {
            $ssh->write("DEXAMETHASONE TAB");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("n");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$doseorder} MG");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } elseif ($tdrug === 'PROCHLORPERAZINE TAB') {
            $ssh->write("PROCHLORPERAZINE TAB");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("n");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$doseorder} MG");
            /* Block above ^^^^^^^^^^^^^^^^^^^^^^^ changed to match Sandbox - 30 May 2014 */
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } else {
            $ssh->write("{$tdrug}");
            $ssh->write("\r");
            sleep(1);
        }
        $ssh->write("n");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$doseorder}");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("1");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$schedule}");
        $ssh->write("\r");
        sleep(1);
        if ($Description === 'InPatient') {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("N");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(5);
            $ssh->write("P");
            $ssh->write("\r");
        } else {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("0");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("C");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(1);
            $ssh->write("P");
            $ssh->write("\r");
        }
        //Set SSH Timeout
        $ssh->setTimeout(1);
        //Read Results
        $SSHresults = $ssh->read();
        writeDebug($SSHresults, $tdrug, $patientSearch, $orderday);
    }
}
예제 #16
0
파일: VCFDrugs.php 프로젝트: bciv/COMS
function GetNDFLldf()
{
    //Set Variables
    //$host = '54.83.44.110';
    $host = $_SESSION['vista'];
    //$username = '******';
    $username = $_SESSION['sshusr'];
    $password = '';
    $login = '******';
    //$loginpass = '******';
    $loginpass = $_SESSION['sshpwd'];
    $csession = 'csession cache355';
    $ssh = new Net_SSH2($host);
    if (!$ssh->login($username, $password)) {
        exit('Login Failed');
    }
    $ssh->write("{$login}\r");
    $ssh->write("{$loginpass}\r");
    sleep(3);
    $ssh->write("CPRS1234\r");
    $ssh->write("CPRS4321\$\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("FM\r");
    $ssh->write("Other\r");
    $ssh->write("RX\r");
    $ssh->write("PSN\r");
    $ssh->write("RPRT\r");
    $ssh->write("LDF\r");
    $countr = 0;
    while ($countr <= 1000) {
        $ssh->write("\r");
        $countr++;
    }
    sleep(1);
    //Set SSH Timeout
    $ssh->setTimeout(1);
    //Read Results
    $SSHresults = $ssh->read();
    $txtremove = array("                                                      LOCAL DRUG LIST (ALPHABETI\nC)#   Not on National Formulary\n  R   National Formulary Restriction\n   \nLOCAL DRUG NAME                                   INACTIVE               DEA\n                                                                                \n    NDC                                             DATE");
    $SSHresultsNew = str_replace($txtremove, "", $SSHresults);
    $myFile = writeDrugFile($SSHresultsNew);
    $lineNum = 1;
    $count = 1;
    while ($count <= 194) {
        delLineFromFile($myFile, $lineNum);
        $count++;
    }
    $lineNum2 = 12741;
    $count2 = 1;
    while ($count2 <= 151) {
        delLineFromFile($myFile, $lineNum2);
        $count2++;
    }
    //Delete SQL
    $Dquery = "DELETE FROM LookUp WHERE Lookup_Type = 2";
    $DelDrugs = sqlsrv_query($conn, $Dquery);
    $str = file_get_contents($myFile);
    $array = preg_split('/[\\n\\r]+/', $str);
    foreach ($array as $i => $value) {
        $prefix = " ";
        $val = str_startswith($value, $prefix);
        if ($val === true) {
        } else {
            $prefix = "ZZ";
            $val = str_startswith($value, $prefix);
            if ($val === true) {
            } else {
                include "dbitcon.php";
                //$query = "INSERT INTO COMS_Drugs (Drugs) VALUES ('$value')";
                $query = "INSERT INTO LookUp (Lookup_Type,Name,Description) VALUES (2,'{$value}','NLM')";
                $postDrugs = sqlsrv_query($conn, $query);
            }
        }
    }
    file_put_contents($myFile, "{$str}");
    echo "Text file created and database entries updated in Lookup table for LookupType 2.";
}
예제 #17
0
 }
 $password = stripslashes(trim($_SESSION['password']));
 $username = stripslashes(trim($_SESSION['username']));
 if ($username == "") {
     $username = "******";
 }
 $ssh = new Net_SSH2('localhost');
 if (!$ssh->login($username, $password)) {
     exit('Login Failed');
 }
 echo "<font color='B22222'>Error!</font> OPENSSL.CNF not found... required, should have been copied in with PKITOOL, searching... <br /><br />";
 //Checking SSl version to see which one is installed, then try and match that to a CNF file (usually they have 1.0.1 or something in the cnf filename)
 echo "<pre>Running openssl version</pre>";
 echo str_repeat(' ', 1024 * 64);
 //purge buffer
 $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
 //Finding installed openssl version
 $ssh->write("openssl version\n");
 $ssh->setTimeout(10);
 $output = $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
 echo $output;
 echo "<br />";
 echo str_repeat(' ', 1024 * 64);
 //purge buffer
 //Looking for openssl version files
 $pattern = "/([0-9]+\\.+[0-9]+\\.+[0-9]+)/";
 if ($c = preg_match($pattern, $output, $matches)) {
     echo "<pre> Version Found: {$matches['0']} </pre><br />";
 } else {
     echo "No openssl version found? May need openssl installed!<br />";
 }
예제 #18
0
<?php

$output = shell_exec('sh PATCH_SUPEE-6788_CE_1.9.1.0_v1-2015-10-27-09-06-11.sh');
echo "<pre>{$output}</pre>";
exit;
include 'Crypt/RSA.php';
include 'Net/SSH2.php';
try {
    $key = new Crypt_RSA();
    //$key->setPassword('whatever');
    $key->loadKey(file_get_contents('id_rsa.ppk'));
    $ssh = new Net_SSH2('ftp.narayansoft.com');
    if (!$ssh->login('username', $key)) {
        exit('Login Failed');
    }
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
exit;
echo $ssh->read('username@username:~$');
$ssh->write("ls -la\n");
echo $ssh->read('username@username:~$');
예제 #19
0
 public function fire($job, $data)
 {
     $output = new Symfony\Component\Console\Output\ConsoleOutput();
     $node = Node::find($data['message']['node_id']);
     // Make sure node exists
     if (!$node) {
         $output->writeln("node doesn't exist anymore. no need for this job.");
         return $job->delete();
     }
     // Make sure node isn't terminated
     /*if($node->service_provider_status == "terminated") {
     			return $job->delete();
     		}*/
     // Make sure node is running
     if ($node->service_provider_status != "running") {
         return $job->release();
         $output->writeln("node is not running");
     }
     // Keys are always stored on S3. This is the NoS account.
     $s3 = \Aws\S3\S3Client::factory(array('key' => 'AKIAIUCV4E2L4HDCDOUA', 'secret' => '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', 'region' => 'us-east-1'));
     $all_keys = Key::where('integration_id', '=', $data['message']['integration_id'])->get();
     $unique_key_name = null;
     $cmdout = null;
     // Make sure the user has added credentials for this integration
     if ($all_keys->isEmpty()) {
         $problem = new Problem();
         $problem->description = "Couldn't deploy agent";
         $problem->reason = "No credentials added for this integration.<br /><br />You can manage your integration credentials on the <a href='#'>integrations</a> page.<br />Or <a href='#'>deploy manually</a>.";
         $problem->node_id = $node->id;
         $problem->long_message = true;
         $problem->save();
         $remediation = new Remediation();
         $remediation->name = "Cancel";
         $remediation->queue_name = "CancelDeployAgentToNode";
         $remediation->problem_id = $problem->id;
         $remediation->save();
         $remediation = new Remediation();
         $remediation->name = "Retry";
         $remediation->queue_name = "DeployAgentToNode";
         $remediation->problem_id = $problem->id;
         $remediation->save();
         return $job->delete();
     }
     $eventually_logged_in = false;
     foreach ($all_keys as $pem_key_reference) {
         if ($pem_key_reference->remote_url) {
             $unique_key_name = rand(0, 9999) . $pem_key_reference->remote_url;
             $key_bucket = App::isLocal() ? 'devkeys.nosprawl.software' : 'keys.nosprawl.software';
             $s3->getObject(array('Bucket' => $key_bucket, 'Key' => $pem_key_reference->remote_url, 'SaveAs' => '/tmp/' . $unique_key_name));
             exec('chmod 400 /tmp/' . $unique_key_name);
             $empty = null;
             $s3_resource_root = App::isLocal() ? 'http://agent.nosprawl.software/dev/' : 'http://agent.nosprawl.software/';
             $latest_version = exec("curl -s " . $s3_resource_root . "latest", $empty);
             $latest_version_url = $s3_resource_root . $latest_version;
             $ssh = new Net_SSH2($node->public_dns_name);
             $ssh->enableQuietMode();
             $ssh->enablePTY();
             $key = new Crypt_RSA();
             $key->loadKey(file_get_contents('/tmp/' . $unique_key_name));
             exec('rm -rf /tmp/' . $unique_key_name);
             if (!$ssh->login($pem_key_reference->username, $key)) {
                 $output->writeln("ssh fail.");
                 continue;
             } else {
                 $output->writeln("we are in ssh just fine.");
                 // Let's look for any problems running sudo first.
                 $ssh->exec("sudo whoami");
                 $exit_status = $ssh->getExitStatus();
                 if (!$exit_status && $exit_status != 0) {
                     // User can't sudo without a password. We can't auto-install.
                     $problem = new Problem();
                     $problem->description = "Couldn't deploy agent";
                     $problem->reason = "User '" . $pem_key_reference->username . "' doesn't have passwordless sudo priviliges. Please either enable  it or <a class='problem_cta_btn' href='#'>Manually deploy the NoSprawl Agent</a>";
                     $problem->node_id = $node->id;
                     $problem->long_message = true;
                     $problem->save();
                     $remediation = new Remediation();
                     $remediation->name = "Cancel";
                     $remediation->queue_name = "CancelDeployAgentToNode";
                     $remediation->problem_id = $problem->id;
                     $remediation->save();
                     $remediation = new Remediation();
                     $remediation->name = "Retry";
                     $remediation->queue_name = "DeployAgentToNode";
                     $remediation->problem_id = $problem->id;
                     $remediation->save();
                     return $job->delete();
                 }
                 $result = $ssh->read();
                 $output->writeln($result);
                 // Check for problems with curl
                 $ssh->exec("curl --help");
                 $curl_result = $ssh->read();
                 $curl_exit_status = $ssh->getExitStatus();
                 if ($curl_exit_status != 0) {
                     $problem = new Problem();
                     $problem->description = "Couldn't deploy agent";
                     $problem->reason = "cURL isn&rsquo;t installed.";
                     $problem->node_id = $node->id;
                     $problem->save();
                     $remediation = new Remediation();
                     $remediation->name = "Install cURL";
                     $remediation->queue_name = "InstallCurlAndRetryDeployment";
                     $remediation->problem_id = $problem->id;
                     $remediation->save();
                     $remediation = new Remediation();
                     $remediation->name = "Cancel";
                     $remediation->queue_name = "CancelDeployAgentToNode";
                     $remediation->problem_id = $problem->id;
                     $remediation->save();
                     return $job->delete();
                 }
                 $ssh->exec("(curl " . $latest_version_url . " > nosprawl-installer.rb) && sudo ruby nosprawl-installer.rb && rm -rf nosprawl-installer.rb");
                 $installer_result = $ssh->read();
                 $installer_exit_status = $ssh->getExitStatus();
                 if ($installer_exit_status == 0) {
                     // Everything is good.
                     $node->limbo = false;
                     $node->save();
                     return $job->delete();
                 } else {
                     $problem = new Problem();
                     $problem->description = "Couldn't deploy agent";
                     $problem->reason = "Ruby isn't installed.";
                     $problem->node_id = $node->id;
                     $problem->save();
                     $remediation = new Remediation();
                     $remediation->name = "Install";
                     $remediation->queue_name = "InstallRubyAndRetryDeployment";
                     $remediation->problem_id = $problem->id;
                     $remediation->save();
                     $remediation = new Remediation();
                     $remediation->name = "Cancel";
                     $remediation->queue_name = "CancelDeployAgentToNode";
                     $remediation->problem_id = $problem->id;
                     $remediation->save();
                     return $job->delete();
                 }
                 return $job->delete();
             }
         } else {
             $output->writeln("This is what we do if all we have is a password.");
             continue;
         }
     }
     if (!$eventually_logged_in) {
         $problem = new Problem();
         $problem->description = "Couldn't deploy agent";
         $problem->reason = "None of the credentials provided were sufficient to connect to this node. Manage your credentials on the <a href='#'>integrations</a> page.<br />Or <a href='#'>deploy manually</a>.";
         $problem->node_id = $node->id;
         $problem->long_message = true;
         $problem->save();
         $remediation = new Remediation();
         $remediation->name = "Cancel";
         $remediation->queue_name = "CancelDeployAgentToNode";
         $remediation->problem_id = $problem->id;
         $remediation->save();
         $remediation = new Remediation();
         $remediation->name = "Retry";
         $remediation->queue_name = "DeployAgentToNode";
         $remediation->problem_id = $problem->id;
         $remediation->save();
         return $job->delete();
     }
 }