<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Your Hosts</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../js/sortabletable.js"></script>
<link type="text/css" rel="StyleSheet" href="../css/sortabletable.css" />
<style type="text/css">
body {
font-family: Verdana, Helvetica, Arial, Sans-Serif;
font: Message-Box;
}
code {
font-size: 1em;
}
</style>
</head>
<?php
include "../datediff.inc";
$now = date("m/j/y h:i:s",time());
include "../connect.php";
print '<body bgcolor="#F9F3E0">';
if (!extension_loaded('odbtp')) {
dl('../php_odbtp.so');
}
$con = odbtp_connect('===Stats Server IP ADDRESS HERE===','DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\program files\\stat\\scanner\\STAT Scanner Output DB.mdb' );
odbtp_set_attr( ODB_ATTR_FULLCOLINFO, TRUE );
//$stmt = stripslashes($stmt);
$now = date("j/m/y h:i:s",time());
$stmt = "select a.* " . $stmt . " order by ipnum";
//echo $stmt;
$sth = ibase_query($dbh, $stmt);
$i = 0;
?>
<body bgcolor="#F9F3E0" text="#000000">
<?
print '<table class="sort-table" id="table-1" cellspacing="0">';
print '<input type="hidden" name="serial[]" value="' . $row->SERIAL . '">';
print '<thead><tr><td title="NoSort"> </td><td>IP Address</td><td>MAC Address</td><td>Name</td><td>IASO/SA/Enduser</td><td>Building</td><td>Room</td><td>Barcode</td><td>Monitor</td><td>Stats</td></tr></thead><tbody>';
while ($row = ibase_fetch_object($sth)) {
$currenttime = time();
$lasttime = strtotime($row->LAST_SEEN);
$diffseen = - DateDiff ("d",$currenttime , $lasttime);
$daysseen = floor($diffseen);
print ' <tr> ';
// if (($row->BARCODE=='') || ($row->IASO=='') || ($row->OWNER=='') || ($row->OS=='') || ($row->BUILDING=='') || ($row->ROOM=='')) {
if (($row->IASO=='') || ($row->OWNER=='') || ($row->OS=='') || ($row->BUILDING=='') || ($row->ROOM=='')) {
if ($daysseen>10) {
$td='<td nowrap bgcolor="#EED3D6"> ';
} else {
$td='<td nowrap bgcolor="#FE2929"> ';
}
$compliant='NO';
} else {
if ($daysseen>10) {
$td='<td nowrap bgcolor="#D3EED3"> ';
} else {
$td='<td nowrap bgcolor="#18FF00"> ';
}
$compliant='YES';
}
$i = $i + 1;
print $td;
if ($row->OS != '') {
$stmtos = "Select o.OS, v.osversion, v.icon FROM os o, osversion v where (o.serial=v.os) order by o.os, v.osversion;";
$sthos = ibase_query($dbh, $stmtos);
while ($rowos = ibase_fetch_object($sthos)) {
if ($rowos->OS != '') {
$current_os = $rowos->OS . ' - ' . $rowos->OSVERSION;
if (($row->OS==$current_os) && ($rowos->ICON!='')) {
print '<img src="' . $rowos->ICON . '" alt="' . $row->OS . ' Last Seen: ' . $row->LAST_SEEN . '">'; }
}
}
}
if ($row->UPDATE_SERVER != '') {
$stmtupdate = "select * from updates where arp_table = '$row->SERIAL';";
$sthupdate = ibase_query($dbh, $stmtupdate);
if ($rowupdate = ibase_fetch_object($sthupdate)) {
print '<img src="update.gif" alt="On Update Server:' . $row->UPDATE_SERVER . ' Last Update: ' . $row->UPDATE_TIME . '">';
} else {
print '<img src="updatered.gif" alt="Error: On update server but not getting updates">';
}
}
if ($row->AV_SERVER != '') {
$lasttime = strtotime($row->LAST_SEEN);
$diffseen = - DateDiff ("d",$currenttime , $lasttime);
$daysseen = floor($diffseen);
list($avirusdate, $junk) = split(" ", $row->ANTIVIRUS);
$avirustime = strtotime($avirusdate);
$currenttime = time();
$diff = floor(- DateDiff ("d",$currenttime , $avirustime));
if (($diff>10) && ($diffseen<10) && (($row->LAPTOP=='') || ($row->LAPTOP=='0'))) {
print '<img src="shieldred.gif" alt="NAV Server: ' . $row->AV_SERVER . ' Virus Defs ' . $row->ANTIVIRUS . ' ' . $diff . 'days old">';
$compliant = 'NO';
} else {
print '<img src="shield.gif" alt="NAV Server: ' . $row->AV_SERVER . ' Virus Defs ' . $row->ANTIVIRUS . ' ' . $diff . 'days old">';
}
}
if ($row->CAC_TYPE!='') {
print '<img src="cardreader.gif" alt="CAC Card Reader Installed"';
}
print '</td>' . $td;
print '<a href="/iaso/right.php?COMP=';
print $compliant . '&SERIAL=' . $row->SERIAL;
if ($row->LAPTOP =='1') {
print '&LAPTOP=1';
}
print '" target="rightFrame">' . trim($row->IP_ADDRESS) . '</td>';
print $td . trim(strtoupper($row->MAC_ADDRESS)) . '</td>';
if (strlen($row->NETBIOS_NAME)!=0) {
print $td . $row->NETBIOS_NAME . '</td>';
} else {
if (strlen($row->DNS_NAME)!=0) {
print $td . $row->DNS_NAME . '</td>';
} else print $td . ' </td>';
}
if ($row->SYSTEM_USER != '') {
$stmt2 = "select display_name, phone from owner where SERIAL = '$row->SYSTEM_USER';";
$sth2 = ibase_query($dbh, $stmt2);
if ($row2 = ibase_fetch_object($sth2)) {
print $td . $row2->DISPLAY_NAME . '</td>';
}
} else {
if ($row->OWNER != '') {
$stmt3 = "select display_name, phone from owner where SERIAL = '$row->OWNER';";
$sth3 = ibase_query($dbh, $stmt3);
if ($row3 = ibase_fetch_object($sth3)) {
print $td . $row3->DISPLAY_NAME . '</td>';
}
} else {
if ($row->PRIMARY_POC != '') {
print $td . $row->PRIMARY_POC . '</td>';
} else { print $td . ' </td>'; }
}
}
print $td . $row->BUILDING . '</td>';
print $td . $row->ROOM . '</td>';
print $td . $row->BARCODE . '</td>';
print $td . $row->MONITOR_BARCODE . '</td>';
$TEMP = strtoupper($row->MAC_ADDRESS);
$MACADDRESS = '';
for ($k=0; $k<6; $k++) {
$MACADDRESS .= $TEMP[($k * 2)];
$MACADDRESS .= $TEMP[($k * 2)+1];
if ($k<>5) {
$MACADDRESS .= ':';
}
}
print $td;
error_reporting(0);
$myquery = "SELECT [Vulnerability Info TABLE].[IAVA ID] FROM ([Risk TABLE] INNER JOIN [Vulnerability Info TABLE] ON [Risk TABLE].[Risk ID] = [Vulnerability Info TABLE].[Risk ID]) INNER JOIN ([Scan TABLE] INNER JOIN ([Machine TABLE] INNER JOIN [Scan Output TABLE] ON [Machine TABLE].[Machine ID] = [Scan Output TABLE].[Machine ID]) ON [Scan TABLE].[Scan ID] = [Scan Output TABLE].[Scan ID]) ON [Vulnerability Info TABLE].[Vulnerability ID] = [Scan Output TABLE].[Vulnerability ID] WHERE [MACHINE TABLE].[MAC ADDRESS]='" . $MACADDRESS . "';";
$qry = odbtp_query($myquery);
if ($qry != '') {
do {
$msg = odbtp_get_message( $qry );
$cols = odbtp_num_fields( $qry );
for( $col = 0; $col < $cols; $col++ ) {
if( odbtp_field_bindtype( $qry, $col ) == ODB_DATETIME )
odbtp_bind_field( $qry, $col, ODB_CHAR );
}
while( ($rec = odbtp_fetch_array($qry)) ) {
// if (strpos($rec[0],'A')!=0) {
$pos = strpos($rec[0],'A');
if ($pos === false) { } else {
print $rec[0] . ' ';
}
}
}
while( odbtp_next_result( $qry ) );
} else print 'Stats Access Broken';
print ' </td>';
print '</A>';
print '</tr>';
}
print '</tbody>';
print '</table>';
?>
<script type="text/javascript">
var st1 = new SortableTable(document.getElementById("table-1"),
["NoSort","IP Address", "MAC Address", "Name","IASO/SA/Enduser","Building","Room", "Barcode","Monitor","Stats"]);
</script>
</body>