$service_name = "<span class=\\'size12n\\'>" . $v['service'] . "</span><span class=\\'size10n ml3\\'> (" . $v['port'] . "/" . getprotobynumber($v['protocol']) . ")</span>"; $service_key = "item_prop_8_{$cont_3}###" . $v['host'] . "###" . $v['port'] . "###" . $v['protocol'] . "###" . $v['service'] . "###4"; $json_properties .= "{ title: '<span>" . $service_name . "</span>', key:'{$service_key}', isFolder:true, icon:'" . $image_url . getPropertyImage("") . "', children:["; $json_properties .= "{ title: '<span class=\\'size12n\\'>" . _("Version") . ": </span><span class=\\'ml3 size12b\\'>" . $v['version'] . "</span>', key:'serv_version_" . $cont_3 . "', hideCheckbox: true, isFolder:false, icon:'" . $image_url . getPropertyImage('property') . "'},"; $json_properties .= "{ title: '<span class=\\'size12n\\'>" . _("Date") . ": </span><span class=\\'ml3 size12b\\'> " . $v['date'] . "</span>', key:'serv_date_" . $cont_3 . "', hideCheckbox: true, isFolder:false, icon:'" . $image_url . getPropertyImage('property') . "'},"; $img_nagios = $v['nagios'] == true ? "nagios_ok" : "nagios_ko"; $nagios_key = "nagios_{$cont_3}###" . $v['port'] . "###" . $img_nagios; $nagios = "<img src=\\'../pixmaps/theme/" . getPropertyImage($img_nagios) . "\\'/>"; $json_properties .= "{ title: '<span class=\\'size12n\\'>" . _("Nagios") . ": </span><span class=\\'ml3 size12b\\'>{$nagios}</span>', key:'{$nagios_key}', hideCheckbox: true, isFolder:false, icon:'" . $image_url . getPropertyImage('property') . "'}"; $json_properties .= $num_s == $cont_3 ? "]}" : "]},"; } $json_properties .= "]}"; $json_properties .= "]}]"; break; case "tree_container_2": $services_list = Host_services::get_ip_data($conn, $ip, '1'); if (!is_array($services_list)) { $services_list = array(); } $num_s = count($services_list); $cont = 0; $is_folder = $num_s > 0 ? "true" : "false"; $json_properties = "[{title: '<span>" . _("Services") . "</span>', addClass:'size12', key:'property_8', isFolder:" . $is_folder . ", hideCheckbox: true, icon:'" . $image_url . getPropertyImage('services') . "', children:["; foreach ($services_list as $k => $v) { $cont++; $service_name = "<span class=\\'size12n nagios\\'>" . $v['service'] . "</span><span class=\\'size10n ml3 nagios\\'> (" . $v['port'] . "/" . getprotobynumber($v['protocol']) . ")</span>"; $img_nagios = $v['nagios'] == true ? "nagios_ok" : "nagios_ko"; $select_nagios = $v['nagios'] == true ? "select: true," : ""; $nagios = "<img src=\\'../pixmaps/theme/" . getPropertyImage($img_nagios) . "\\'/>"; $service_key = "nagios_{$cont}###" . $v['port'] . "###" . $img_nagios; $json_properties .= "{ title: '<span>" . $service_name . "</span>', key:'{$service_key}', {$select_nagios} isFolder:true, icon:'" . $image_url . getPropertyImage("") . "', children:[";
} ?> > <input type="hidden" name="nagios<?php echo $servs++; ?> " value="<?php echo $services['port']; ?> "></td> </tr> <?php } } } elseif (GET('origin') == 'passive') { if ($services_list = Host_services::get_ip_data($conn, $host, '0')) { foreach ($services_list as $services) { ?> <tr> <td><?php echo $services['service'] . " (" . $services['port'] . "/" . getprotobynumber($services['protocol']) . ")"; ?> </td> <td><?php echo $services['version']; ?> </td> <td><?php echo $services['date']; ?> </td>
function host_row_basic($host, $conn, $criterias, $has_criterias, $networks, $hosts_ips, $i) { require_once "classes/Sensor.inc"; $color = $i % 2 == 0 ? "#F2F2F2" : "#FFFFFF"; $ip = $host->get_ip(); $host_name = $ip != $host->get_hostname() ? $host->get_hostname() . " ({$ip})" : $ip; $gi = geoip_open("/usr/share/geoip/GeoIP.dat", GEOIP_STANDARD); $country = strtolower(geoip_country_code_by_addr($gi, $ip)); $country_name = geoip_country_name_by_addr($gi, $ip); geoip_close($gi); if ($country) { $country_img = " <img src=\"../pixmaps/flags/" . $country . ".png\" alt=\"{$country_name}\" title=\"{$country_name}\">"; } else { $country_img = ""; } //$homelan = (Net::isIpInNet($ip, $networks) || in_array($ip, $hosts_ips)) ? " <a href=\"javascript:;\" class=\"scriptinfo\" style=\"text-decoration:none\" ip=\"".$ip."\"><img src=\"../forensics/images/homelan.png\" border=0></a>" : ""; // Network require_once 'classes/Net.inc'; $netname = Net::GetClosestNet($conn, $ip); if ($netname != false) { $ips = Net::get_ips_by_name($conn, $netname); $net = "<b>{$netname}</b> ({$ips})"; } else { $net = "<i>" . _("Asset Unknown") . "</i>"; } // Inventory $os_data = Host_os::get_ip_data($conn, $ip); if ($os_data["os"] != "") { $os = $os_data["os"]; $os_pixmap = Host_os::get_os_pixmap($conn, $ip); } else { $os = _("OS Unknown"); $os_pixmap = ""; } require_once 'classes/Host_services.inc'; $services = Host_services::get_ip_data($conn, $ip, 0); $services_arr = array(); foreach ($services as $serv) { $services_arr[$serv['service']]++; } // Vulnerabilities require_once 'classes/Status.inc'; list($vuln_list, $num_vuln, $vuln_highrisk, $vuln_risknum) = Status::get_vul_events($conn, $ip); $vuln_list_str = ""; $v = 0; foreach ($vuln_list as $vuln) { if ($v++ < 20) { $vuln_list_str .= $vuln['name'] . "<br>"; } } $vuln_list_str = str_replace("\"", "", $vuln_list_str); $vuln_caption = $num_vuln > 0 ? ' class="greybox_caption" data="' . $vuln_list_str . '"' : ' class="greybox"'; // Incidents $sql = "SELECT count(*) as num FROM alarm WHERE src_ip=INET_ATON(\"{$ip}\") OR dst_ip=INET_ATON(\"{$ip}\")"; if (!($rs =& $conn->Execute($sql))) { $num_alarms = _("Error in Query: {$sql}"); } else { if (!$rs->EOF) { $num_alarms = $rs->fields['num']; } } if ($num_alarms > 0) { $alarm_link = '<a href="../control_panel/alarm_console.php?&hide_closed=1&hmenu=Alarms&smenu=Alarms&src_ip=' . $ip . '&dst_ip=' . $ip . '" target="main"><b>' . $num_alarms . '</b></a>'; } else { $alarm_link = '<b>' . $num_alarms . '</b>'; } $sql = "SELECT count(*) as num FROM incident_alarm WHERE src_ips=\"{$ip}\" OR dst_ips=\"{$ip}\""; if (!($rs =& $conn->Execute($sql))) { $num_tickets = _("Error in Query: {$sql}"); } else { if (!$rs->EOF) { $num_tickets = $rs->fields['num']; } } if ($num_tickets > 0) { $tickets_link = '<a href="../incidents/index.php?status=Open&hmenu=Tickets&smenu=Tickets&with_text=' . $ip . '" target="main"><b>' . $num_tickets . '</b></a>'; } else { $tickets_link = '<b>' . $num_tickets . '</b>'; } // Events list($sim_events, $sim_foundrows, $sim_highrisk, $sim_risknum, $sim_date) = Status::get_SIM_light($ip, $ip); if ($sim_foundrows > 0) { $sim_link = '<a href="../forensics/base_qry_main.php?&num_result_rows=-1&submit=Query+DB¤t_view=-1&sort_order=time_d&ip=' . $ip . '&date_range=week&hmenu=Forensics&smenu=Forensics" target="main"><b>' . $sim_foundrows . '</b></a>'; } else { $sim_link = '<b>' . $sim_foundrows . '</b>'; } // $txt_tmp1 = _('Events in the SIEM'); $txt_tmp2 = _('Events in the logger'); if ($_SESSION['inventory_search']['date_from'] != "" && $_SESSION['inventory_search']['date_from'] != '1700-01-01') { $start_week = $_SESSION['inventory_search']['date_from']; } else { $start_week = strftime("%Y-%m-%d", time() - 24 * 60 * 60 * 1); } if ($_SESSION['inventory_search']['date_to'] != "" && $_SESSION['inventory_search']['date_to'] != '3000-01-01') { $end = $_SESSION['inventory_search']['date_to']; } else { $end = strftime("%Y-%m-%d", time()); } if ($start_week == strftime("%Y-%m-%d", time() - 24 * 60 * 60 * 1) && $end == strftime("%Y-%m-%d", time())) { $txt_tmp1 .= _(' (Last Week)'); $txt_tmp2 .= _(' (Last Day)'); } $start_week_temp = $start_week; $start_week .= ' 00:00:00'; $end_temp = $end; $end .= ' 23:59:59'; // //$start_week = strftime("%Y-%m-%d %H:%M:%S", time() - (24 * 60 * 60 * 7)); //$end = strftime("%Y-%m-%d %H:%M:%S", time()); list($sem_events_week, $sem_foundrows_week, $sem_date, $sem_wplot_y, $sem_wplot_x) = Status::get_SEM("", $start_week, $end, "none", 1234, $ip); if ($sem_foundrows_week > 0) { $sem_link = '<a href="../sem/index.php?hmenu=SEM&smenu=SEM&query=' . urlencode($ip) . '&start=' . urlencode($start_week) . '" target="main"><b>' . $sem_foundrows_week . '</b></a>'; } else { $sem_link = '<b>' . $sem_foundrows_week . '</b>'; } // Anomalies list($event_list, $anm_foundrows, $anm_foundrows_week, $anm_date) = Status::get_anomalies($conn, $ip); // Ntp link $ntop_lnk = Sensor::get_sensor_link($conn, $ip); if (preg_match("/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $ntop_lnk, $fnd)) { $ntop_ip = $fnd[1]; } else { $ntop_ip = $ip; } // $row = '<tr bgcolor="' . $color . '"> <td class="nobborder" style="text-align:center;padding:2px"><a href="../report/host_report.php?host=' . $ip . '&star_date=' . $start_week_temp . '&end_date=' . $end_temp . '" id="' . $ip . ';' . $host->get_hostname() . '" class="HostReportMenu" style="color:#17457c;font-size:15px;text-align:left"><b>' . $host_name . '</b></font></a><br><font style="color:gray">' . $net . '</font></td> <td class="nobborder" style="text-align:center;padding:2px">' . $os . ' ' . $os_pixmap . '<br>' . implode("<br>", array_keys($services_arr)) . '</td> <td class="nobborder" style="text-align:center;padding:2px"><a href="../vulnmeter/index.php?value=' . $ip . '&type=hn&withoutmenu=1&hmenu=Vulnerabilities&smenu=Vulnerabilities" title="Top 20 ' . _("Vulnerabilities for") . ' ' . $ip . '"' . $vuln_caption . '>' . $num_vuln . '</a></td> <td class="nobborder" style="text-align:center;padding:2px">' . $alarm_link . ' ' . _("Alarms") . '<br>' . $tickets_link . ' ' . _("Tickets") . '</td> <td class="nobborder" style="padding:2px">' . $sim_link . ' ' . $txt_tmp1 . '<br>' . $sem_link . ' ' . $txt_tmp2 . '</td> <td class="nobborder" style="text-align:center;padding:2px"><a href="../control_panel/anomalies.php?withoutmenu=1" class="greybox" title="' . _("Anomalies") . '"><b>' . $anm_foundrows . '</b></a></td> <td class="nobborder" style="text-align:center;padding:2px"> <table class="transparent"> <tr> <td class="nobborder"><img src="../pixmaps/ntop_graph_thumb.gif" width="40"></td> <td class="nobborder"><a href="../ntop/index.php?opc=services&sensor=' . $ntop_ip . '&hmenu=Network&smenu=Profiles&link_ip=' . $ip . '" target="main">' . _("Traffic Sent/Rcvd") . '</a></td> </tr> </table> </td> </tr>'; // <td class="nobborder"><a href="'.Sensor::get_sensor_link($conn,$ip).'/hostTimeTrafficDistribution-'.$ip.'-65535.png?1" class="greybox">'._("Traffic Sent").'</a><br><a href="'.Sensor::get_sensor_link($conn,$ip).'/hostTimeTrafficDistribution-'.$ip.'-65535.png" class="greybox">'._("Traffic Rcvd").'</a></td> echo str_replace("\n", "", str_replace("\r", "", str_replace("'", "", $row))); }
?> </th> <th class="tableServices_t2"> <?php echo _("Version"); ?> </th> <th class="tableServices_t3"> <?php echo _("Date"); ?> </th> </tr> </table> <table id="tableServices" class="noborder"> <?php $services_list = Host_services::get_ip_data($conn, $host, ""); $property_list = Host::get_host_properties($conn, $host); $temp_array = array_merge($services_list, $property_list); usort($temp_array, 'orderArray'); // if (!empty($temp_array)) { $i = 1; foreach ($temp_array as $services) { $bgcolor = $i % 2 == 0 ? "#E1EFE0" : "#FFFFFF"; ?> <tr> <?php if (empty($services['id'])) { // Services ?> <td class="tableServices_t1" bgcolor="<?php