* * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ ini_set('max_execution_time', '300'); require_once 'av_init.php'; Session::logcheck('environment-menu', 'TrafficCapture'); $info_error = array(); $jtimeout = 3000; $db = new ossim_db(); $dbconn = $db->connect(); $scan = new Traffic_capture(); $sensors_status = $scan->get_status(); if (!$sensors_status) { $sensors_status = array(); } // variables to display notifications $message_info = ''; $type = ''; $content = ''; // Parameters to delete scan $op = GET('op'); $scan_name = GET('scan_name'); $sensor_ip = GET('sensor_ip'); // Others parameters $soptions = intval(GET('soptions')); ossim_valid($op, OSS_NULLABLE, 'delete', 'illegal:' . _('Option'));
ossim_valid($sensor_ip, OSS_IP_ADDR, 'illegal:' . _('Sensor ip')); if (ossim_error()) { die(ossim_error()); } $db = new ossim_db(); $dbconn = $db->connect(); $scan_info = explode('_', $scan_name); $users = Session::get_users_to_assign($dbconn); $my_users = array(); foreach ($users as $k => $v) { $my_users[$v->get_login()] = 1; } if ($my_users[$scan_info[1]] != 1 && !Session::am_i_admin()) { return; } $scan = new Traffic_capture(); $file = $scan->get_pcap_file($scan_name, $sensor_ip); if (preg_match("/^E/i", $file)) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> <?php echo gettext("OSSIM Framework"); ?> - Traffic capture </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <meta http-equiv="Pragma" content="no-cache"/> <link rel="stylesheet" type="text/css" href="../style/av_common.css?t=<?php echo Util::get_css_id(); ?>
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once 'av_init.php'; Session::logcheck('environment-menu', 'TrafficCapture'); $ips = POST('ips'); $ips_array = explode("#", $ips); $output = array(); foreach ($ips_array as $ip) { ossim_valid($ip, OSS_NULLABLE, OSS_IP_ADDR, 'illegal:' . _("IP Address")); if (ossim_error()) { die(ossim_error()); } if (Session::sensorAllowed($ip)) { $scan = new Traffic_capture(); $result = $scan->get_scan_status($ip); $output[] = md5($ip) . "|" . $result["status"] . "|" . $result["packets"] . "|" . $result["total_packets"] . "|" . $result["packet_percentage"] . "|" . $result["elapsed_time"] . "|" . $result["total_time"] . "|" . $result["time_percentage"] . "|" . $result["errno"] . "\n"; } } echo implode("\n", $output);
$raw_filter = $parameters['raw_filter'] = POST('raw_filter'); $sensor_ip = $parameters['sensor_ip'] = POST('sensor_ip'); $sensor_interface = $parameters['sensor_interface'] = POST('sensor_interface'); $soptions = intval(POST('soptions')); $validate = array('src' => array('validation' => "OSS_NULLABLE, OSS_DIGIT, OSS_SPACE, OSS_SCORE, OSS_INPUT, OSS_NL, '\\.\\,\\/'", 'e_message' => 'illegal:' . _('Source')), 'dst' => array('validation' => "OSS_NULLABLE, OSS_DIGIT, OSS_SPACE, OSS_SCORE, OSS_INPUT, OSS_NL, '\\.\\,\\/'", 'e_message' => 'illegal:' . _('Destination')), 'timeout' => array('validation' => 'OSS_DIGIT', 'e_message' => 'illegal:' . _('Timeout')), 'cap_size' => array('validation' => 'OSS_NULLABLE, OSS_DIGIT', 'e_message' => 'illegal:' . _('Cap. size')), 'raw_filter' => array('validation' => "OSS_NULLABLE, OSS_ALPHA , '\\.\\|\\&\\=\\<\\>\\!\\^'", 'e_message' => 'illegal:' . _('Raw Filter')), 'sensor_ip' => array('validation' => 'OSS_IP_ADDR', 'e_message' => 'illegal:' . _('Sensor')), 'sensor_interface' => array('validation' => 'OSS_INPUT', 'e_message' => 'illegal:' . _('Interface'))); foreach ($parameters as $k => $v) { eval("ossim_valid(\$v, " . $validate[$k]['validation'] . ", '" . $validate[$k]['e_message'] . "');"); if (ossim_error()) { $info_error[] = ossim_get_error(); ossim_clean_error(); } } $db = new ossim_db(); $dbconn = $db->connect(); $keytree = "assets"; $scan = new Traffic_capture(); $states = array('0' => _('Idle'), '1' => _('A Pending Capture'), '2' => _('Capturing'), '-1' => _('Error When Capturing')); $scans_by_sensor = $scan->get_scans(); $sensors_status = $scan->get_status(); if (!$scans_by_sensor) { $scans_by_sensor = array(); } if (!$sensors_status) { $sensors_status = array(); } foreach ($sensors_status as $sensor_ip => $value) { if (!Session::sensorAllowed($sensor_ip)) { unset($sensors_status[$sensor_ip]); } } // get sensors to get scan status