Ejemplo n.º 1
0
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&current_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)));
}
Ejemplo n.º 2
0
<td class="nobborder">|</td>
<td class="nobborder" nowrap> <a href="<?php 
echo Sensor::get_sensor_link($conn, $host) . "/{$host}.html";
?>
" target="report"> <?php 
echo gettext("Usage");
?>
 </a> </td>

<?php 
if (Host::in_host($conn, $host) || Net::isIpInAnyNet($conn, $host)) {
    $interface = Sensor::get_sensor_interface($conn, $host);
    ?>
<td class="nobborder">|</td>
<td class="nobborder" nowrap> <a href="<?php 
    echo Sensor::get_sensor_link($conn, $host) . "/plugins/rrdPlugin?action=list&key=interfaces/{$interface}/hosts/{$ip_slashed}&title=host%20{$host}";
    ?>
" target="report"> <?php 
    echo gettext("Anomalies");
    ?>
 </a> </td>

<?php 
}
$db->close($conn);
?>

<td class="nobborder">]</td>
</table>

</body>
Ejemplo n.º 3
0
        ?>
" title="<?php 
        echo $tit;
        ?>
"><?php 
        echo $tit2;
        ?>
<br><img src="../pixmaps/<?php 
        echo $graph;
        ?>
"></a></td></tr>
	</table>
	<?php 
    }
} else {
    $ntop_link = Sensor::get_sensor_link($conn, $host);
    if ($n == 1) {
        $source = "{$ntop_link}/hostTimeTrafficDistribution-{$host}-65535.png?1";
        $tit = $title . " " . gettext("Traffic Sent");
        $tit2 = gettext("Traffic Sent");
        $graph = "ntop_graph_thumb.gif";
    } elseif ($n == 2) {
        $source = "{$ntop_link}/hostTimeTrafficDistribution-{$host}-65535.png";
        $tit = $title . " " . gettext("Traffic Rcvd");
        $graph = "ntop_graph_thumb.gif";
        $tit2 = gettext("Traffic Rcvd");
    }
    //echo "headers de: ".$source."<br>";
    $salida = get_headers($source);
    //print_r($salida);
    if (!preg_match("/Not Found/", $salida[0]) && $salida != null) {
Ejemplo n.º 4
0
<?php 
        }
        ?>
</tr>

<?php 
        if ($ex_serv == $anom_services["ip"] && $ex_servs == $anom_services["sensor"] && $ex_servp == $anom_services["port"]) {
            if ($anom_services_ip_list = Host_services::get_anom_ip_list($conn, $ex_serv, $ex_servs, $ex_servp)) {
                foreach ($anom_services_ip_list as $anom_services_ip) {
                    ?>
	
	<tr bgcolor="#EFEFEF">
	<td>&nbsp;</td>
	<td>
	<A HREF="<?php 
                    echo Sensor::get_sensor_link($conn, $anom_services_ip["ip"]) . "/" . $anom_services_ip["ip"] . ".html";
                    ?>
" target="_blank" title="<?php 
                    echo $anom_services_ip["ip"];
                    ?>
">
	<?php 
                    echo Host::ip2hostname($conn, $anom_services_ip["ip"]);
                    ?>
</A>
	</td>
    <td colspan="1"><?php 
                    echo Host::ip2hostname($conn, $anom_services_ip["sensor"], true);
                    ?>
</td>
    <td colspan="1"><?php 
Ejemplo n.º 5
0
                 <TD>' . $ip . '</TD><TD>' . $netmask . '</TD></TR>
           </TABLE>';
}
/* Print the Statistics the IP address */
$db_object = new ossim_db();
if (is_array($_SESSION["server"]) && $_SESSION["server"][0] != "") {
    $conn_object = $db_object->custom_connect($_SESSION["server"][0], $_SESSION["server"][2], $_SESSION["server"][3]);
} else {
    $conn_object = $db_object->connect();
}
//$conn_object = $db_object->connect();
echo '<CENTER><B>' . $ip . '</B> ( ';
?>
 
  <a href="<?php 
echo Sensor::get_sensor_link($conn_object, $ip) . "/{$ip}.html";
?>
">See host Detail</a>
  <?php 
$db_object->close($conn_object);
echo ') <BR>FQDN: <B>';
if ($resolve_IP == 0) {
    echo '  (' . gettext("no DNS resolution attempted") . ')';
} else {
    if ($ip != "255.255.255.255") {
        echo baseGetHostByAddr($ip, $db, $dns_cache_lifetime);
    } else {
        echo $ip . ' (Broadcast)';
    }
}
if (VerifySocketSupport()) {
Ejemplo n.º 6
0
"
     target="main"> <?php 
echo gettext("Events");
?>
 </a> ] 
[ <a href="<?php 
//        echo "$mrtg_link/host_qualification/$ip.html"
echo "../control_panel/show_image.php?range=day&ip={$ip}&what=compromise&start=N-1D&type=host&zoom=1";
?>
"
     target="main"> <?php 
echo gettext("History");
?>
 </a> ] 
[ <a href="<?php 
echo Sensor::get_sensor_link($conn, $ip) . "/{$ip}";
?>
.html" 
     target="main"> <?php 
echo gettext("Monitor");
?>
 </a> ]
<!--
[ <a href="<?php 
echo "{$ntop_link}/{$ip}";
?>
.html" 
     target="main">Monitor</a> ]
-->
[ <a href="resetip.php?ip=<?php 
echo $ip;