1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
<?php
/*
* Analysis Console for Intrusion Databases (ACID)
*
* Author: Roman Danyliw <rdd@cert.org>, <roman@danyliw.com>
*
* Copyright (C) 2000, 2001 Carnegie Mellon University
* (see the file 'acid_main.php' for license details)
*
* Purpose: status and event/dns/whois cache maintenance
*
*/
include("acid_constants.inc");
include("acid_conf.php");
include("acid_include.inc");
include_once("acid_db_common.php");
include_once("acid_common.php");
include_once("acid_stat_common.php");
$et = new EventTiming($debug_time_mode);
$cs = new CriteriaState("acid_maintenance.php");
$cs->ReadState();
$page_title = "Maintenance";
PrintACIDSubHeader($page_title, $page_title, $cs->GetBackLink());
$submit = ImportHTTPVar("submit");
?>
<P><P>
<FORM METHOD="POST"
ACTION="acid_maintenance.php">
<?php
/* Connect to the Alert database */
$db = NewACIDDBConnection($DBlib_path, $DBtype);
$db->acidDBConnect($db_connect_method,
$alert_dbname, $alert_host, $alert_port, $alert_user, $alert_password);
if ( $debug_mode > 0 )
echo "submit = '$submit'<P>";
set_time_limit($max_script_runtime);
if ( $submit == "Update Alert Cache" )
{
UpdateAlertCache($db);
}
else if ( $submit == "Rebuild Alert Cache" )
{
DropAlertCache($db);
UpdateAlertCache($db);
}
else if ( $submit == "Update IP Cache" )
{
UpdateDNSCache($db);
}
else if ( $submit == "Rebuild IP Cache" )
{
DropDNSCache($db);
UpdateDNSCache($db);
}
else if ( $submit == "Update Whois Cache" )
{
UpdateWhoisCache($db);
}
else if ( $submit == "Rebuild Whois Cache" )
{
DropWhoisCache($db);
UpdateWhoisCache($db);
}
echo '<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#669999">
<TR><TD>
<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#FFFFFF">
<TR><TD class="sectiontitle">PHP build</TD></TR>
<TR><TD>
<B>CLIENT:</B> '.$HTTP_USER_AGENT.'<BR>
<B>SERVER:</B> '.$SERVER_SOFTWARE.'<BR>
<B>SERVER HW:</B> '.php_uname().'<BR>
<B>PHP VERSION:</B> '.phpversion().'<BR>
<B>PHP API:</B> '.php_sapi_name().'<BR>';
$tmp_error_reporting_str = "";
if ( (ini_get("error_reporting") & E_ERROR) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_ERROR] ";
if ( (ini_get("error_reporting") & E_WARNING) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_WARNING] ";
if ( (ini_get("error_reporting") & E_PARSE) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_PARSE] ";
if ( (ini_get("error_reporting") & E_NOTICE) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_NOTICE] ";
if ( (ini_get("error_reporting") & E_CORE_WARNING) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_CORE_WARNING] ";
if ( (ini_get("error_reporting") & E_CORE_ERROR) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_CORE_ERROR] ";
if ( (ini_get("error_reporting") & E_COMPILE_ERROR) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_COMPILE_ERROR] ";
if ( (ini_get("error_reporting") & E_COMPILE_WARNING) > 0 )
$tmp_error_reporting_str = $tmp_error_reporting_str." [E_COMPILE_WARNING] ";
echo ' <B>PHP Logging level:</B> ('.ini_get("error_reporting").') '.$tmp_error_reporting_str.'<BR>
<B>Loaded Modules: </B> ';
$module_lst = get_loaded_extensions();
for ( $i = 0; $i < count($module_lst); $i++)
echo " [ ".$module_lst[$i]." ]";
echo ' </TD><TR>
</TABLE>
</TD></TR>
</TABLE><P>';
echo '<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#669999">
<TR><TD>
<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#FFFFFF">
<TR><TD class="sectiontitle">Database</TD></TR>
<TR><TD>';
GLOBAL $ADODB_vers;
echo "<B>DB Type:</B> $DBtype <BR>
<B>DB Abstraction Version:</B> $ADODB_vers <BR>
<B>ALERT DB Name:</B> $alert_dbname <BR>
<B>ARCHIVE DB Name:</B> $archive_dbname <BR>
</TD><TR>
</TABLE>
</TD></TR>
</TABLE><P>";
echo '<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#669999">
<TR><TD>
<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#FFFFFF">
<TR><TD class="sectiontitle">Alert Information Cache</TD></TR>
<TR><TD>';
$event_cnt_lst = $db->acidExecute("SELECT COUNT(*) FROM event");
$event_cnt_row = $event_cnt_lst->acidFetchRow();
$event_cnt = $event_cnt_row[0];
$event_cnt_lst->acidFreeRows();
$cache_event_cnt_lst = $db->acidExecute("SELECT COUNT(*) FROM acid_event");
$cache_event_cnt_row = $cache_event_cnt_lst->acidFetchRow();
$cache_event_cnt = $cache_event_cnt_row[0];
$cache_event_cnt_lst->acidFreeRows();
echo '<B>Total Events:</B> '.$event_cnt.'  
<B>Cached Events:</B> '.$cache_event_cnt.'
<INPUT TYPE="submit" NAME="submit" VALUE="Update Alert Cache">
<INPUT TYPE="submit" NAME="submit" VALUE="Rebuild Alert Cache">';
echo ' </TD><TR>
</TABLE>
</TD></TR>
</TABLE><P>';
echo '<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#669999">
<TR><TD>
<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="#FFFFFF">
<TR><TD class="sectiontitle">IP Address Cache</TD></TR>
<TR><TD>';
$uncached_sip_cnt = UniqueSrcIPCnt($db);
$uncached_dip_cnt = UniqueDstIPCnt($db);
$ip_result = $db->acidExecute("SELECT COUNT(DISTINCT ip_src) FROM acid_event ".
"INNER JOIN acid_ip_cache ON ipc_ip = ip_src ".
"WHERE ipc_fqdn is not NULL");
$row = $ip_result->acidFetchRow();
$ip_result->acidFreeRows();
$cached_sip_cnt = $row[0];
$ip_result = $db->acidExecute("SELECT COUNT(DISTINCT ip_dst) FROM acid_event ".
"INNER JOIN acid_ip_cache ON ipc_ip = ip_dst ".
"WHERE ipc_fqdn is not NULL");
$row = $ip_result->acidFetchRow();
$ip_result->acidFreeRows();
$cached_dip_cnt = $row[0];
$ip_result = $db->acidExecute("SELECT COUNT(DISTINCT ip_src) FROM acid_event ".
"INNER JOIN acid_ip_cache ON ipc_ip = ip_src ".
"WHERE ipc_whois is not NULL");
$row = $ip_result->acidFetchRow();
$ip_result->acidFreeRows();
$cached_swhois_cnt = $row[0];
$ip_result = $db->acidExecute("SELECT COUNT(DISTINCT ip_dst) FROM acid_event ".
"INNER JOIN acid_ip_cache ON ipc_ip = ip_dst ".
"WHERE ipc_whois is not NULL");
$row = $ip_result->acidFetchRow();
$ip_result->acidFreeRows();
$cached_dwhois_cnt = $row[0];
echo '<B>Unique Src IP:</B> '.$uncached_sip_cnt.'   '.
'<B>DNS Cached:</B> '.$cached_sip_cnt.' '.
'<B>Whois Cached:</B> '.$cached_swhois_cnt.'<BR>'.
'<B>Unique Dst IP:</B> '.$uncached_dip_cnt.'   '.
'<B>DNS Cached:</B> '.$cached_dip_cnt.' '.
'<B>Whois Cached:</B> '.$cached_dwhois_cnt.'<BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Update IP Cache">
<INPUT TYPE="submit" NAME="submit" VALUE="Update Whois Cache"><BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Rebuild IP Cache">
<INPUT TYPE="submit" NAME="submit" VALUE="Rebuild Whois Cache"><BR>';
echo ' </TD><TR>
</TABLE>
</TD></TR>
</TABLE><P>';
$et->PrintTiming();
echo "\n</FORM>\n";
PrintACIDSubFooter();
?>
|