Example #1
0
            </div>
        </td>
    </tr>
    </table>
<?php 
}
$commands = array("play_task", "pause_task", "stop_task", "resume_task", "delete_task");
// OMP commands
if (in_array($disp, $commands)) {
    // get server info to manage tasks
    $uuid = Util::get_system_uuid();
    $result_server = $dbconn->Execute("SELECT meth_Wcheck FROM vuln_jobs WHERE id=" . $job_id);
    preg_match("/.*\\s(\\d+\\.\\d+\\.\\d+\\.\\d+)<.*/", $result_server->fields['meth_Wcheck'], $found);
    $sensor_id = Av_sensor::get_id_by_ip($dbconn, $found[1]);
    $sensor_object = new Av_sensor($sensor_id);
    $sensor_object->load_from_db($dbconn);
    $ov_credentials = $sensor_object->get_vs_credentials($dbconn);
    $port = $ov_credentials['port'];
    $user = $ov_credentials['user'];
    $password = $ov_credentials['password'];
    $omp = new Omp($sensor_object->get_ip(), $port, $user, $password);
}
switch ($disp) {
    case "kill":
        $schedid = intval($schedid);
        if ($schedid > 0) {
            system("sudo /usr/share/ossim/scripts/vulnmeter/cancel_scan.pl {$schedid}");
        }
        break;
    case "play_task":
        $omp->play_task($job_id);
Example #2
0
                $ng_selected = count($sensors_nagios);
            }
            $sensors_nagios[] = array('id' => $sid, 'ip' => $s['ip'], 'name' => $s['name'], 'selected' => $option);
        }
    }
}
//If we have permissions to see any sensor...
if (!empty($sensors_nagios)) {
    if ($ng_selected == -1) {
        $ng_selected = 0;
    }
    $_ip = $sensors_nagios[$ng_selected]['ip'];
    //Remote ossim sensors and remote nagios...
    if ($_ip != '' && $_ip != 'localhost' && $_ip != Util::get_default_admin_ip() && $_ip != $_SERVER['SERVER_NAME']) {
        $_sensor = new Av_sensor($sensors_nagios[$ng_selected]['id']);
        $_sensor->load_from_db($conn);
        $nagios_options = $_sensor->get_nagios_credentials($conn);
        $_s_user = $nagios_options['user'];
        $_s_pass = $nagios_options['password'];
        try {
            $nagios_url = $_sensor->get_nagios_url($_s_user, $_s_pass);
            $nagios = $nagios_url['url'];
            $nagios_opts = $nagios_url['s_context'];
            if (preg_match('/^http:\\/\\//', $nagios) && $_s_user != '' && $_s_pass != '') {
                $nagios = str_replace('http://', "http://{$_s_user}:{$_s_pass}@", $nagios);
            } elseif (preg_match('/^https:\\/\\//', $nagios) && $nagios_opts['http']['header'] != '') {
                $flag_login = TRUE;
                $_login = base64_encode(Util::encrypt($_s_user . "####" . md5($_s_pass), $conf->get_conf('remote_key')));
                $_SESSION['_remote_nagios_credential'] = array($_ip, $_login);
            }
        } catch (Exception $e) {