Ejemplo n.º 1
0
 }
 $buffer .= "</td>";
 $orig_date = $alarm->get_timestamp();
 $date = Util::timestamp2date($orig_date);
 $orig_date = $date;
 $event_date = $date;
 $event_date_uut = Util::get_utc_unixtime($event_date);
 $date = gmdate("Y-m-d H:i:s", $event_date_uut + 3600 * $tz);
 $event_date = gmdate("Y-m-d H:i:s", $event_date_uut + 3600 * $alarm->get_tzone());
 $src_ip = $alarm->get_src_ip();
 $dst_ip = $alarm->get_dst_ip();
 $src_port = $alarm->get_src_port();
 $dst_port = $alarm->get_dst_port();
 $src_port = $src_port != 0 ? ":" . Port::port2service($conn, $src_port) : "";
 $dst_port = $dst_port != 0 ? ":" . Port::port2service($conn, $dst_port) : "";
 $event_info = Alarm::get_event($conn, $aid);
 $src_host = Asset_host::get_object($conn, $event_info["src_host"]);
 $dst_host = Asset_host::get_object($conn, $event_info["dst_host"]);
 $src_net_id = $event_info["src_net"];
 $dst_net_id = $event_info["dst_net"];
 if ($risk > 7) {
     $buffer .= "<td bgcolor='#FA0000'><b>";
     if ($view && $href_sim) {
         $buffer .= "<a class='greybox' href='{$href_sim}'>";
     }
     $buffer .= "<font color='white'>{$risk}</font>";
     if ($view && $href_sim) {
         $buffer .= "</a>";
     }
     $buffer .= "</b></td>";
 } elseif ($risk > 4) {
Ejemplo n.º 2
0
if (!is_object($alarm)) {
    $msg = _('Unable to retrieve the alarm information.');
    notify_and_die($msg, $db);
}
$stats = $alarm->get_stats();
if (count($stats['src']['ip']) < 1 || count($stats['dst']['ip']) < 1) {
    $msg = _('Unable to retrieve the alarm information.');
    notify_and_die($msg, $db);
}
$gl = new Geolocation("/usr/share/geoip/GeoLiteCity.dat");
$tz = Util::get_timezone();
//This is to force the alarms to remember the position of the datatables
$_SESSION["_alarm_keep_pagination"] = TRUE;
$_SESSION["_alarm_stats"] = $stats;
//Getting event info
$event_info = Alarm::get_event($conn, $alarm->get_event_id());
//alarm source and detination
$src = $stats['src'];
$dst = $stats['dst'];
$alarm_name = Util::translate_alarm($conn, $alarm->get_sid_name(), $alarm, 'array');
if (!empty($alarm_name['subcategory'])) {
    $alarm_tr = Util::translate_alarm($conn, $alarm_name['subcategory'], $alarm, 'array');
    $alarm_name['subcategory'] = $alarm_tr['name'];
}
$event_number = $stats['events'];
$alarm_time = get_alarm_life($alarm->get_since(), $alarm->get_last());
$alarm_life = get_alarm_life($alarm->get_last(), gmdate("Y-m-d H:i:s"), 'ago');
/* Source */
$_home_src = Asset_host::get_extended_name($conn, $gl, $alarm->get_src_ip(), $ctx, $event_info["src_host"], $event_info["src_net"]);
/* Destination */
$_home_dst = Asset_host::get_extended_name($conn, $gl, $alarm->get_dst_ip(), $ctx, $event_info["dst_host"], $event_info["dst_net"]);