function port_max_occurrences($date_from, $date_to) { global $NUM_HOSTS; global $security_report; global $report_type; /* ossim framework conf */ $conf = $GLOBALS["CONF"]; $acid_link = $conf->get_conf("acid_link"); $ossim_link = $conf->get_conf("ossim_link"); $acid_prefix = $conf->get_conf("event_viewer"); $report_graph_type = $conf->get_conf("report_graph_type"); ?> <table align="center" width="750" cellpadding="0" cellspacing="0" class="noborder"> <tr><td class="headerpr"><?php echo _("Top"); ?> <?php echo "{$NUM_HOSTS}"; ?> <?php echo _("Used Ports"); ?> </td></tr> </table> <table align="center" width="750"> <tr> <td style="padding-top:15px;" valign="top" class="nobborder"> <table align="center"> <tr> <th><?php echo _("Port"); ?> </th> <th><?php echo _("Service"); ?> </th> <th><?php echo _("Occurrences"); ?> </th> </tr> <?php $list = $security_report->Ports($NUM_HOSTS, $report_type, $date_from, $date_to); foreach ($list as $l) { $port = $l[0]; $service = $l[1]; $occurrences = number_format($l[2], 0, ",", "."); ?> <tr> <td> <?php $link = "{$acid_link}/" . $acid_prefix . "_stat_uaddr.php?" . "tcp_port[0][0]=+&" . "tcp_port[0][1]=layer4_dport&" . "tcp_port[0][2]==&" . "tcp_port[0][3]={$port}&" . "tcp_port[0][4]=+&" . "tcp_port[0][5]=+&" . "tcp_port_cnt=1&" . "layer4=TCP&" . "num_result_rows=-1&" . "current_view=-1&" . "addr_type=1&" . "sort_order=occur_d"; echo "<a href=\"{$link}\">{$port}</a>"; ?> </td> <td><?php echo $service; ?> </td> <td><?php echo $occurrences; ?> </td> </tr> <?php } echo "</table>\n"; ?> </td> <td valign="top" class="nobborder"> <?php if ($report_graph_type == "applets") { jgraph_ports_graph(); } else { ?> <img src="graphs/ports_graph.php?ports=<?php echo $NUM_HOSTS; ?> &type=<?php echo $report_type; ?> &date_from=<?php echo urlencode($date_from); ?> &date_to=<?php echo urlencode($date_to); ?> "/> <?php } ?> </td> </tr> </table> <?php }
$c = 0; $shared_file = $dDB["_shared"]->dbfile(); $dDB["_shared"]->put("SS_UsedPorts" . $runorder, $list); $font_size = getFontSizeSIEM($list); foreach ($list as $l) { $port = $l[0]; $service = $l[1]; $occurrences = number_format($l[2], 0, ",", "."); $bc = $c++ % 2 != 0 ? "class='par'" : ""; $htmlPdfReport->set(' <tr ' . $bc . '> <td style="width:12mm;font-size:' . $font_size . 'px">' . $port . '</td> <td style="width:38mm;font-size:' . $font_size . 'px">' . Util::wordwrap($service, 21, " ", true) . '</td> <td style="width:22mm;text-align:center;font-size:' . $font_size . 'px">' . $occurrences . '</td> </tr>'); } $htmlPdfReport->set(' </table> </td> <td valign="top" style="padding-top:15px; width:98mm;">'); if ($report_graph_type == "applets") { jgraph_ports_graph(); } else { $htmlPdfReport->set('<img src="' . $htmlPdfReport->newImage('/report/graphs/ports_graph.php?shared=' . urlencode($shared_file) . '&ports=' . $NUM_HOSTS . '&type=' . $report_type . '&date_from=' . urlencode($date_from) . '&date_to=' . urlencode($date_to) . '&runorder=' . $runorder, 'png') . '" />'); } $htmlPdfReport->set(' </td> </tr> </table><br/><br/>'); }
function port_max_occurrences($date_from, $date_to) { global $NUM_HOSTS; global $security_report; global $report_type; /* ossim framework conf */ $conf = $GLOBALS['CONF']; $report_graph_type = $conf->get_conf('report_graph_type'); $list = $security_report->Ports($NUM_HOSTS, $report_type, $date_from, $date_to); if (!is_array($list) || empty($list)) { return 0; } ?> <table class='t_alarms'> <thead> <tr><td colspan='2' class="headerpr"><?php echo _("Top"); ?> <?php echo "{$NUM_HOSTS}"; ?> <?php echo _("Destination Ports"); ?> </td></tr> </thead> <tbody> <tr> <td class='td_container'> <table class='table_data'> <thead> <tr> <th><?php echo _("Port"); ?> </th> <th><?php echo _("Service"); ?> </th> <th><?php echo _("Occurrences"); ?> </th> </tr> </thead> <tbody> <?php foreach ($list as $l) { $port = $l[0]; $service = $l[1]; $occurrences = number_format($l[2], 0, ",", "."); ?> <tr> <td class='left td_data' valign='middle'><?php echo $port; ?> </td> <td class='left td_data' valign='middle'><?php echo $service; ?> </td> <td class='center td_data' valign='middle'><?php echo $occurrences; ?> </td> </tr> <?php } ?> </tbody> </table> </td> <td class='td_container'> <?php if ($report_graph_type == "applets") { jgraph_ports_graph(); } else { ?> <img src="graphs/ports_graph.php?ports=<?php echo $NUM_HOSTS; ?> &type=<?php echo $report_type; ?> &date_from=<?php echo urlencode($date_from); ?> &date_to=<?php echo urlencode($date_to); ?> "/> <?php } ?> </td> </tr> </tbody> </table> <?php return 1; }