Subversion Repositories ALCASAR

Rev

Go to most recent revision | Blame | Last modification | View Log

<?php 
/*
 * firewall Eyes
 * Copyright (C) 2004 Creabilis
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
include("configuration.php");
include("include.php");

// authentification check
authenticationCheck();

// Date in the past
header("Expires: Mon, 26 Jul 2004 00:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");

set_time_limit (300);


// TODO:
// predifined filters : all accept, all dropped/rejected

//line example :
//Sep 24 18:07:35 passerelle kernel: RULE 14 -- ACCEPT IN=eth1 OUT= MAC=00:04:e2:43:1c:c4:00:0b:cd:f9:f4:42:08:00 SRC=172.31.200.189 DST=172.31.1.253 LEN=48 TOS=0x00 PREC=0x00 TTL=128 ID=11059 DF PROTO=TCP SPT=1537 DPT=8080 WINDOW=65535 RES=0x00 SYN URGP=0 

$logfile=$configuration["logfile"];
$displayedLines=($_GET["displayedLines"] ? $_GET["displayedLines"] : $configuration["displayedLines"]);

$configurationVars=Array("resolvIp","resolvService","readFromTheEnd","exactSearch","automaticRefresh");
foreach($configurationVars as $confVarName) {
        ${$confVarName}=($_GET["searchAction"] ? $_GET[$confVarName] : $configuration[$confVarName]);

}

// init
$lineCount=0;
$indexForAction=getIndexForColumn("action",$logFields);
$indexForProtocol=getIndexForColumn("protocol",$logFields);
// get inputs
$criteria=$_GET["criteria"];

$maxWidth=0;
for($i=0; $i<count($logFields); $i++) {
        $maxWidth+=$logFields[$i][2];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
        <head>
                <title>Creabilis fw-Eyes</title>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
                <link href="log.css" rel="stylesheet" type="text/css"/>
                <script>
                function myrefresh() {
                        <?php if ($automaticSubmit) {?>
                        document.forms["search"].submit()
                        <?php } ?>
                }
                        </script>
        </head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF">
          
<table width="100%" height="100" border="0" cellpadding="0" cellspacing="0" background="images/header-background.jpg">
  <tr>
        <td valign="bottom" align="left" style="padding-left:19px"> 
                  <form method="GET" action="logs.php" style="margin: 0px;padding: 0px;" name="search" target="mainFrame">
                                <INPUT type="hidden" name="searchAction" value="1">
                        
                                <div class="topbox" > 
                                </div>
                                
                <table border="0" cellpadding="0" cellspacing="0" width="<?=$maxWidth?>">
                  <tr> 
                        <td rowspan="2" valign="top"><img src="images/logo-firewallEyes.gif" width="58" height="38" align="top"><img src="images/firewallEyes.jpg" width="199" height="48" align="top"></td>
                        <td align="right" class="topbox"> lignes&nbsp;affich&eacute;es&nbsp; 
                          <input name="displayedLines" type="text" class="inputText" style="width:30 px;" size="3" maxlength="6" value="<?=htmlentities(stripslashes($displayedLines))?>" onChange="myrefresh()"> 
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fichier&nbsp;log&nbsp; <select name="logfile2display" class="inputText" onChange="myrefresh()">
                                <?php
                                foreach($logfiles as $currentIndex=>$currentLogfile) {
                                ?>
                                <option value="<?=htmlspecialchars($currentIndex)?>"> 
                                <?=htmlspecialchars($currentLogfile)?>
                                </option>
                                <?php
                                }
                                ?>
                          </select> &nbsp;&nbsp; <input type="checkbox" name="readFromTheEnd" id="readFromTheEnd" value="1" <?= ($readFromTheEnd ? "checked" : "")?> onClick="myrefresh()"> 
                          <label for="readFromTheEnd">&nbsp;lecture&nbsp;depuis&nbsp;la&nbsp;fin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></td>
                  </tr>
                  <tr> 
                        <td colspan="<?=count($logFields)?>" align="left" class="topbox"> 
                          <input type="checkbox" name="automaticRefresh" id="automaticRefresh" value="1" <?= ($automaticRefresh ? "checked" : "")?> onClick="myrefresh()"> 
                          <label for="automaticRefresh">raffraichissement auto&nbsp;&nbsp;</label>
                          <input type="checkbox" name="resolvIp" id="resolvIp" value="1" <?= ($resolvIp ? "checked" : "")?> onClick="myrefresh()"> 
                          <label for="resolvIp">resolv&nbsp;IP&nbsp;&nbsp;</label> 
                          <input type="checkbox" name="resolvService" id="resolvService" value="1" <?= ($resolvService ? "checked" : "")?> onClick="myrefresh()"> 
                          <label for="resolvService">resolv&nbsp;services&nbsp;&nbsp;</label> 
                          <input type="checkbox" name="exactSearch" id="exactSearch" value="1" <?= ($exactSearch ? "checked" : "")?> onClick="myrefresh()">
                          <label for="exactSearch">recherche&nbsp;exacte&nbsp;&nbsp;</label> 
                          <input class="button" type="submit" value="Afficher"> 
                          <!--&nbsp;&nbsp;<input class="button" type="button" value="reset" onClick="top.window.location='index.html'">-->
                        </td>
                  </tr>
                </table>        
                                <table border="0" cellpadding="0" cellspacing="0" width="<?=$maxWidth?>">
                                        <tr>
                        <?php 
                                // tab header
                                for($i=0; $i<count($logFields); $i++) { 
                                        ?><td class="header"><span style="width: <?=$logFields[$i][2]?>px" class="header">&nbsp;<?=$logFields[$i][0]?></span>
                                        </td><?php 
                                }?>
                                        </tr>
                                        <tr>
                                                <?php 
                                                // search form
                                                for($i=0; $i<count($logFields); $i++) { 
                                                        ?><td><span style="width: <?=$logFields[$i][2]?>px"><input type="text" name="criteria[<?=htmlentities($logFields[$i][0])?>]" value="<?=htmlentities(stripslashes($criteria[$logFields[$i][0]]))?>" style="width: <?=$logFields[$i][2]?>px" class="inputText" onChange="myrefresh()"></span>
                                                        </td>
                                                        <?php 
                                                        
                                                }?>
                                        </tr>
                                </table>
                  </form>
                </td>
        </tr>
        </table>
        </body>
</html>