상속: extends HomeChecker
예제 #1
0
function update($arr)
{
    if (isset($arr['alarm'])) {
        $alarm = new Alarm();
        if ($arr['alarm'] == 'true') {
            $val = true;
            $alarm->on();
        } else {
            $val = false;
            $alarm->off();
        }
        if ($alarm->isOn() == $val) {
            http_response_code(202);
        } else {
            http_response_code(400);
        }
    }
    if (isset($arr['mode'])) {
        $mode_value = $arr['mode'];
        $mode = new Mode();
        switch ($mode_value) {
            case Mode::DAY:
            case Mode::NIGHT:
            case Mode::AWAY:
                $mode->setMode($mode_value);
                http_response_code(202);
                return array('mode' => $mode_value);
        }
    }
}
예제 #2
0
function get_unresolved_alarms($conn)
{
    $alarms = intval(Alarm::get_count($conn, '', '', 1, TRUE));
    $alarms_prev = intval($_SESSION['_unresolved_alarms']);
    if ($alarms != $alarms_prev && $alarms_prev > 0) {
        $new_alarms = $alarms - $alarms_prev;
    } else {
        $new_alarms = 0;
    }
    $_SESSION['_unresolved_alarms'] = $alarms;
    $data['alarms'] = $alarms;
    $data['new_alarms'] = $new_alarms;
    $data['new_alarms_desc'] = '';
    if ($new_alarms > 0) {
        $criteria = array('src_ip' => '', 'dst_ip' => '', 'hide_closed' => 1, 'order' => 'ORDER BY a.timestamp DESC', 'inf' => 0, 'sup' => $new_alarms, 'date_from' => '', 'date_to' => '', 'query' => '', 'directive_id' => '', 'intent' => 0, 'sensor' => '', 'tag' => '', 'num_events' => '', 'num_events_op' => 0, 'plugin_id' => '', 'plugin_sid' => '', 'ctx' => '', 'host' => '', 'net' => '', 'host_group' => '');
        list($alarm_list, $count) = Alarm::get_list($conn, $criteria);
        $alarm_string = '';
        foreach ($alarm_list as $alarm) {
            $desc_alarm = Util::translate_alarm($conn, $alarm->get_sid_name(), $alarm);
            $desc_alarm = html_entity_decode(str_replace("'", "\\'", $desc_alarm));
            $desc_alarm = str_replace('"', """, $desc_alarm);
            $desc_alarm = str_replace('—', "-", $desc_alarm);
            $desc_alarm = Util::js_entities($desc_alarm);
            if ($alarm_string != '') {
                $alarm_string .= '|';
            }
            $alarm_string .= $desc_alarm;
        }
        $data['new_alarms_desc'] = $alarm_string;
    }
    $return['error'] = FALSE;
    $return['output'] = $data;
    return $return;
}
예제 #3
0
function get_pulse_detail_from_id($conn)
{
    $type = POST('type');
    $pulse = POST('pulse');
    $id = POST('id');
    ossim_valid($type, 'alarm|event|alarm_event', 'illegal:' . _('Type'));
    ossim_valid($pulse, OSS_HEX, 'illegal:' . _('Pulse'));
    ossim_valid($id, OSS_HEX, 'illegal:' . _('ID'));
    if (ossim_error()) {
        Av_exception::throw_error(Av_exception::USER_ERROR, ossim_get_error_clean());
    }
    if ($type == 'alarm') {
        $pulse = Alarm::get_pulse_data_from_alarm($conn, $id, $pulse, TRUE);
    } elseif ($type == 'event') {
        $pulse = Siem::get_pulse_data_from_event($conn, $id, $pulse, FALSE, TRUE);
    } elseif ($type == 'alarm_event') {
        $pulse = Siem::get_pulse_data_from_event($conn, $id, $pulse, TRUE, TRUE);
    }
    return array('name' => $pulse['name'], 'descr' => $pulse['descr'], 'iocs' => array_values($pulse['iocs']));
}
예제 #4
0
<?php

require_once __DIR__ . '/../classes/connexion.php';
require_once __DIR__ . '/../classes/Zwave.php';
require_once __DIR__ . '/../classes/PushMessage.php';
require_once __DIR__ . '/../classes/Settings.php';
require_once __DIR__ . '/../classes/Mode.php';
require_once __DIR__ . '/../classes/Alarm.php';
$pid = getmypid();
(new Settings())->setSettings('Daemon', 'pid', $pid);
while (!getBDD()) {
}
$push = new PushMessage();
$mode = new Mode();
$alarm = new Alarm();
$arrMvt = loadSensors();
$arrMvt2 = initTimestamp($arrMvt);
$scenarios = loadScenarios($arrMvt);
while (true) {
    $settings = new Settings();
    $zwave = new Zwave();
    foreach ($arrMvt as $i => $sensor) {
        if ($sensor['type'] == 'Door/Window') {
            switch ($sensor['protocol']) {
                case 'zwave':
                    if ($zwave->getValue($sensor['sensor']) == 'on' && $zwave->GetTimestamp($sensor['sensor']) != $arrMvt2[$i]) {
                        $arrMvt2[$i] = $zwave->GetTimestamp($sensor['sensor']);
                        execScenario($i, $scenarios);
                        if ($mode->getMode() == Mode::NIGHT || $mode->getMode() == Mode::AWAY) {
                            $alarm->execAlarm();
                        }
예제 #5
0
        $order = 'port';
        //Order by hostname
        break;
    case 1:
        $order = 'service';
        //Order by IP
        break;
    default:
        $order = 'port';
}
$torder = strtoupper($torder) == 'ASC' ? 'ASC' : 'DESC';
try {
    $db = new Ossim_db();
    $conn = $db->connect(TRUE);
    $params = array('backlog_id' => $backlog_id, 'ip' => $asset_ip, 'source' => $source, 'limit' => "{$from}, {$maxrows}", 'order_by' => "{$order} {$torder}");
    list($port_total, $port_list) = Alarm::get_alarm_port_by_ip($conn, $params);
} catch (Exception $e) {
    $db->close();
    Util::response_bad_request($e->getMessage());
}
$data = array();
foreach ($port_list as $p_data) {
    $service = empty($p_data['service']) ? '-' : $p_data['service'];
    $data[] = array($p_data['port'], $service);
}
$response['sEcho'] = $sec;
$response['iTotalRecords'] = $port_total;
$response['iTotalDisplayRecords'] = $port_total;
$response['aaData'] = $data;
echo json_encode($response);
$db->close();
    					<table class="transparent">
    						<tr>
    							<?php 
        if ($tags_html[$id_tag] != "") {
            ?>
    								<td class="transparent">
    								    <?php 
            echo preg_replace("/ <a(.*)<\\/a>/", "", $tags_html[$id_tag]);
            ?>
    								</td>
    								<?php 
        }
        ?>
    							<td class="transparent">
        							<?php 
        echo Util::signaturefilter(Alarm::transform_alarm_name($conn, $group['name']));
        ?>
        							&nbsp;&nbsp;
        							<span style='font-size:xx-small;'>(<?php 
        echo $ocurrences;
        ?>
 <?php 
        echo $ocurrence_text;
        ?>
)</span>
    							</td>
    						</tr>
    					</table>
    				</td>

    				<td><?php 
예제 #7
0
     $sid_name = $alarm->get_sid_name();
     $sid_priority = $alarm->get_sid_priority();
     $src_host = $alarm->get_src_host();
     $dst_host = $alarm->get_dst_host();
     $src_net = $alarm->get_src_net();
     $dst_net = $alarm->get_dst_net();
     $rule_level = $alarm->get_rule_level();
     $view = Alarm::event_allowed($conn, $ctx, $src_host, $dst_host, $src_net, $dst_net);
     if ($sid_name == "") {
         $sid_name = "Unknown (id={$id} sid={$sid})";
     }
     if ($sid_priority == "") {
         $sid_priority = "N/A";
     }
     if (!$show_all || $id == 1505) {
         $summary = Alarm::get_alarm_resume($conn, $backlog_id, $rule_level, true);
     }
     ?>
 		
 		<tr>
 			<?php 
     if (!$master_alarm_sid) {
         $master_alarm_sid = $sid;
     }
     $name = Util::translate_alarm($conn, $sid_name, $alarm);
     $name = "<b>{$name}</b>";
     ?>
 			
 			<!-- id & name event -->
 			<td>
 				<?php 
     $now = gmdate("Y-m-d H:i:s", gmdate("U") + 3600 * $tz);
     $res[] = get_alarm_life($since, $now);
     $res[] = "<img align='absmiddle' src='/ossim/alarm/style/img/correlating.gif' class='img_cor tip' title='" . _("This alarm is still being correlated and therefore it can not be modified") . "'>";
 }
 //$res["status_background_color"] = ($alarm->get_status() == "open") ? "#ECE1DC" : "#DEEBDB";
 //$res["status_border_color"]     = ($alarm->get_status() == "open") ? "#E6D8D2" : "#D6E6D2";
 // TAGS
 $tgs = "";
 if (count($tags) > 0) {
     foreach ($tags as $id_tag) {
         $tgs .= $tags_html[$id_tag] . " ";
     }
 }
 $res[] = $tgs;
 // kingdom, category and subcategory
 list($alarm_ik, $alarm_sc) = Alarm::get_alarm_name($alarm->get_taxonomy());
 $res[] = $alarm_ik;
 $res[] = $alarm_sc;
 // risk
 $res[] = $risk;
 // src and dst
 $src_link = $refresh_url_nopage . "&src_ip=" . $src_ip;
 $dst_link = $refresh_url_nopage . "&dst_ip=" . $dst_ip;
 $default_ctx = Session::get_default_ctx();
 // Src
 if ($no_resolv || !$src_host) {
     $src_name = $src_ip;
     $src_desc = "";
     $ctx_src = $event_info["agent_ctx"];
 } elseif ($src_host) {
     $src_desc = $src_host->get_descr() != "" ? ": " . $src_host->get_descr() : "";
예제 #9
0
$backlog_id = GET('backlog_id');
$event_id = GET('event_id');
$show_all = GET('show_all');
$hide = GET('hide');
$box = GET('box');
$from = GET('from') != "" ? GET('from') : 0;
ossim_valid($backlog_id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("backlog_id"));
ossim_valid($event_id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("Event_id"));
ossim_valid($show_all, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Show_all"));
ossim_valid($hide, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("Hide"));
ossim_valid($from, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("From"));
ossim_valid($box, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("From"));
if (ossim_error()) {
    die(ossim_error());
}
$alarm_url = Alarm::get_alarm_path();
?>

<style type='text/css'>
	.loading_panel
	{
		border-radius: 5px;
		border: solid 5px #CCCCCC !important;
		width: 30%; 
		height: auto; 
		margin: 15px auto; 
		z-index: 200001; 
		background:#F2F2F2; 
		font-size: 11px; 
		color: #222222;
		text-align:center;
예제 #10
0
ossim_valid($search, OSS_NULLABLE, OSS_NOECHARS, OSS_ALPHA, OSS_SCORE, OSS_PUNC, 'illegal:' . _("Search"));
if (ossim_error()) {
    die;
}
$db = new ossim_db(TRUE);
//Remote DataBases
if ($type == 'event' && is_array($_SESSION['server']) && $_SESSION['server'][0] != '') {
    $conn = $db->custom_connect($_SESSION["server"][0], $_SESSION["server"][2], $_SESSION["server"][3]);
} else {
    $conn = $db->connect();
}
if ($type == 'event') {
    $unique_pulses = Siem::get_unique_pulses($conn);
} else {
    if ($type == 'alarm') {
        $unique_pulses = Alarm::get_unique_pulses($conn);
    } else {
        $unique_pulses = array();
    }
}
$pulses = array();
if (count($unique_pulses) > 0) {
    try {
        $otx = new Otx();
        list($total, $p_list) = $otx->get_pulse_list(array('page' => 0, 'page_rows' => -1));
        foreach ($p_list as $p) {
            $p_id = Util::uuid_format_nc($p['id']);
            $p_name = trim($p['name']);
            if ($unique_pulses[$p_id]) {
                if (!$search || preg_match('/' . preg_quote($search, '/') . '/i', $p_name)) {
                    $pulses[$p_id] = $p_name;
/* connect to db */
$db = new ossim_db();
$conn = $db->connect();
foreach ($_POST as $key => $value) {
    if (preg_match("/check_([0-9a-fA-F]+)_([0-9a-fA-F]+)/", $key, $found)) {
        if ($only_close) {
            Alarm::close($conn, $found[1]);
        } elseif ($move_tag != "") {
            if ($move_tag > 0) {
                Tags::set_alarm_tag($conn, $found[1], $move_tag);
            } else {
                Tags::del_alarm_tag($conn, $found[1], $move_tag);
                # $move_tag=0 delete all, $move_tag<0 delete only a tag
            }
        } else {
            $result = Alarm::delete_backlog($conn, $found[1]);
            if (!$result) {
                $_SESSION["_delete_msg"] = _("You do not have enough permissions to delete this alarm as it contains events that you are not allowed to see.");
            }
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title><?php 
echo _("Alarm Operations");
?>
</title>
	</head>
예제 #12
0
		</td>
        <!-- src & dst hosts -->

        <td><?php 
        echo $alarm->get_rule_level();
        ?>
</td>
      </tr>

<?php 
        if ($highest_rule_level == 0) {
            $highest_rule_level = $alarm->get_rule_level();
        }
        // Alarm summary
        if (!$show_all || $alarm->get_alarm()) {
            $summary = Alarm::get_alarm_stats($conn, $backlog_id, $aid);
            $summ_count = $summary["count"];
            //$totales += $summary['total_count'];
            $summ_event_count += $summ_count;
            $summ_dst_ips = $summary["dst_ips"];
            $summ_types = $summary["types"];
            $summ_dst_ports = $summary["dst_ports"];
            echo "\n            <tr>\n            \n            <td colspan=\"9\" style='border-bottom:1px solid #BBBBBB;padding:3px' bgcolor='#E5FFDF'>\n              <b>" . gettext("Alarm Summary") . "</b> [ ";
            printf(gettext("Total Events: %d"), $summ_count);
            echo "&nbsp;-&nbsp;";
            printf(gettext("Unique Dst IPAddr: %d"), $summ_dst_ips);
            echo "&nbsp;-&nbsp;";
            printf(gettext("Unique Types: %d"), $summ_types);
            echo "&nbsp;-&nbsp;";
            printf(gettext("Unique Dst Ports: %d"), $summ_dst_ports);
            echo " ] ";
예제 #13
0
* 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
*
*/
ob_implicit_flush();
require_once 'av_init.php';
Session::logcheck("analysis-menu", "ControlPanelAlarms");
/****************/
$plugin_id = GET('plugin_id');
$plugin_sid = GET('plugin_sid');
ossim_valid($plugin_id, OSS_DIGIT, 'illegal:' . _("Plugin ID"));
ossim_valid($plugin_sid, OSS_DIGIT, 'illegal:' . _("Plugin SID"));
if (ossim_error()) {
    die(ossim_error());
}
/* connect to db */
$db = new ossim_db(TRUE);
$conn = $db->connect();
$trend = Alarm::get_alarm_trend($conn, $plugin_id, $plugin_sid, 7);
ksort($trend);
echo json_encode($trend);
$db->close($conn);
?>

예제 #14
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) {
예제 #15
0
function close_all_alarms()
{
    //Getting the user. We delete only the alarm of the current user
    $user = Session::get_session_user();
    //Getting the file with all the sql queries for closing the alarms
    $file = Alarm::close_all();
    //Executing the sql for closing the queries in background
    $cmd = 'php /usr/share/ossim/scripts/alarms/bg_alarms.php ? ? > /dev/null 2>&1 &';
    $params = array($user, $file);
    Util::execute_command($cmd, $params);
    $return['error'] = FALSE;
    $return['msg'] = '';
    return $return;
}
예제 #16
0
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
//Checking active session
Session::useractive();
//Checking permissions
if (!Session::am_i_admin()) {
    echo _('You do not have permissions to see this section');
    die;
}
try {
    $db = new ossim_db();
    $conn = $db->connect();
    $alarms = Alarm::get_count($conn);
    $db->close();
} catch (Exception $e) {
    $alarms = 0;
}
$_version = Session::is_pro() ? " USM" : " OSSIM";
if ($alarms > 0) {
    $msg = _('Data is now coming into AlienVault. AlienVault has generated a few alarms. You can either view the alarms or explore AlienVault') . $_version;
} else {
    $msg = _('Data is now coming into AlienVault. So far analysis has not generated any alarms. While you wait for more data to come in, you can continue configuring the system or start exploring AlienVault') . $_version;
}
?>
<script type='text/javascript'>

    $(document).ready(function()
    {
예제 #17
0
 $incident_ticket_list = Incident_ticket::get_list($conn, "ORDER BY date DESC LIMIT 1");
 $incident_date2 = $incident_ticket_list[0] ? $incident_ticket_list[0]->get_date() : 0;
 if ($incident_list[0] || $incident_ticket_list[0]) {
     $incident_date = strtotime($incident_date1) > strtotime($incident_date2) ? $incident_date1 : $incident_date2;
     if ($incident_date == 0) {
         $incident_date = "__/__/__ --:--:--";
     }
 }
 //$incident_list = Incident::get_list($conn, "ORDER BY priority DESC");
 $incident_list = Incident::search($conn, array("status" => "Open"), "priority", "DESC", 1, 1);
 $incident_max_priority = $incident_list[0] ? $incident_list[0]->get_priority() : "-";
 $incident_max_priority_id = $incident_list[0] ? $incident_list[0]->get_id() : "0";
 // Get unresolved ALARMS
 $unresolved_alarms = Alarm::get_count($conn);
 list($alarm_date, $alarm_date_id) = Alarm::get_max_byfield($conn, "timestamp");
 list($alarm_max_risk, $alarm_max_risk_id) = Alarm::get_max_byfield($conn, "risk");
 if ($alarm_max_risk_id == "") {
     $alarm_max_risk = "-";
 }
 //
 list($siem, $events) = get_siem_events($conn, date("Y-m-d"));
 $i = 0;
 foreach ($siem as $p) {
     $plot .= "[" . $i++ . "," . $p["num_events"] . "],";
 }
 $i = 0;
 foreach ($siem as $p) {
     $legend .= "[" . $i++ . ",'" . ($i % 2 == 0 ? $p["intervalo"] . "h" : "") . "'],";
 }
 $data_pie = top_siem_events($conn, $NUM_HOSTS);
 ?>
예제 #18
0
        /* show alarms by days */
        $date_slices = split(" ", $date);
        list($year, $month, $day) = split("-", $date_slices[0]);
        $date_unformated = $year . $month . $day;
        $date_formatted = Util::htmlentities(strftime("%A %d-%b-%Y", mktime(0, 0, 0, $month, $day, $year)));
        if ($datemark != $date_slices[0]) {
            $link_delete = "\n                    <a href=\"" . $_SERVER["SCRIPT_NAME"] . "?delete_day=" . $alarm->get_timestamp() . "&inf=" . ($sup - $ROWS) . "&sup={$sup}&hide_closed={$hide_closed}&unique_id={$unique_id}\" style='font-weight:bold'> " . gettext("Delete") . " </a>\n                ";
            echo "\n                <tr>\n                  \n                  <td style='border:0px;background-color:#d6dfeb'><input type=\"checkbox\" onclick=\"checkall_date('" . $date_unformated . "')\"></td>\n                  <td colspan=\"10\" style='padding:5px;border-bottom:0px solid white;background-color:#B5C7DF'>\n                    <!--<hr border=\"0\"/>-->\n                    <b>{$date_formatted}</b> [{$link_delete}]<br/>\n                    <!--<hr border=\"0\"/>-->\n                  </td>\n                  \n                </tr>\n                ";
        }
        $datemark = $date_slices[0];
        $event_count_label = "";
        if ($backlog_id) {
            $aid = $alarm->get_event_id();
            #$summary = Alarm::get_total_events($conn, $backlog_id);
            #$event_count_label = $summary["total_count"] . " "._("events");
            $event_count = Alarm::get_total_events($conn, $backlog_id);
            $event_count_label = $event_count . " " . _("events");
        }
        ?>
      <tr>
        <td class="nobborder"><input style="border:none" type="checkbox" name="check_<?php 
        echo $backlog_id;
        ?>
_<?php 
        echo $alarm->get_event_id();
        ?>
" id="check_<?php 
        echo $backlog_id;
        ?>
" class="alarm_check" datecheck="<?php 
        echo $date_unformated;
예제 #19
0
    }
}
if (GET('open_group') != "") {
    if (!ossim_valid(GET('open_group'), OSS_ALPHA, OSS_SPACE, OSS_PUNC, OSS_SQL, 'illegal:' . _("open_group"))) {
        exit;
    }
    AlarmGroups::change_status($conn, GET('open_group'), "open");
}
if (GET('action') == "open_alarm") {
    Alarm::open($conn, GET('alarm'));
}
if (GET('action') == "close_alarm") {
    Alarm::close($conn, GET('alarm'));
}
if (GET('action') == "delete_alarm") {
    Alarm::delete($conn, GET('alarm'));
}
$db_groups = AlarmGroups::get_dbgroups($conn);
list($alarm_group, $count) = AlarmGroups::get_unique_alarms($conn, $show_options, $hide_closed, $date_from, $date_to, $src_ip, $dst_ip, "LIMIT {$inf},{$sup}");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title> <?php 
echo _("Control Panel");
?>
 </title>
  <?php 
if ($autorefresh) {
    print '<meta http-equiv="refresh" content="' . $refresh_time . ';url=' . build_url("", "") . '"/>';
}
예제 #20
0
$type = GET('type');
$id = GET('id');
$event_alarm = GET('alarm_event');
ossim_valid($type, 'alarm|event|alarm_event', 'illegal:' . _('Type'));
ossim_valid($id, OSS_HEX, 'illegal:' . _('ID'));
ossim_valid($event_alarm, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Alarm Event'));
if (ossim_error()) {
    die(ossim_error());
}
$db = new ossim_db(TRUE);
$conn = $db->connect();
$p_list = array();
$r_list = array();
if ($type == 'alarm') {
    $p_list = Alarm::get_alarm_pulses($conn, $id, TRUE);
    $r_list = Alarm::get_alarm_reputation($conn, $id, TRUE);
} elseif ($type == 'event') {
    $p_list = Siem::get_event_pulses($conn, $id, FALSE, TRUE);
    $r_list = Siem::get_event_reputation($conn, $id, FALSE, TRUE);
} elseif ($type == 'alarm_event') {
    $p_list = Siem::get_event_pulses($conn, $id, $event_alarm, TRUE);
    $r_list = Siem::get_event_reputation($conn, $id, TRUE, TRUE);
}
$otx_info = array('type' => $type, 'id' => $id, 'pulse_list' => $p_list, 'rep_list' => $r_list);
$db->close();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title><?php 
예제 #21
0
$e->addExceptionDate($d);
assertequal($e->exceptionDates()->size(), 1, "Event::addExceptionDate()");
$r = new RecurrenceRule();
$r->setFrequency(RecurrenceRule::Minutely);
$bysec = new vectori();
$bysec->push(1);
$bysec->push(3);
$r->setBySecond($bysec);
$e->setRecurrenceRule($r);
$va = new vectoralarm();
$a1 = new Alarm("Display alarm");
$a1->setRelativeStart(new Duration(0, 6, 30, 0, true), kolabformat::Start);
$va->push($a1);
$acr = new vectorcontactref();
$acr->push(new ContactReference("*****@*****.**"));
$a2 = new Alarm("Email alarm", "Alarm description", $acr);
$a2->setStart(new cDateTime(2012, 7, 30, 20, 30, 0, true));
$va->push($a2);
$e->setAlarms($va);
$xml = kolabformat::writeEvent($e);
#print $xml;
assertcontains($xml, '<dtstart><date>2012-07-31</date></dtstart>', "Event::setStart() with date only");
assertcontains($xml, '<created><date-time>2012-03-14T09:05:30Z</date-time></created>', "Event::setCreated() with date-time");
assertcontains($xml, '<rrule><recur><freq>MINUTELY</freq>', "RecurrenceRule::setFrequency()");
assertcontains($xml, '<rrule><recur><freq>MINUTELY</freq><bysecond>1</bysecond><bysecond>3</bysecond></recur></rrule>', "RecurrenceRule::setBySecond()");
assertcontains($xml, '<exdate><date>2009-10-12</date></exdate>', "Event Recurrence Exceptions");
assertcontains($xml, '<duration>-PT6H30M</duration>', "Alarm::setRelativeStart(Duration)");
assertcontains($xml, '<trigger><date-time>2012-07-30T20:30:00Z</date-time>', "Alarm::setStart()");
assertcontains($xml, '<trigger><parameters><related><text>START</text>', "Alarm relative to Start");
assertcontains($xml, '<valarm><properties><action><text>EMAIL</text>', "Email alarm");
assertcontains($xml, '<attendee><cal-address>mailto:%3Calarms%40kolab.org%3E</cal-address>', "Email alarm attendee");
 /**
  * 특정 회원의 지정된 알람을 삭제
  * @param String membertoken
  * @param Integer alarmseq
  * @return Array
  */
 public function removeAlarm($membertoken, $alarmseq)
 {
     // 멤버 토큰을 통해 멤버 가져옴.
     $memberToken = Membertoken::where('token', $membertoken)->first();
     $member = $memberToken->member()->first();
     $memberAlarm = Alarm::find($alarmseq);
     // 알람 업데이트
     if (isset($memberAlarm)) {
         if ($memberAlarm->memberSeq == $member->seq) {
             $affectedRow = $memberAlarm->delete();
             return Utils::result($affectedRow);
         }
     }
     return Utils::result(Utils::CANNOT_FIND_ALARM, true);
 }
예제 #23
0
    die(ossim_error("You don't have required permissions to delete Alarms"));
}
// check unique_id for alarms
if (check_uniqueid($prev_unique_id, $param_unique_id)) {
    foreach ($_POST as $key => $value) {
        if (preg_match("/check_(\\d+)_(\\d+)/", $key, $found)) {
            if ($only_close) {
                Alarm::close($conn, $found[2]);
            } elseif ($move_tag != "") {
                if ($move_tag > 0) {
                    Tags::set_alarm_tag($conn, $found[1], $move_tag);
                } else {
                    Tags::del_alarm_tag($conn, $found[1]);
                }
            } else {
                Alarm::delete_from_backlog($conn, $found[1], $found[2]);
            }
            //echo "<tr><td class='nobborder'>Alarm deleted: <font color='red'><b>" . $found[1] . "-" . $found[2] . "</b></font></td></tr>";
        }
    }
    //header ("Location: alarm_console.php");
    ?>
<html>
<head><title>Delete Selected Alarms</title></head>
<?php 
    if (!$background) {
        ?>
<body><script>document.location.href='alarm_console.php?hide_closed=<?php 
        echo $hide_closed;
        ?>
&query=<?php 
예제 #24
0
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
namespace OCA\CalendarPlus;

Alarm::$tz = App::getTimezone();
class Alarm
{
    private $nowTime = 0;
    private $activeAlarms = array();
    private $aCalendars = array();
    private $aEventSource = array();
    /**
     * @brief timezone of the user
     */
    public static $tz;
    public function __construct()
    {
        $timeNow = time();
        //test
        $checkOffset = new \DateTime(date('d.m.Y', $timeNow), new \DateTimeZone(self::$tz));
 $aux_date = Util::timestamp2date($s_alarm->get_timestamp());
 $timestamp_utc = Util::get_utc_unixtime($s_alarm->get_timestamp());
 $s_date = gmdate("Y-m-d H:i:s", $timestamp_utc + 3600 * $tz);
 if ($s_backlog_id && $s_id == 1505 && $s_event_count > 0) {
     $aux_date = Util::timestamp2date($s_alarm->get_since());
     $timestamp_utc = Util::get_utc_unixtime($aux_date);
     $s_since = gmdate("Y-m-d H:i:s", $timestamp_utc + 3600 * $tz);
 } else {
     $s_since = $s_date;
 }
 $s_risk = $s_alarm->get_risk();
 $s_alarm_link = "alarm_detail.php?backlog=" . $s_backlog_id;
 /* Alarm name */
 $s_alarm_name = ereg_replace("directive_event: ", "", $s_sid_name);
 $s_alarm_name = Util::translate_alarm($conn, $s_alarm_name, $s_alarm);
 $event_ocurrences = Alarm::get_total_events($conn, $s_backlog_id);
 if ($event_ocurrences != 1) {
     $ocurrences_text = strtolower(gettext("Events"));
 } else {
     $ocurrences_text = strtolower(gettext("Event"));
 }
 /* Risk field */
 if ($s_risk > 7) {
     $color = "red";
 } elseif ($s_risk > 4) {
     $color = "orange";
 } elseif ($s_risk > 2) {
     $color = "green";
 } else {
     $color = "black";
 }
예제 #26
0
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
require_once 'av_init.php';
require_once '../alarm_common.php';
Session::logcheck("analysis-menu", "ControlPanelAlarms");
$backlog = GET('backlog');
ossim_valid($backlog, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("Backlog"));
// Maybe nullable from Logger resolves
if (ossim_error()) {
    die(ossim_error());
}
$geoloc = new Geolocation("/usr/share/geoip/GeoLiteCity.dat");
$db = new ossim_db(TRUE);
$conn = $db->connect();
$tz = Util::get_timezone();
list($alarm, $event) = Alarm::get_alarm_detail($conn, $backlog);
$stats = $alarm->get_stats();
$timestamp_utc = Util::get_utc_unixtime(Util::timestamp2date($alarm->get_timestamp()));
$last = gmdate("Y-m-d H:i:s", $timestamp_utc + 3600 * $tz);
$alarm_time = get_alarm_life($alarm->get_since(), $alarm->get_last());
preg_match_all("/(\\d+)\\s(\\w+)/", strip_tags(trim($alarm_time)), $found);
$alarm_time_number = $found[1][0];
$alarm_time_unit = $found[2][0];
$alarm_life = get_alarm_life($alarm->get_since(), gmdate("Y-m-d H:i:s"));
preg_match_all("/(\\d+)\\s(\\w+)/", strip_tags(trim($alarm_life)), $found);
$alarm_life_number = $found[1][0];
$alarm_life_unit = $found[2][0];
$show_total = false;
$removable = $alarm->get_removable();
$backlog_id = $alarm->get_backlog_id();
$event_id = $alarm->get_event_id();
예제 #27
0
    this.dst_ports      = alarm.dst_ports || '';
       
    this.sources        = alarm.sources || [];
    this.destinations   = alarm.destinations || [];
    
    this.tags           = alarm.tags || {};
    
    this.perms          = $.extend(
    {
        "admin": false,
        "pro"  : false
    }, perms || {});
    
    var __box_tabs      = {};
    var __alarm_url     = <?php 
echo json_encode(Alarm::get_alarm_path());
?>
;
    var __asset_url     = <?php 
echo Asset::get_path_url();
?>
;
    var __confirm_keys  = 
    {
        "yes": "<?php 
echo Util::js_entities(_('Yes'));
?>
",
        "no" : "<?php 
echo Util::js_entities(_('No'));
?>
예제 #28
0
파일: index.php 프로젝트: jhbsz/ossimTest
    }
    $_SESSION['directive'] = serialize($direct);
    if ($XML_FILE != '/etc/ossim/server/directives.xml') {
        release_file($XML_FILE);
    }
    if (!empty($directive_id)) {
        $direct->printDirective($level, $directive_xml);
    }
    ?>
</table>
<?php 
    $directive_name = Plugin_sid::get_name_by_idsid($conn, "1505", $directive_id);
    list($properties, $num_properties) = Compliance::get_category($conn, "AND category.sid={$directive_id}");
    $iso_groups = ISO27001::get_groups($conn, "WHERE SIDSS_Ref LIKE '{$directive_id}' OR SIDSS_Ref LIKE '{$directive_id},%' OR SIDSS_Ref LIKE '%,{$directive_id}' OR SIDSS_Ref LIKE '%,{$directive_id},%'");
    $pci_groups = PCI::get_groups($conn, "WHERE SIDSS_ref LIKE '{$directive_id}' OR SIDSS_ref LIKE '{$directive_id},%' OR SIDSS_ref LIKE '%,{$directive_id}' OR SIDSS_ref LIKE '%,{$directive_id},%'");
    list($alarms, $num_alarms) = Alarm::get_list3($conn, "", "", 0, "", null, null, null, null, "", $directive_id);
    $kdocs = Repository::get_linked_by_directive($conn, $directive_id);
    ?>
<table class="transparent" height="100%" width="100%">
	<tr>
		<td class="nobborder" valign="top">
			<table height="100%" width="100%">
				<tr><th colspan="2" height="15"><?php 
    echo _("Properties");
    ?>
</th></tr>
				<?php 
    if (count($properties) < 1) {
        ?>
				<tr><td class="nobborder" style="color:gray;padding:10px"><i><?php 
        echo _("No properties found");
예제 #29
0
 public function attachAlarm(Alarm $alarm)
 {
     $this->event->setComponent($alarm->getAlarm());
     return $this;
 }
예제 #30
0
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
set_time_limit(0);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
require_once 'av_init.php';
require_once '../alarm_common.php';
Session::logcheck("analysis-menu", "ControlPanelAlarms");
$db = new ossim_db(TRUE);
$conn = $db->connect();
$intents = Alarm::get_intents($conn);
$strategies = Alarm::get_strategies($conn);
list($graph, $tooltip, $dates) = Alarm::get_alarm_graph_by_taxonomy($conn);
$intents_order = array(5, 3, 1, 4, 2);
$db->close();
?>

<!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" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Pragma" content="no-cache"/>
	
	<title><?php 
echo _("Alarm Graph");
?>
 </title>