</tr> <?php $i = 0; foreach ($unique_events as $ev) { if ($i >= 6) { continue; } $color = ($i + 1) % 2 == 0 ? "#E1EFE0" : "#FFFFFF"; //$perc = "(".round($ev['sig_cnt'] / $event_cnt * 100)."%)"; // GRAPH $graph = '<div id="plotarea' . $i . '" class="plot" style="margin:auto;"></div>'; $yy = $plots[$i]; if ($host != 'any') { $plot = plot_graphic("plotarea" . $i, 37, 400, $x, $yy, $xticks, $xlabels, false, "131,137,175", $host); } else { $plot = plot_graphic("plotarea" . $i, 37, 400, $x, $yy, $xticks, $xlabels, false, "131,137,175", ''); } $tmp_rowid = "#1-(" . $ev['sid'] . "-" . $ev['cid'] . ")"; ?> <tr> <td bgcolor="<?php echo $color; ?> "><a href="../forensics/base_qry_alert.php?submit=<?php echo rawurlencode($tmp_rowid); ?> " style="text-align:left;color: #17457c;font-size:10px"><strong><?php echo $ev['sig_name']; ?> </strong></a></td>
$max = 7; for ($ii = $max - 1; $ii >= 0; $ii--) { $d = gmdate("j M", $timetz - 86400 * $ii); $trend[$d] = $data[$d] != "" ? $data[$d] : 0; } $i = 0; foreach ($trend as $k => $v) { $x[$k] = $i; $i++; } $y = $trend; $xticks = $x; foreach ($trend as $k => $v) { $xlabels[$k] = $k; } $trend = "<div class='cont_plot'><div id='plotarea_" . $agent[0] . "'>" . plot_graphic("plotarea_" . $agent[0], 40, 400, $x, $y, $xticks, $xlabels, false, "") . "</div></div>"; } else { $trend = "<div style='color:red; margin:auto; text-align:center;'>" . _("Trend chart not available") . "</div>"; } echo "<tr id='cont_agent_" . $agent[0] . "'>\r\n\t\t\t\t\t\t\t\t<td id='agent_" . $agent[0] . "'>{$agent_name}</td>\r\n\t\t\t\t\t\t\t\t<td>" . $agent[1] . "</td>\r\n\t\t\t\t\t\t\t\t<td>" . $agent[2] . "</td>\r\n\t\t\t\t\t\t\t\t<td>" . $agent[3] . "</td>\r\n\t\t\t\t\t\t\t\t<td style='width:440px;'>{$trend}</td>\r\n\t\t\t\t\t\t\t</tr>"; if ($agent_type === 1) { echo "<tr id='minfo_" . $agent[0] . "' style='display:none;'>\r\n\t\t\t\t\t\t\t\t\t<td colspan='5'>"; if (!is_array($more_info)) { echo "<div style='padding:5px; color: #D8000C; text-align:center;'>{$more_info}</div>"; } else { echo "<div style='padding: 3px 3px 5px 5px; font-weight: bold;'>" . _("Agent information") . ":</div>"; echo "<div style='float:left; width: 170px; font-weight: bold; padding:0px 3px 5px 15px;'>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Agent ID") . ":</span><br/> \r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Agent Name") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("IP address") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Status") . ":</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Operating system") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Client version") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Last keep alive") . ":</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Syscheck last started at") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Rootcheck last started at") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t</div>"; echo "<div style='float:left; width: auto; padding:0px 3px 5px 15px;'>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[0] . "</span><br/> \r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[1] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[2] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[3] . "</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[4] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[5] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[6] . "</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[7] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[8] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t </div>\r\n\t\t\t\t\t\t\t\t</div>"; } echo "</td>\r\n\t\t\t\t\t\t\t\t</tr>"; }
echo gettext("Logger Events"); ?> </a></td> </tr> <?php if (count($sem_events_week) > 0) { // GRAPH list($x, $y, $xticks, $xlabels) = Status::range_graphic("week"); //include ("host_report_sem_graph.php"); $graph = '<div id="plotareasem" class="plot"></div>'; $xticks = $sem_wplot_x; $xlabels = array(); foreach ($xticks as $tick => $val) { $xlabels[$tick] = $tick; } $plot = plot_graphic("plotareasem", 60, 800, $sem_wplot_x, $sem_wplot_y, $xticks, $xlabels, false, "239, 214, 209"); ?> <tr> <td style="text-align:center"> <table align="center" style="width:auto"> <tr><td><?php echo $graph . $plot; ?> </td></tr> </table> </td> </tr> <tr> <td> <table border='0' width='100%' cellpadding='2'> <tr>
function PrintResultCnt($sqlgraph = "", $tr = array(), $displaying = "") { global $show_rows, $db; echo "<table class='container' style='height:30px'><tr><td>"; if ($displaying == "") { $displaying = gettext("Displaying %d to %d of <b>%s</b> events."); } if ($this->num_result_rows > 0) { if ($this->isCannedQuery()) { echo "<div class='siem_display_msg' style='text-align:left;margin:auto;padding:3px 0px'>" . gettext("Displaying") . " " . Util::htmlentities($this->GetCurrentCannedQueryDesc()) . "</div>"; } else { if (Session::am_i_admin()) { // Total rows $rt = $db->baseExecute("SELECT sum(cnt) from ac_acid_event"); // from ac_ table => faster way if ($rt) { $rows = $rt->baseFetchRow(); $this->num_acid_event_rows = $rows[0]; } $rt->baseFreeRows(); } printf("<div class='siem_display_msg' style='float:left;margin:auto;padding:4px 0px'>" . $displaying . "</div>\n", $this->current_view * $show_rows + 1, $this->current_view * $show_rows + $show_rows - 1 < $this->num_result_rows ? $this->current_view * $show_rows + $show_rows : $this->num_result_rows, Util::number_format_locale($this->num_result_rows, 0)); if (Session::am_i_admin()) { printf("<div class='siem_display_msg' style='float:right;margin:auto'>" . gettext(" <b>%s</b> total events in database.") . "</div>\n", Util::number_format_locale($this->num_acid_event_rows, 0)); } //printf("<div style='text-align:left;margin:auto'><table><tr><td><img src='../pixmaps/arrow_green.gif'></td><td>". $displaying . "</td>\n", ($this->current_view * $show_rows) + 1, (($this->current_view * $show_rows) + $show_rows - 1) < $this->num_result_rows ? (($this->current_view * $show_rows) + $show_rows) : $this->num_result_rows, Util::number_format_locale($this->num_result_rows,0), Util::number_format_locale($this->num_acid_event_rows,0)); if ($sqlgraph != "") { global $db, $graph_report_type; list($x, $y, $xticks, $xlabels) = range_graphic($tr); //echo "SQLG:$sqlgraph -->"; $res = $this->ExecuteOutputQueryNoCanned($sqlgraph, $db); //echo " COUNT:".$res->baseRecordCount()."<br>"; while ($rowgr = $res->baseFetchRow()) { //print_r($rowgr); $label = trim($rowgr[1] . " " . $rowgr[2]); if (isset($y[$label]) && $y[$label] == 0) { $y[$label] = $rowgr[0]; } //echo "$label = $rowgr[0] <br>"; } // Report data $gdata = array(); foreach ($y as $label => $val) { $gdata[] = array($label, "", "", "", "", "", "", "", "", "", "", $val, 0, 0); } $this->SaveReportData($gdata, $graph_report_type); //print_r($xlabels); //print_r($xticks); //print_r ($x); //print_r ($y); $plot = plot_graphic("plotareaglobal", 50, 400, $x, $y, $xticks, $xlabels, true); //echo "PLOT:".Util::htmlentities($plot)."."; echo "<td class=axis>{$plot}</td>"; } echo "</tr></table></div>\n"; } } else { printf("<B>" . _("No events matching your search criteria have been found. Try fewer conditions.") . "</B> <a style='color:white' href='base_qry_main.php?clear_allcriteria=1&num_result_rows=-1&submit=Query+DB¤t_view=-1&sort_order=time_d'>[..." . _("Clear All Criteria") . "...]</a>\n"); echo '<script>$("#actions_link").prop("disabled",true);</script>'; //printf("<P style='color:white;font-size:10px'><B>" . _("No events matching your search criteria have been found. Try fewer conditions.") . "</B> <a href='base_qry_main.php?clear_allcriteria=1&num_result_rows=-1&submit=Query+DB¤t_view=-1&sort_order=time_d'>[..." . _("Clear All Criteria") . "...]</a><P>\n"); } echo "</td></tr></table>"; }
$hasta = strtotime($_SESSION["time"][1][4] . "-" . $_SESSION["time"][1][2] . "-" . $_SESSION["time"][1][3] . ' ' . $_SESSION['time'][1][5] . ':' . $_SESSION['time'][1][6] . ':' . $_SESSION['time'][1][7]); $trdata = array($desde, $hasta, "range"); } list($x, $y, $xticks, $xlabels) = range_graphic($trdata); if (count($y) > 1) { //echo "SQLG:$sqlgraph -->"; $res = $qs->ExecuteOutputQueryNoCanned($sqlgraph, $db); //echo " COUNT:".$res->baseRecordCount()."<br>"; while ($rowgr = $res->baseFetchRow()) { //print_r($rowgr); $label = trim($rowgr[1] . " " . $rowgr[2]); if (isset($y[$label]) && $y[$label] == 0) { $y[$label] = $rowgr[0]; } //echo "$label = $rowgr[0] <br>"; } // Report data $gdata = array(); foreach ($y as $label => $val) { $gdata[] = array($label, "", "", "", "", "", "", "", "", "", "", $val, 0, 0); } $qs->SaveReportData($gdata, $graph_report_type); //print_r($xlabels);print_r($xticks);print_r ($x);print_r ($y); $plot = plot_graphic("plotareaglobal", 60, 600, $x, $y, $xticks, $xlabels, true, 'base_qry_main.php?num_result_rows=-1¤t_view=-1'); //echo "PLOT:".Util::htmlentities($plot)."."; echo $plot; $res->baseFreeRows(); } else { echo '<div class="plot_msg">' . _('Trend graph is not available with this date range') . '</div>'; } echo "</body></html>";
$desde = strtotime($_SESSION["time"][0][4] . "-" . $_SESSION["time"][0][2] . "-" . $_SESSION["time"][0][3]) + 3600 * $tz; $hasta = strtotime($_SESSION["time"][1][4] . "-" . $_SESSION["time"][1][2] . "-" . $_SESSION["time"][1][3]) + 3600 * $tz; $diff = $hasta - $desde; if ($diff > 2678400) { $tr = "all"; } elseif ($diff > 1296000) { $tr = "month"; } elseif ($diff > 604800) { $tr = "weeks"; } elseif ($diff >= 86400) { $tr = "week"; } else { $tr = "day"; $desde = strtotime($_SESSION["time"][0][4] . "-" . $_SESSION["time"][0][2] . "-" . $_SESSION["time"][0][3] . " " . $_SESSION["time"][0][5] . ":" . $_SESSION["time"][0][6] . ":" . $_SESSION["time"][0][7]) + 3600 * $tz; $hasta = strtotime($_SESSION["time"][1][4] . "-" . $_SESSION["time"][1][2] . "-" . $_SESSION["time"][1][3] . " " . $_SESSION["time"][1][5] . ":" . $_SESSION["time"][1][6] . ":" . $_SESSION["time"][1][7]) + 3600 * $tz; } $trdata = array($desde, $hasta, "range"); } list($x, $y, $xticks, $xlabels) = range_graphic($trdata); //echo $sqlgr."<br>"; $rgraph = $qs->ExecuteOutputQuery($sqlgraph, $db); $yy = $y; while ($rowgr = $rgraph->baseFetchRow()) { $label = trim($rowgr[1] . " " . $rowgr[2]); if (isset($yy[$label]) && $yy[$label] == 0) { $yy[$label] = $rowgr[0]; } } $rgraph->baseFreeRows(); $plot = plot_graphic("plotarea" . $plugin_id . "-" . $plugin_sid, 45, 320, $x, $yy, $xticks, $xlabels, false, 'base_qry_main.php?new=1&sig%5B0%5D=%3D&sig%5B1%5D=' . urlencode($plugin_id . ";" . $plugin_sid) . '&sig_type=1' . '&submit=' . gettext("Query DB") . '&num_result_rows=-1', "", false); echo $plot;
// GRAPH $graph = '<div id="plotarea' . $i . '" class="plot"></div>'; $sqlgr = str_replace("SIGCLASSID", $class_id, $sqlgraph); $rgraph = $qs->ExecuteOutputQuery($sqlgr, $db); $yy = $y; while ($rowgr = $rgraph->baseFetchRow()) { $label = trim($rowgr[1] . " " . $rowgr[2]); if (isset($yy[$label]) && $yy[$label] == 0) { $yy[$label] = $rowgr[0]; } } /*$x= array(1,2,3,4,5,6,7); $y= array(1,0,1,0,1,0,1); $xticks= array(1,2,3,4,5,6,7); $xlabels= array("","","","","","","");*/ $plot = plot_graphic("plotarea" . $i, 45, 400, $x, $yy, $xticks, $xlabels, false, $ocurrlink); qroPrintEntry($graph . $plot, 'center', 'middle'); qroPrintEntryFooter(); $i++; $prev_time = null; } $result->baseFreeRows(); $qro->PrintFooter(); $qs->PrintBrowseButtons(); $qs->PrintAlertActionButtons(); $qs->SaveState(); echo "\n</FORM>\n"; PrintBASESubFooter(); $et->Mark("Get Query Elements"); $et->PrintTiming(); echo "</body>\r\n</html>";