require_once 'classes/Net.inc'; $net_list = Net::get_list($conn); $nets[] = array("value" => ANY, "name" => "ANY"); foreach ($net_list as $n) { $nets[] = array("value" => $n->get_name(), "name" => $n->get_name()); } /* sensors */ require_once 'classes/Sensor.inc'; $sensor_list = Sensor::get_list($conn); $sensors[] = array("value" => ANY, "name" => "ANY"); foreach ($sensor_list as $s) { $sensors[] = array("value" => $s->get_ip(), "name" => $s->get_name() . " (" . $s->get_ip() . ")"); } /* ports */ require_once 'classes/Port_group.inc'; $port_list = Port_group::get_list($conn); $ports[] = array("value" => ANY, "name" => "ANY"); foreach ($port_list as $p) { $ports[] = array("value" => $p->get_name(), "name" => $p->get_name() . " (" . $p->get_descr() . ")"); } /* plugins */ require_once 'classes/Plugin.inc'; $plugin_list = Plugin::get_list($conn); $plugins[] = array("value" => ANY, "name" => "ANY"); foreach ($plugin_list as $p) { $plugins[] = array("value" => $p->get_id(), "name" => $p->get_name() . " (" . $p->get_id() . ")"); } /* actions */ require_once 'classes/Action.inc'; $action_list = Action::get_list($conn); if (is_array($action_list)) {
} ossim_valid($order, OSS_ALPHA, OSS_SPACE, OSS_SCORE, OSS_NULLABLE, 'illegal:' . _("order")); ossim_valid($page, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("page")); ossim_valid($rp, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("rp")); if (ossim_error()) { die(ossim_error()); } if (empty($order)) { $order = "name"; } $start = ($page - 1) * $rp; $limit = "LIMIT {$start}, {$rp}"; $db = new ossim_db(); $conn = $db->connect(); $xml = ""; $port_list = Port_group::get_list($conn, "ORDER BY {$order} {$limit}"); if ($port_list[0]) { $total = $port_list[0]->get_foundrows(); if ($total == 0) { $total = count($port_list); } } else { $total = 0; } $xml .= "<rows>\n"; $xml .= "<page>{$page}</page>\n"; $xml .= "<total>{$total}</total>\n"; foreach ($port_list as $port_group) { $name = $port_group->get_name(); $xml .= "<row id='" . htmlspecialchars(utf8_encode($name)) . "'>"; $link_modify = "<a style='font-weight:bold;' href=\"./newportform.php?portname=" . urlencode($name) . "\">" . Util::htmlentities($name) . "</a>";
ossim_valid($key, OSS_NULLABLE, OSS_TEXT, OSS_PUNC, 'illegal:' . _("Key")); if (ossim_error()) { die(_("Invalid Parameter key")); } $cachefile = "/var/ossim/sessions/" . $_SESSION["_user"] . "_ports_" . base64_encode($key) . ".json"; if (file_exists($cachefile)) { readfile($cachefile); exit; } require_once 'classes/Port_group.inc'; require_once 'ossim_db.inc'; $db = new ossim_db(); $conn = $db->connect(); $port_groups = array(); $buffer = ""; if ($port_group_list = Port_group::get_list($conn, "ORDER BY name")) { foreach ($port_group_list as $port_group) { $pg_name = $port_group->get_name(); $pg_ports = $port_group->get_reference_ports($conn, $pg_name); $pg_descr = $port_group->get_descr(); if (!preg_match("/ANY/i", $pg_name)) { $port_groups[] = array($pg_name, $pg_ports, $pg_descr); } else { $port_groups[] = array($pg_name, array(), ""); } } } if ($key == "") { $buffer .= "[ {title: '" . _("Port Groups") . "', key:'key1', isFolder:true, icon:'../../pixmaps/theme/ports.png', expand:true\n"; if (count($port_groups) > 0) { $j = 1;
$ports_input = implode(",", $arr_ports_input); if (isset($_SESSION['_portgroup'])) { $pgname = $_SESSION['_portgroup']['pgname']; $actives_ports = $_SESSION['_portgroup']['actives_ports']; $descr = $_SESSION['_portgroup']['descr']; unset($_SESSION['_portgroup']); } else { $pgname = GET('portname'); $descr = ""; $actives_ports = array(); if ($pgname != '') { ossim_valid($pgname, OSS_ALPHA, OSS_SCORE, OSS_SPACE, OSS_PUNC, 'illegal:' . _("Port Group Name")); if (ossim_error()) { die(ossim_error()); } if ($port_group_list = Port_group::get_list($conn, "WHERE name = '{$pgname}'")) { $port_group = $port_group_list[0]; } //if ($port_list = Port::get_list($conn)) if ($port_list) { $actives_ports = Port_group_reference::in_port_group_reference_for_name($conn, $port_group->get_name()); /* foreach($port_list as $port) { //$is_active = Port_group_reference::in_port_group_reference($conn, $port_group->get_name() , $port->get_port_number() , $port->get_protocol_name()); if ( $is_active ) $actives_ports[] = $port->get_port_number()." - ". $port->get_protocol_name(); } */ }
* */ require_once 'av_init.php'; Session::logcheck('configuration-menu', 'PolicyPorts'); $db = new ossim_db(TRUE); $conn = $db->connect(); $update = intval(GET('update')); $id = GET('id'); $descr = ''; $actives_ports = array(); if ($id != '') { ossim_valid($id, OSS_DIGIT, 'illegal:' . _('Port Group ID')); if (ossim_error()) { die(ossim_error()); } if ($port_group_list = Port_group::get_list($conn, "WHERE id = {$id}")) { $port_group = $port_group_list[0]; } $actives_ports = Port_group_reference::in_port_group_reference_for_id($conn, $id); $pgname = $port_group->get_name(); $descr = $port_group->get_descr(); $ctx = $port_group->get_ctx(); } $action = GET('id') != '' ? 'modifyportgroup.php' : 'newportgroup.php'; if (!Session::show_entities()) { $ctx = Session::get_default_ctx(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html>