} ossim_valid($delete, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("delete")); ossim_valid($status, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("status")); ossim_valid($restart, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("restart")); if (ossim_error()) { echo _("You must fill all inputs"); } else { require_once 'ossim_conf.inc'; $ossim_conf = $GLOBALS["CONF"]; $main_ip = $ossim_conf->get_conf("frameworkd_address"); $nfsen_sensors = get_nfsen_sensors(); if ($delete) { if ($nfsen_sensors[$name] != "") { unset($nfsen_sensors[$name]); set_nfsen_sensors($nfsen_sensors); nfsen_reset($nfsen_dir); echo str_replace("IP", $ip, _("IP now is not configured as a Flow collector")); } } elseif ($status) { is_running($name); } elseif ($restart) { nfsen_start(); } else { $nfsen_sensors[$name]['port'] = $port; $nfsen_sensors[$name]['color'] = $color; $nfsen_sensors[$name]['type'] = $type; set_nfsen_sensors($nfsen_sensors); nfsen_reset(); echo str_replace("IP", $main_ip, str_replace("PORT", $port, _("You should now configure your Flows generator to send Flows to IP port PORT. A new exception must be created in AlienVault firewall"))); } }
$s->write('nfsen action="delsensor" sensorname="' . $sensor_name . '"'); $db = new ossim_db(); $conn = $db->connect(); $sensor_ip = Av_sensor::get_ip_by_id($conn, $sensor_id); $db->close(); $data['status'] = 'success'; $data['data'] = Util::js_entities(str_replace('IP', $sensor_ip, _('IP now is not configured as a Flow collector'))); } catch (Exception $e) { $data['status'] = 'error'; $data['data'] = Util::js_entities($e->getMessage()); } } } break; case 'restart': $data = nfsen_start(); break; case 'reconfig': $data = reconfig_system(); break; case 'configure': $sensor_id = POST('sensor_id'); $port = POST('port'); $color = '#' . POST('color'); $type = POST('type'); ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID')); ossim_valid($port, OSS_DIGIT, 'illegal:' . _('Port')); ossim_valid($color, OSS_HEXCOLOR, 'illegal:' . _('Color')); ossim_valid($type, OSS_ALPHA, 'illegal:' . _('Type')); if (ossim_error()) { $data['status'] = 'error';