[prev in list] [next in list] [prev in thread] [next in thread] 

List:       os-sim-commits
Subject:    [Os-sim-commits] os-sim/www/control_panel events.php,1.12,1.13
From:       Dominique Karg <dkarg () users ! sourceforge ! net>
Date:       2009-01-29 14:47:44
Message-ID: E1LSYBE-0001pm-4O () 23jxhf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/os-sim/os-sim/www/control_panel
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7040

Modified Files:
	events.php 
Log Message:
Show some more info when expanding alarms


Index: events.php
===================================================================
RCS file: /cvsroot/os-sim/os-sim/www/control_panel/events.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- events.php	22 Oct 2007 15:52:59 -0000	1.12
+++ events.php	29 Jan 2009 14:47:42 -0000	1.13
@@ -7,6 +7,115 @@
   <title> <?php echo gettext("Control Panel"); ?> </title>
   <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
   <link rel="stylesheet" href="../style/style.css"/>
+<style type="text/css">
+
+#hintbox{ /*CSS for pop up hint box */
+position:absolute;
+top: 0;
+background-color: lightyellow;
+width: 150px; /*Default width of hint.*/ 
+padding: 3px;
+border:1px solid black;
+font:normal 11px Verdana;
+line-height:18px;
+z-index:100;
+border-right: 3px solid black;
+border-bottom: 3px solid black;
+visibility: hidden;
+}
+
+.hintanchor{ /*CSS for link that shows hint onmouseover*/
+font-weight: bold;
+color: navy;
+margin: 3px 8px;
+}
+
+</style>
+
+<script type="text/javascript">
+
+/***********************************************
+* Show Hint script-  © Dynamic Drive (www.dynamicdrive.com)
+* This notice MUST stay intact for legal use
+* Visit http://www.dynamicdrive.com/ for this script and 100s more.
+***********************************************/
+		
+var horizontal_offset="-10px" //horizontal offset of hint box from anchor link
+
+/////No further editting needed
+
+var vertical_offset="30" //horizontal offset of hint box from anchor link. No need \
to change. +var ie=document.all
+var ns6=document.getElementById&&!document.all
+
+function getposOffset(what, offsettype){
+var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
+var parentEl=what.offsetParent;
+while (parentEl!=null){
+totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : \
totaloffset+parentEl.offsetTop; +parentEl=parentEl.offsetParent;
+}
+return totaloffset;
+}
+
+function iecompattest(){
+return (document.compatMode && document.compatMode!="BackCompat")? \
document.documentElement : document.body +}
+
+function clearbrowseredge(obj, whichedge){
+var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : \
parseInt(vertical_offset)*-1 +if (whichedge=="rightedge"){
+var windowedge=ie && !window.opera? \
iecompattest().scrollLeft+iecompattest().clientWidth-30 : \
window.pageXOffset+window.innerWidth-40 \
+dropmenuobj.contentmeasure=dropmenuobj.offsetWidth +if (windowedge-dropmenuobj.x < \
dropmenuobj.contentmeasure) \
+edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset) +}
+else{
+var windowedge=ie && !window.opera? \
iecompattest().scrollTop+iecompattest().clientHeight-15 : \
window.pageYOffset+window.innerHeight-18 \
+dropmenuobj.contentmeasure=dropmenuobj.offsetHeight +if (windowedge-dropmenuobj.y < \
dropmenuobj.contentmeasure) +edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
+}
+return edgeoffset
+}
+
+function showhint(menucontents, obj, e, tipwidth){
+if ((ie||ns6) && document.getElementById("hintbox")){
+dropmenuobj=document.getElementById("hintbox")
+dropmenuobj.innerHTML=menucontents
+dropmenuobj.style.left=dropmenuobj.style.top=-500
+if (tipwidth!=""){
+dropmenuobj.widthobj=dropmenuobj.style
+dropmenuobj.widthobj.width=tipwidth
+}
+dropmenuobj.x=getposOffset(obj, "left")
+dropmenuobj.y=getposOffset(obj, "top")
+dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, \
"rightedge")+obj.offsetWidth+"px" \
+dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px" \
+dropmenuobj.style.visibility="visible" +obj.onmouseout=hidetip
+}
+}
+
+function hidetip(e){
+dropmenuobj.style.visibility="hidden"
+dropmenuobj.style.left="-500px"
+}
+
+function createhintbox(){
+var divblock=document.createElement("div")
+divblock.setAttribute("id", "hintbox")
+document.body.appendChild(divblock)
+}
+
+if (window.addEventListener)
+window.addEventListener("load", createhintbox, false)
+else if (window.attachEvent)
+window.attachEvent("onload", createhintbox)
+else if (document.getElementById)
+window.onload=createhintbox
+
+</script>
 </head>
 
 <body>
@@ -25,6 +134,12 @@
 require_once ('classes/Util.inc');
 require_once ('classes/Security.inc');
 
+/*****************
+Not the best place for such a definition, should come from db
+*****************/
+$default_asset = 2;
+/****************/
+
 $backlog_id = GET('backlog_id');
 $event_id = GET('event_id');
 $show_all = GET('show_all');
@@ -57,6 +172,13 @@
     $show_all = 0;
 }
 
+$host_list = Host::get_list($conn);
+foreach($host_list as $host){
+$assets[$host->get_ip()] = $host->get_asset();
+}
+
+$master_alarm_sid = 0;
+
 ?>
     <table width="100%">
    
@@ -118,14 +240,21 @@
             if ($plugin_sid_list = Plugin_sid::get_list
                 ($conn, "WHERE plugin_id = $id AND sid = $sid")) {
                 $sid_name = $plugin_sid_list[0]->get_name();
+                $sid_priority = $plugin_sid_list[0]->get_priority();
             } else {
                 $sid_name = "Unknown (id=$id sid=$sid)";
+                $sid_priority = "N/A";
             }
-        
+       
 ?>
       <tr>
         <?php
             $name = ereg_replace("directive_event: ", "", $sid_name);
+
+             if(!$master_alarm_sid){
+              $master_alarm_sid = $sid;
+	    }
+
             if ($alarm->get_alarm())
 						    $name = Util::translate_alarm($conn, $name, $alarm);
                 $name = "<b>$name</b>";
@@ -157,15 +286,22 @@
         <td><?php echo $aid ?></td>
         <td <?php if ($alarm->get_alarm()) echo " bgcolor=\"#eeeeee\"" ?>>
         <?php 
+	    $asset_src = array_key_exists($alarm->get_src_ip(),$assets) ? \
$assets[$alarm->get_src_ip()] : $default_asset; +	    $asset_dst = \
array_key_exists($alarm->get_dst_ip(),$assets) ? $assets[$alarm->get_dst_ip()] : \
$default_asset; +
             if (($snort_sid > 0) and ($snort_cid)) {
                 $href = "$acid_link/" . $acid_prefix . 
                     "_qry_alert.php?submit=%230-%28" . 
                     "$snort_sid-$snort_cid%29";
-                echo "&nbsp;&nbsp;<a href=\"$href\">$name</a>";
             } else {
-                $href = "";
-                echo "&nbsp;&nbsp;$name"; 
+                $href = "#";
             }
+         echo "&nbsp;&nbsp;<a href=\"$href\"" . 
+        " onMouseOver=\"showhint('" .
+        "<ul><li>Src Asset: $asset_src<br/>" .
+        "<li>Dst Asset: $asset_dst<br/>" .     
+        "<li>Priority: $sid_priority</li></ul>" .
+	"', this, event, '200px')\" target=\"_blank\">$name</a>";
         ?></td>
         <!-- end id & name event -->
         
@@ -216,14 +352,16 @@
         <td nowrap>
           <a href="<?php echo Util::get_acid_date_link($date, 
                                                        $src_ip,
-                                                       "ip_src") ?>">
+                                                       "ip_src") ?>" \
target="_blank">  <font color="black"><?php echo $date ?></font>
           </a>
         </td>
 
 <?php
     $src_link = "../report/index.php?host=$src_ip&section=events";
+    $src_title = "<ul><li>Src Asset: $asset_src</li><li>IP: $src_ip</li></ul>"; 
     $dst_link = "../report/index.php?host=$dst_ip&section=events";
+    $dst_title = "<ul><li>Dst Asset: $asset_dst</li><li>IP: $dst_ip</li></ul>"; 
     $src_name = Host::ip2hostname($conn, $src_ip);
     $dst_name = Host::ip2hostname($conn, $dst_ip);
     $src_img  = Host_os::get_os_pixmap($conn, $src_ip);
@@ -232,9 +370,9 @@
 ?>
         <!-- src & dst hosts -->
         <td bgcolor="#eeeeee" nowrap>
-            <?php echo "<a href=\"$src_link\">$src_name</a>:$src_port $src_img"; \
?></td> +            <?php echo "<a href=\"$src_link\" \
onMouseOver=\"showhint('$src_title', this, event, '200px')\" \
target=\"_blank\">$src_name</a>:$src_port $src_img"; ?></td>  <td bgcolor="#eeeeee" \
                nowrap>
-            <?php echo "<a href=\"$dst_link\">$dst_name</a>:$dst_port $dst_img"; \
?></td> +            <?php echo "<a href=\"$dst_link\" \
onMouseOver=\"showhint('$dst_title', this, event, '200px')\" \
target=\"_blank\">$dst_name</a>:$dst_port $dst_img"; ?></td>  <!-- src & dst hosts \
-->  
         <td><?php echo $alarm->get_rule_level() ?></td>
@@ -270,33 +408,6 @@
               "
             </td>
         ";
-/*
-        echo "
-          <tr>
-            <td></td>
-            <td colspan=\"3\" bgcolor=\"#eeeeee\">&nbsp;</td>
-            <td colspan=\"5\">
-              <table width=\"100%\">
-                <tr>
-                  <th colspan=\"8\">Alarm summary</th>
-                </tr>
-                <tr>
-                  <td>Total Events: </td>
-                  <td>" . $summary["count"] . "</td>
-                  <td>Unique Dst IPAddr: </td>
-                  <td>" . $summary["dst_ips"] . "</td>
-                  <td>Unique Types: </td>
-                  <td>" . $summary["types"] . "</td>
-                  <td>Unique Dst Ports: </td>
-                  <td>" . $summary["dst_ports"] . "</td>
-                </tr>
-               </table>
-            </td>
-            <td bgcolor=\"#eeeeee\">&nbsp;</td>
-          </tr>
-          <tr><td colspan=\"10\"></td></tr>
-        ";
-*/
     }
 ?>
 
@@ -314,7 +425,10 @@
     } /* if alarm_list */
 ?>
     </table>
-
+<br/>
+<center>
+<a href="../directives/viewer/index.php?level=1&directive=<?= $master_alarm_sid; ?>" \
target="_blank">View/Edit current directive definition</a> +</center>
 
 <?php
 if($have_scanmap) fclose($backlog_file);



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

_______________________________________________
Os-sim-commits mailing list
Os-sim-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/os-sim-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic