function delete_nfsen($sensor, $nfsen_list = array()) { if (empty($nfsen_list)) { $nfsen_list = get_nfsen_sensors(); } if (count($nfsen_list) <= 1) { $data['status'] = 'error'; $data['data'] = _('You cannot delete this source, at least one Nfsen source is needed'); } elseif ($nfsen_list[$sensor] != '') { unset($nfsen_list[$sensor]); set_nfsen_sensors($nfsen_list); nfsen_reset($nfsen_dir); // Talk to frameworkd try { $s = new Frameworkd_socket(); $s->write('nfsen action="delsensor" sensorname="' . $sensor . '"'); $data['status'] = 'success'; $data['data'] = _('NFSEN sensor deleted successfully'); } catch (Exception $e) { $data['status'] = 'error'; $data['data'] = $e->getMessage(); } } return $data; }
$type = 'UDP'; break; case 3: $type = 'ICMP'; break; case 4: $type = 'other'; break; default: die(_('Wrong type')); } $limit = $limit < 1 || $limit > 7 ? 1 : $limit; $end = time(); $begind = $end - $limit * 86400; //86400 belongs to 24 hours in seconds --> 24*60*60 $nfsen_sensors = get_nfsen_sensors(); $sensor_list = ''; foreach ($nfsen_sensors as $flow_id => $sdata) { if (!Av_sensor::is_channel_allowed($conn, $flow_id)) { continue; } $sname = Av_sensor::get_nfsen_channel_name($conn, $flow_id); $sensor_list .= "{$flow_id};{$sname}:"; } $sensor_list = preg_replace('/:$/i', '', $sensor_list); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php
} } } else { $ips = $asset_object->get_ips(); $filter_values = array_keys($ips->get_ips('array')); $filter_key = 'ip'; } // Make filter foreach ($filter_values as $val) { if ($cmd_opts['filter'][0] != '') { $cmd_opts['filter'][0] .= ' or'; } $cmd_opts['filter'][0] .= " {$filter_key} {$val}"; } //Getting the sources of the nsfen: We need to check if the sensors of the host are nfsen sources. $sources = get_nfsen_sensors(); $asset_sensors = is_array($asset_sensors) ? $asset_sensors : array(); $n_src_list = array(); foreach ($asset_sensors as $_sensor_id => $_sensor_data) { $sensor_object = Av_sensor::get_object($conn, $_sensor_id); $channel_id = $sensor_object->get_nfsen_channel_id($conn); if (array_key_exists($channel_id, $sources)) { $n_src_list[] = $channel_id; } } $cmd_opts['srcselector'] = implode(':', $n_src_list); //Adding the timing window. Only one hour $date_from = date('Y-m-d', strtotime('-1 hour')); $date_from_format = str_replace('-', '', $date_from); $date_to = date('Y-m-d'); $date_to_format = str_replace('-', '', $date_to);