[ PHPXref.com ] [ Generated: Sun Jul 20 19:01:46 2008 ] [ Nulog 1.1.7 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> packet.php (source)

   1  <?php 
   2  #
   3  # Copyright(C) 2003-2005 INL
   4  # Written by Eric Leblond <regit@inl.fr>
   5  #            Vincent Deffontaines <gryzor@inl.fr>
   6  #
   7  # This program is free software; you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, version 2 of the License.
  10  #
  11  #  This program is distributed in the hope that it will be useful,
  12  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  # GNU General Public License for more details.
  15  #
  16  # You should have received a copy of the GNU General Public License
  17  # along with this program; if not, write to the Free Software
  18  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19  #
  20  $show_state_menu="no";
  21  require ("include/header.inc");
  22  
  23  
  24  $id=$_GET['id'];
  25  $id=check_start($id);
  26  if ( isset($id)) {
  27  
  28  $state=$_GET['state'];
  29  if ($conntrack_enabled =='yes')
  30    $query="(select * from $table_ulog where id=$id) UNION (select * from $table_conntrack where id=$id)";
  31  else
  32    $query="select * from $table_ulog where id=$id";
  33  $sql_time=getmicrotime();
  34  $result=mysql_query($query);
  35  $sql_time=getmicrotime()-$sql_time;
  36  
  37   $ligne = mysql_fetch_row($result);
  38  echo "<div class=mainarray><h2>Details for packet $id</h2>";
  39   if ($nufw_enabled)
  40   {
  41    echo "<h3><img alt=\"user\" src=\"images/user.gif\"> User information</h3>"; 
  42    if (!$ligne[46]=="")
  43    {
  44      echo "<table class=packet> 
  45  <thead>
  46      <tr class=t_sheader><td>Username</td><td>User ID</td></tr>
  47      </thead>";
  48      echo "<tr class=t_datas><td>".$ligne[46]."</td><td>".$ligne[47]."</td></tr></table>";
  49    }
  50   }
  51  echo "<h3><img alt=\"user\" src=\"images/time.gif\"> Incoming time</h3>";
  52   echo "<table class=packet >
  53  <thead>
  54  <tr class=t_sheader><td>Time (sec)</td><td>µsec</td></tr>
  55  </thead>";
  56  echo "<tr><td>".date("D M j G:i:s",$ligne[2])."</td><td>".$ligne[3] ."
  57  </tr></table></td></tr>";
  58  
  59   echo "<h3><img alt=\"user\" src=\"images/route.gif\"> Routing information</h3>";
  60   echo "<table class=packet>
  61  <thead>
  62  <tr class=t_sheader><td>Raw mac</td><td>In interface</td><td>Out interface</td><td>Log Prefix</td><td>Mark</td></tr>
  63  </thead>";
  64   echo "<tr class=t_datas><td>".strtoupper($ligne[1])."</td><td>".$ligne[6]."</td><td>".$ligne[7]."</td><td>".$ligne[4]."</td><td>".$ligne[5]."</td>
  65  </tr></table></td></tr>";
  66  
  67   echo "<h3><img alt=\"user\" src=\"images/headers.gif\">IP headers</h3>"; 
  68  #IP header
  69  echo "<table class=packet>
  70  <thead>
  71  <tr class=t_sheader><td>Src Host</td><td>Dest Host</td></tr>
  72  </thead>
  73  ";
  74  settype($ligne[8],"double");
  75  
  76  settype($ligne[9],"double");
  77   echo "<tr class=t_datas><td><a href=host.php?host=".$ligne[8]."&state=".$state.">".long2ip($ligne[8])."</a></td><td>".long2ip($ligne[9])."</td>
  78  </tr></table></td></tr>";
  79  echo "<table class=packet>
  80  <thead>
  81  <tr class=t_sheader><td>TOS</td><td>TTL</td><td>Total Length</td><td>Header Length</td><td>Checksum</td><td>Id</td></tr>
  82  </thead>";
  83   echo "<tr class=t_datas>";
  84   for ($fields=11;$fields<=16;$fields++)
  85     echo "<td>".$ligne[$fields]."</td>";
  86   echo "</tr></table></td></tr>";
  87  
  88  #protocol specific header
  89   $proto=getprotobynumber($ligne[10]);
  90   echo "<h3><img alt=\"user\" src=\"images/proto.gif\"> Protocol $proto</h3>"; 
  91  #UDP
  92   if ($ligne[10]==17){
  93   echo "<table class=packet>
  94    <thead>
  95  <tr class=t_sheader><td>Src Port</td><td>Dest Port</td><td>UDP Len</td></tr>
  96  </thead>";
  97     echo "<tr class=t_datas><td>".$ligne[30]."</td><td><a href=port.php?port=".$ligne[31]."&state=".$state.">".$ligne[31]."</a></td><td>".$ligne[32]."</td>
  98  </tr></table></td></tr>";
  99   } elseif ($ligne[10]==6){
 100  #TCP
 101  
 102     echo "<table class=packet>
 103    <thead>
 104  <tr class=t_sheader><td>Src Port</td><td>Dest Port</td></tr>
 105  </thead>";
 106     echo "<tr class=t_datas><td>".$ligne[18]."</td><td><a href=port.php?port=".$ligne[19]."&state=".$state.">".$ligne[19]."</a></td>
 107  </tr></table></td></tr>";
 108    echo "<table class=packet>
 109    <thead>
 110  <tr class=t_sheader><td>Seq Number</td><td>Ack Number</td><td>Tcp Window</td></tr>
 111  </thead>";
 112     echo "<tr class=t_datas><td>".$ligne[20]."</td><td>".$ligne[21]."</td><td>".$ligne[22]."
 113  </tr></table></td></tr>";
 114    echo "<table class=packet>
 115    <thead>
 116  <tr class=t_sheader><td>URG</td><td>URGP</td><td>ACK</td><td>PSH</td><td>RST</td><td>SYN</td><td>FIN</td></tr>
 117  <thead>";
 118    echo "<tr class=t_datas>";
 119    for ($fields=23;$fields<=29;$fields++)
 120      echo "<td>".$ligne[$fields]."</td>";
 121    echo "</tr></table></td></tr>";
 122     
 123   } elseif ($ligne[10]==1){
 124  #ICMP
 125        echo "<table border=1>
 126  <thead><tr class=t_sheader><td>ICMP Type </td><td>ICMP Code</td></tr></thead>";
 127     echo "<tr class=t_datas><td>".$ligne[33]."</td><td>".$ligne[34]."</td>
 128  </tr></table></td></tr>";
 129   
 130   }
 131  
 132   if ($nufw_enabled)
 133   {
 134    echo "<h3><img alt=\"user\" src=\"images/info.gif\"> Other informations</h3>"; 
 135    if (!$ligne[48]=="")
 136    {
 137      echo "<table border=1> <tr class=t_sheader><td>OS</td><td>Application</td></tr>";
 138      echo "<tr class=t_datas><td>".$ligne[48]."</td><td>".$ligne[49]."</td></tr></table>";
 139    }
 140   }
 141     
 142  }
 143  
 144  echo "</table >";
 145  echo "</td></tr>";
 146  echo "</table>";
 147  require ("include/footer.inc");
 148  if ($footer_file){
 149      require($footer_file);
 150      }
 151  ?>
 152  </body>
 153  </html>


[ Powered by PHPXref - Served by Debian GNU/Linux ]