示例#1
0
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("environment-menu", "EventsVulnerabilities");
$tasks = GET("tasks");
if (!preg_match("/^[\\d\\#]+\$/", $tasks)) {
    die;
}
if (Vulnerabilities::scanner_type() == "omp") {
    $tresult = array();
    $omp = new Omp();
    $ids = explode("#", $tasks);
    foreach ($ids as $id) {
        $sparkline_count = 0;
        $details = $omp->get_task_detail_by_id("Running|Paused|Pause Requested|Requested", $id, true);
        if (preg_match("/(\\d+)\\|(\\d+)\\|(\\d+)\\|(\\d+)\\|(\\d+)/", $details["total"], $found)) {
            $sparkline_count = $found[1] + $found[2] + $found[3] + $found[4] + $found[5];
        }
        $tresult[] = $id . "|" . $sparkline_count . "|" . str_replace("|", ";", $details["detail"]);
    }
    echo implode("-", $tresult);
}
示例#2
0
}
$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);
        break;
    case "pause_task":
        $omp->pause_task($job_id);
        break;
    case "stop_task":
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("environment-menu", "EventsVulnerabilitiesScan");
$conf = $GLOBALS["CONF"];
$host = $conf->get_conf("nessus_host", FALSE);
$user = $conf->get_conf("nessus_user", FALSE);
$pass = $conf->get_conf("nessus_pass", FALSE);
$port = $conf->get_conf("nessus_port", FALSE);
$omp = new Omp($host, $port, $user, $pass);
$data = array();
$cmd = "ps ax | grep updateplugins.pl | egrep -v 'grep'";
$output = Util::execute_command($cmd, FALSE, 'array');
$data['running'] = preg_match('/updateplugins/', $output[0]) ? 'yes' : 'no';
$data['lines'] = '';
if ($data['running'] == 'yes' && file_exists('/var/tmp/openvas_update')) {
    $all_lines = array_map("trim", file('/var/tmp/openvas_update'));
    $data['lines'] = array_diff($all_lines, $_SESSION['openvas_update_last_lines']);
    $data['lines'] = implode("<br />", $data['lines']);
    $_SESSION['openvas_update_last_lines'] = $all_lines;
} elseif ($omp->are_there_pending_tasks()) {
    $data['running'] = 'pending';
    $data['lines'] = _('Unable to launch REPAIR SCANNER DB, because there are running tasks.');
} else {
    $data['lines'] = '';