} else { $get_param = "name={$net_name}&withoutmenu=1"; } if (POST('insert')) { if ($error == true) { $txt_error = "<div>" . _("We Found the following errors") . ":</div><div style='padding:10px;'>" . implode("<br/>", $message_error) . "</div>"; Util::print_error($txt_error); Util::make_form("POST", "newnetform.php?" . $get_param); die; } $db = new ossim_db(); $conn = $db->connect(); Net::insert($conn, $net_name, $cidr, $asset, $threshold_c, $threshold_a, $rrd_profile, $alert, $persistence, $sensors, $descr, $icon); //if ( POST('nessus') ) { Net_scan::insert($conn, $net_name, 3001, 0); } if ($nagios) { Net_scan::insert($conn, $net_name, 2007, 0); } $db->close($conn); Util::clean_json_cache_files("(policy|vulnmeter|hostgroup)"); } if (isset($_SESSION['_net'])) { unset($_SESSION['_net']); } if ($_SESSION["menu_sopc"] == "Networks" && POST('withoutmenu') != "1") { ?> <p> <?php echo gettext("Network succesfully inserted"); ?> </p> <script type='text/javascript'>document.location.href="net.php"</script> <?php
require_once 'classes/Host_group.inc'; require_once 'classes/Host_scan.inc'; $db = new ossim_db(); $conn = $db->connect(); define("NESSUS", 3001); $sensor_list = array(); // Quick & dirty sensor index array for "sensor#" further below $sensor_index = array(); $tmp_index = 0; //$tmp_sensors = Sensor::get_all($conn, "ORDER BY name ASC"); $tmp_sensors = Sensor::get_list($conn, "ORDER BY name ASC"); // For filtering user perms $tmp_group_hosts = Host_group_scan::get_list($conn, "WHERE plugin_id = 3001 ORDER BY host_group_name ASC"); $tmp_group_nets = Net_group_scan::get_list($conn, "WHERE plugin_id = 3001 ORDER BY net_group_name ASC"); $tmp_host = Host_scan::get_list($conn, "WHERE plugin_id = 3001 ORDER BY host_ip ASC"); $tmp_nets = Net_scan::get_list($conn, "WHERE plugin_id = 3001 ORDER BY net_name ASC"); $net_group_index = array(); $host_group_index = array(); $hosts_index = array(); $nets_index = array(); $net_group_list = array(); $host_group_list = array(); $hosts_list = array(); $nets_list = array(); foreach ($tmp_sensors as $sensor) { if (Sensor::check_plugin_rel($conn, $sensor->get_ip(), NESSUS)) { $sensor_index[$sensor->get_name()] = $tmp_index; $tmp_index++; array_push($sensor_list, $sensor); } }
$xml .= "<cell><![CDATA[" . $net->get_threshold_c() . "]]></cell>"; $xml .= "<cell><![CDATA[" . $net->get_threshold_a() . "]]></cell>"; $rep = ""; if ($linkedocs = Repository::have_linked_documents($conn, $name, 'net')) { $rep .= "<a href=\"javascript:;\" onclick=\"GB_edit('../repository/repository_list.php?keyname=" . urlencode($name) . "&type=net')\" class=\"blue\">[" . $linkedocs . "]</a> "; } $rep .= "<a href=\"../repository/index.php?hmenu=Repository&smenu=Repository\" target='main'><img src=\"../pixmaps/tables/table_edit.png\" title=\"Edit KDB\" alt=\"Edit KDB\" border=0 align=\"absmiddle\"></a>"; $xml .= "<cell><![CDATA[" . $rep . "]]></cell>"; /* Nessus if ($scan_list = Net_scan::get_list($conn, "WHERE net_name = '$name' AND plugin_id = 3001")) { $scan_types = "<img src='../pixmaps/tables/tick.png'>"; } else { $scan_types = "<img src='../pixmaps/tables/cross.png'>"; } $xml.= "<cell><![CDATA[" . $scan_types . "]]></cell>"; */ // Nagios if ($scan_list = Net_scan::get_list($conn, "WHERE net_name = '{$name}' AND plugin_id = 2007")) { $scan_types = "<img src='../pixmaps/tables/tick.png'>"; } else { $scan_types = "<img src='../pixmaps/tables/cross.png'>"; } $xml .= "<cell><![CDATA[" . $scan_types . "]]></cell>"; $xml .= "</row>\n"; } $xml .= "</rows>\n"; echo $xml; $db->close($conn); ?>
require_once 'ossim_conf.inc'; require_once 'classes/Net.inc'; require_once 'classes/Net_scan.inc'; $db = new ossim_db(); $conn = $db->connect(); if (Net::can_delete($conn, $name)) { $conf = $GLOBALS["CONF"]; $version = $conf->get_conf("ossim_server_version", FALSE); if (!preg_match("/pro|demo/i", $version)) { Net::delete($conn, $name); } else { Net::delete($conn, $name, 0, 0); } // also delete linked nets in templates Net_scan::delete($conn, $name, 3001); Net_scan::delete($conn, $name, 2007); } else { echo "ERROR_CANNOT"; } $db->close($conn); ?> <p> <?php echo gettext("Net deleted"); ?> </p> <p><a href="net.php"><?php echo gettext("Back"); ?> </a></p>
<h3><center> <?php echo _("Select sensors for this scan"); ?> </center></h3> <ul> <?php $tmp_sensors = Sensor::get_all($conn, "ORDER BY name ASC"); $sensor_list = array(); // Quick & dirty sensor index array for "sensor#" further below $sensor_index = array(); $tmp_index = 0; $tmp_group_hosts = Host_group_scan::get_list($conn, "ORDER BY host_group_name ASC"); $tmp_group_nets = Net_group_scan::get_list($conn, "ORDER BY net_group_name ASC"); $tmp_host = Host_scan::get_list($conn, "ORDER BY host_ip ASC"); $tmp_nets = Net_scan::get_list($conn, "ORDER BY net_name ASC"); $global_i = 0; define("NESSUS", 3001); $net_group_index = array(); $host_group_index = array(); $hosts_index = array(); $nets_index = array(); $net_group_list = array(); $host_group_list = array(); $hosts_list = array(); $nets_list = array(); foreach ($tmp_sensors as $sensor) { if (Sensor::check_plugin_rel($conn, $sensor->get_ip(), NESSUS)) { $sensor_index[$sensor->get_name()] = $tmp_index; $tmp_index++; array_push($sensor_list, $sensor);
$descr = ""; $sensors = array(); if ($net_name != '') { ossim_valid($net_name, OSS_ALPHA, OSS_SPACE, OSS_PUNC, OSS_NULLABLE, OSS_SQL, 'illegal:' . _(" Network Name")); if (ossim_error()) { die(ossim_error()); } if ($net_list = Net::get_list($conn, "name = '{$net_name}'")) { $net = $net_list[0]; $descr = $net->get_descr(); $cidr = $net->get_ips(); $asset = $net->get_asset(); $threshold_a = $net->get_threshold_a(); $threshold_c = $net->get_threshold_c(); $icon = $net->get_imgtag(); $nagios = Net_scan::in_net_scan($conn, $net_name, 2007) ? "1" : ''; $rrd_profile = $net->get_rrd_profile(); if (!$rrd_profile) { $rrd_profile = "None"; } $tmp_sensors = $net->get_sensors($conn); foreach ($tmp_sensors as $sensor) { $sensors[] = $sensor->get_sensor_name(); } } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html>