Example #1
0
        }
    }
}
if (!isset($_SESSION["_response_descr"]) or $_REQUEST["descr_clear"]) {
    $_SESSION["_response_descr"] = "";
}
if ($_REQUEST["descr"] && $_REQUEST["descr_add"]) {
    $_SESSION["_response_descr"] = $_REQUEST["descr"];
}
require_once 'ossim_db.inc';
$db = new ossim_db();
$conn = $db->connect();
require_once 'classes/Response.inc';
if ($_REQUEST["insert_response"]) {
    /* insert response-action policy */
    Response::insert($conn, $_SESSION["_response_descr"], $_SESSION["_response_source_net"], $_SESSION["_response_source_host"], $_SESSION["_response_dest_net"], $_SESSION["_response_dest_host"], $_SESSION["_response_sensor"], $_SESSION["_response_source_port"], $_SESSION["_response_dest_port"], $_SESSION["_response_plugin"], $_SESSION["_response_action"]);
    /* clean session variables */
    foreach ($RESPONSE_OBJECTS as $object) {
        unset($_SESSION["_response_" . $object]);
    }
    unset($_SESSION["_response_descr"]);
    echo '<p align="center">Response-Action policy inserted<br/>
          <a href="response.php">Back</a></p>';
    print '</body></html>';
    exit;
}
/* hosts */
require_once 'classes/Host.inc';
$host_list = Host::get_list($conn);
$hosts[] = array("value" => ANY, "name" => "ANY");
foreach ($host_list as $h) {
Example #2
0
    if ($actions) {
        foreach ($actions as $action_id) {
            ossim_valid($action_id, OSS_DIGIT, 'illegal:' . _("Action ID"));
            $responses[] = $action_id;
        }
    }
    if ($order == 0) {
        $order = Policy::get_next_order($conn, $group);
    }
    $newid = Policy::insert($conn, $priority, $active, $group, $order, $begin_hour, $end_hour, $begin_day, $end_day, $descr, $source_ips, $source_host_groups, $dest_ips, $dest_host_groups, $source_nets, $source_net_groups, $dest_nets, $dest_net_groups, $ports, $plug_groups, $sensors, $target, $correlate, $cross_correlate, $store, $qualify, $resend_alarms, $resend_events, $sign, $sem, $sim);
    // Response/Actions
    if (count($responses) > 0) {
        foreach ($responses as $action_id) {
            Policy_action::insert($conn, $action_id, $newid);
        }
        Response::insert($conn, "policy {$newid}", $source_nets, $source_ips, $dest_nets, $dest_ips, $sensors, $ports, $ports, $plug_ids, $responses);
    }
    ?>
    <p> <?php 
    echo gettext("Policy succesfully inserted");
    ?>
 </p>
    <script>document.location.href="policy.php"</script>
<?php 
    $db->close($conn);
}
// update indicators on top frame
$OssimWebIndicator->update_display();
?>

</body>