2007-04-21 Sancho Lerena <slerena@gmail.com>

* include/languages/language_en.php: New strings added.

        * include/functions.php: Added function output_clean_strict().

        * operation/agentes/estado_ultimopaquete.php: Fixed title when
        some ugly characters used (like #).

        * operation/agentes/estado_generalagente.php: OS icon show,
        ignoring $agent_type parameter.

        * operation/agentes/estado_agente.php: OS icon show, ignoring
        agent_type variable.

        * godmode/grupos/configurar_grupo.php: Now it's possible to define
        parent group.

        * godmode/grupos/lista_grupos.php: Parent for group and some code
        cleanup. Added confirmation to group delete.

        * godmode/agentes/module_manager.php: Added confirmation to some
        items and added "data fix" new feature to delete data above 1.3 of
        average value of graph.

        * godmode/agentes/modificar_agente.php: Confirmation before delete
        an agent.

        * godmode/agentes/configurar_agente.php: Added fix module data
        feature.

        * godmode/modules/manage_network_components_form.php: Some fixes.

        * godmode/modules/manage_network_templates.php: More fixes.

        * godmode/menu.php: Fixed some navigation marks.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@436 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-04-21 16:14:11 +00:00
parent 7da2a5433e
commit 477c1324eb
14 changed files with 185 additions and 128 deletions

View File

@ -1,3 +1,40 @@
2007-04-21 Sancho Lerena <slerena@gmail.com>
* include/languages/language_en.php: New strings added.
* include/functions.php: Added function output_clean_strict().
* operation/agentes/estado_ultimopaquete.php: Fixed title when
some ugly characters used (like #).
* operation/agentes/estado_generalagente.php: OS icon show,
ignoring $agent_type parameter.
* operation/agentes/estado_agente.php: OS icon show, ignoring
agent_type variable.
* godmode/grupos/configurar_grupo.php: Now it's possible to define
parent group.
* godmode/grupos/lista_grupos.php: Parent for group and some code
cleanup. Added confirmation to group delete.
* godmode/agentes/module_manager.php: Added confirmation to some
items and added "data fix" new feature to delete data above 1.3 of
average value of graph.
* godmode/agentes/modificar_agente.php: Confirmation before delete
an agent.
* godmode/agentes/configurar_agente.php: Added fix module data
feature.
* godmode/modules/manage_network_components_form.php: Some fixes.
* godmode/modules/manage_network_templates.php: More fixes.
* godmode/menu.php: Fixed some navigation marks.
2007-04-19 Sancho Lerena <slerena@artica.es>
* pandora.css: added some classes for graphical input buttons.

View File

@ -175,6 +175,25 @@ if (isset($_POST["create_agent"])){
echo "<h3 class='suc'>".$lang_label["create_agent_ok"]."</h3>";
}
// Fix module data
// ===============
if (isset($_GET["fix_module"])){
$id_module = $_GET["fix_module"];
$id_agent = $_GET["id_agente"];
// get info about this module
$sql1 = "SELECT AVG(datos) FROM tagente_datos WHERE id_agente_modulo = $id_module AND id_agente = $id_agent";
$result=mysql_query($sql1);
if ($row=mysql_fetch_array($result)){
$media = $row[0];
$media = $media * 1.3;
$sql1 = "DELETE FROM tagente_datos WHERE datos > $media AND id_agente_modulo = $id_module AND id_agente = $id_agent";
$result=mysql_query($sql1);
echo "<h3 class='suc'>".$lang_label["delete_data_above"]." $media</h3>";
}
}
// Delete Alert
// =============
if (isset($_GET["delete_alert"])){ // if modified some parameter

View File

@ -183,13 +183,10 @@ if (mysql_num_rows($result)){
// Description
echo "<td class='$tdcolor'>".$row["comentarios"]."</td>";
// Action
echo "<td class='$tdcolor' align='center'>
<a href='index.php?sec=gagente&
sec2=godmode/agentes/modificar_agente&
borrar_agente=".$row["id_agente"]."'
onClick='if (!confirm(\' ".$lang_label["are_you_sure"]."\'))
return false;'>
<img border='0' src='images/cross.png'></a></td>";
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
borrar_agente=".$row["id_agente"]."'";
echo ' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
echo "<img border='0' src='images/cross.png'></a></td>";
}
}
echo "<tr><td colspan='5'><div class='raya'></div></td></tr>";
@ -197,16 +194,17 @@ if (mysql_num_rows($result)){
$endline = "</td></tr></table>";
} else {
$endline = "";
// If no data... let's show a beautiful button to create agent
// This is a piece of crap because we're duplicanting code above
// of this, don't do again.
echo "<div class='nf'>".$lang_label["no_agent_def"]."</div>";
}
echo $endline;
// Create agent button
echo "<table cellpadding='4' cellspacing='4' width='700'>";
echo "<tr><td align=right>";
echo "<form method='post' action='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&create_agent=1'>";
echo "<input type='submit' class='sub next' name='crt'
echo "<input type='submit' class='sub wand' name='crt'
value='".$lang_label["create_agent"]."'>";
echo "</form>";
echo $endline;
}
echo "</table>";
?>

View File

@ -171,7 +171,7 @@ echo "<h2>".$lang_label["agent_conf"]." &gt; ".$lang_label["assigned_modules"]."
echo "&nbsp;&nbsp;<a class='info' href='#module_assignment'> <span>".$lang_label["module_asociation_form"]."</span><img src='images/wand.png'></a>";
echo "</h2>";
if ($row=mysql_num_rows($result)){
echo '<table width="700" cellpadding="3" cellspacing="3" class="fon">';
echo '<table width="750" cellpadding="3" cellspacing="3" class="fon">';
echo '<tr>';
echo "<th>".$lang_label["module_name"];
echo "<th>".$lang_label["type"];
@ -179,7 +179,7 @@ if ($row=mysql_num_rows($result)){
echo "<th>".$lang_label["description"];
echo "<th>".$lang_label["module_group"];
echo "<th>".$lang_label["max_min"];
echo "<th width=50>".$lang_label["action"];
echo "<th width=65>".$lang_label["action"];
$color=1;$last_modulegroup = "0";
while ($row=mysql_fetch_array($result)){
if ($color == 1){
@ -223,20 +223,19 @@ if ($row=mysql_num_rows($result)){
}
echo $module_max." / ".$module_min;
echo "<td class='$tdcolor'>";
if ($id_tipo != -1)
echo "<a href='index.php?sec=gagente&
tab=module&
sec2=godmode/agentes/configurar_agente&
id_agente=".$id_agente."&
delete_module=".$row["id_agente_modulo"]."'>
<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'>
</b></a> &nbsp; ";
echo "<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&
id_agente=".$id_agente."&
tab=module&
update_module=".$row["id_agente_modulo"]."#modules'>
<img src='images/config.gif' border=0 alt='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
if ($id_tipo != -1){
echo "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&delete_module=".$row["id_agente_modulo"]."'".' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
echo "<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'>";
echo "</b></a>&nbsp;";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&update_module=".$row["id_agente_modulo"]."#modules'>";
echo "<img src='images/config.gif' border=0 alt='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
}
// Value arithmetical media fix
if (($id_tipo != 3) AND ($id_tipo != 10) AND ($id_tipo != 17)){
echo "&nbsp;";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&fix_module=".$row["id_agente_modulo"]."'".' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
echo "<img src='images/chart_curve.png' border=0></b></a>";
}
}
echo "<tr><td colspan='7'><div class='raya'></div></td></tr>";
echo "</table>";

View File

@ -30,7 +30,7 @@ if (comprueba_login() == 0)
// Inic vars
$id_grupo = "";
$nombre = "";
$id_parent = "";
if (isset($_GET["creacion_grupo"])){ //
$creacion_grupo = entrada_limpia($_GET["creacion_grupo"]);
@ -40,11 +40,12 @@ if (comprueba_login() == 0)
if (isset($_GET["id_grupo"])){
// Conecto con la BBDD
$id_grupo = entrada_limpia($_GET["id_grupo"]);
$sql1='SELECT nombre, icon FROM tgrupo WHERE id_grupo = '.$id_grupo;
$sql1='SELECT * FROM tgrupo WHERE id_grupo = '.$id_grupo;
$result=mysql_query($sql1);
if ($row=mysql_fetch_array($result)){
$nombre = $row["nombre"];
$icono = $row["icon"];
$id_parent = entrada_limpia($row["parent"]);
} else
{
echo "<h3 class='error'>".$lang_label["group_error"]."</h3>";
@ -72,7 +73,7 @@ sec2=godmode/grupos/lista_grupos">
echo "<input type='hidden' name='id_grupo' value='".$id_grupo."'>";
}
?>
<tr><td class='lb' rowspan='3' width='5'>
<tr><td class='lb' rowspan='4' width='5'>
<tr><td class="datos"><?php echo $lang_label["group_name"] ?></td>
<td class="datos">
<input type="text" name="nombre" size="35" value="<?php echo $nombre ?>">
@ -94,28 +95,37 @@ sec2=godmode/grupos/lista_grupos">
echo "<option>".substr($ficheros[$i],0,strlen($ficheros[$i])-4);
}
echo '</select>';
?>
// Parent
<tr><td colspan='3'><div class='raya'></div></td></tr>
<tr><td colspan="3" align="right">
<?php
if (isset($_GET["creacion_grupo"])){
echo "<input name='crtbutton' type='submit' class='sub'
value='".$lang_label["create"]."'>";
echo "<tr><td class='datos2'>";
echo $lang_label["parent"];
echo '<td class="datos2">';
echo '<select name="parent">';
if ($id_parent != ""){
echo "<option value=$id_parent>".dame_nombre_grupo($id_parent);
$sql1='SELECT * FROM tgrupo WHERE id_grupo != '.$id_grupo;
} else {
echo "<input name='uptbutton' type='submit' class='sub'
value='".$lang_label["update"]."'>";
$sql1='SELECT * FROM tgrupo';
}
?>
</form>
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
$nombre = $row["nombre"];
$id_grupo2 = $row["id_grupo"];
echo "<option value=$id_grupo2>" . $nombre;
}
echo '</select>';
</table>
echo "<tr><td colspan='3'><div class='raya'></div></td></tr>";
echo '<tr><td colspan="3" align="right">';
if (isset($_GET["creacion_grupo"]))
echo "<input name='crtbutton' type='submit' class='sub wand' value='".$lang_label["create"]."'>";
else
echo "<input name='uptbutton' type='submit' class='sub upd' value='".$lang_label["update"]."'>";
<?php
} // fin pagina
else {
echo "</form></table>";
} else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
"Trying to access Group Management2");
require ("general/noaccess.php");

View File

@ -31,8 +31,9 @@ if (comprueba_login() == 0)
if (isset($_POST["crear_grupo"])){ // Create group
$nombre = entrada_limpia($_POST["nombre"]);
$icon = entrada_limpia($_POST["icon"]);
$sql_insert="INSERT INTO tgrupo (nombre, icon)
VALUES ('".$nombre."', '".$icon."') ";
$parent = entrada_limpia($_POST["parent"]);
$sql_insert="INSERT INTO tgrupo (nombre, icon, parent)
VALUES ('$nombre', '$icon', '$parent') ";
$result=mysql_query($sql_insert);
if (! $result)
echo "<h3 class='error'>".$lang_label["create_group_no"]."</h3>";
@ -46,9 +47,10 @@ if (comprueba_login() == 0)
$nombre = entrada_limpia($_POST["nombre"]);
$id_grupo = entrada_limpia($_POST["id_grupo"]);
$icon = entrada_limpia($_POST["icon"]);
$parent = entrada_limpia($_POST["parent"]);
$sql_update ="UPDATE tgrupo
SET nombre = '".$nombre."', icon = '".$icon."'
WHERE id_grupo = '".$id_grupo."'";
SET nombre = '$nombre', icon = '$icon', parent = '$parent'
WHERE id_grupo = '$id_grupo'";
$result=mysql_query($sql_update);
if (! $result)
echo "<h3 class='error'>".$lang_label["modify_group_no"]."</h3>";
@ -92,30 +94,19 @@ if (comprueba_login() == 0)
$color = 1;
}
if ($row["id_grupo"] != 1){
echo "
<tr>
<td class='$tdcolor' align='center'>
<img src='images/groups_small/".$row["icon"].".png'
border='0'>
</td>
<td class='$tdcolor'>
<b><a href='index.php?sec=gagente&
sec2=godmode/grupos/configurar_grupo&
id_grupo=".$row["id_grupo"]."'>".$row["nombre"]."</a>
</b></td>
<td class='$tdcolor'>
".dame_nombre_grupo ($row["parent"])."
</td>
<td class='$tdcolor' align='center'>
<a href='index.php?sec=gagente&
sec2=godmode/grupos/lista_grupos&
id_grupo=".$row["id_grupo"]."&
borrar_grupo=".$row["id_grupo"]."'
onClick='if (!confirm(\' ".$lang_label["are_you_sure"]."\'))
return false;'>
<img border='0' src='images/cross.png'></a>
</td>
</tr>";
echo "<tr><td class='$tdcolor' align='center'>";
echo "<img src='images/groups_small/".$row["icon"].".png' border='0'>";
echo "</td>";
echo "<td class='$tdcolor'>";
echo "<b><a href='index.php?sec=gagente&sec2=godmode/grupos/configurar_grupo&id_grupo=".$row["id_grupo"]."'>".$row["nombre"]."</a>";
echo "</b></td>";
echo "<td class='$tdcolor'>";
echo dame_nombre_grupo ($row["parent"]);
echo "</td>";
echo "<td class='$tdcolor' align='center'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/grupos/lista_grupos&id_grupo=".$row["id_grupo"]."&borrar_grupo=".$row["id_grupo"]."'";
echo ' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
echo "<img border='0' src='images/cross.png'></a></td></tr>";
}
}
echo "<tr><td colspan='4'><div class='raya'></div></td></tr>";

View File

@ -85,7 +85,7 @@ if (comprueba_login() == 0){
}
// Network Profiles
if (isset($_GET["sec"]) && $_GET["sec"] == "gmodules"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/modules/manage_network_templates")
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/modules/manage_network_templates" || $_GET["sec2"] == "godmode/modules/manage_network_templates_form" ))
echo "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";

View File

@ -154,8 +154,8 @@ if (isset($_GET["update"])){ // Edit mode
$name = $row["name"];
$type = $row["type"];
$description = $row["description"];
$max = $row["max"];
$min = $row["min"];
$modulo_max = $row["max"];
$modulo_min = $row["min"];
$module_interval = $row["module_interval"];
$tcp_port = $row["tcp_port"];
$tcp_rcv = $row["tcp_rcv"];
@ -171,8 +171,8 @@ if (isset($_GET["update"])){ // Edit mode
$description = "";
$id_group = 1;
$oid = "";
$max = "0";
$min = "0";
$modulo_max = "0";
$modulo_min = "0";
$module_interval = "0";
$tcp_port = "";
$tcp_rcv = "";
@ -188,9 +188,9 @@ echo '<table width="700" cellspacing="4" cellpadding="4">';
// Different Form url if it's a create or if it's a update form
if ($id_nc != -1)
echo "<form name='modulo' method='post' action='http://pandora.localhost/index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&update=1&id_nc=$id_nc'>";
echo "<form name='modulo' method='post' action='index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&update=1&id_nc=$id_nc'>";
else
echo "<form name='modulo' method='post' action='http://pandora.localhost/index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create=1'>";
echo "<form name='modulo' method='post' action='index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create=1'>";
echo "<tr><td class='lb' rowspan='10' width='5'>";
echo "<tr>";

View File

@ -49,10 +49,10 @@ $sql1='SELECT * FROM tnetwork_profile ORDER BY name';
$result=mysql_query($sql1);
$color=0;
if (mysql_num_rows($result)) {
echo "<table cellpadding=4 cellspacing=4 width=550>";
echo "<table cellpadding=4 cellspacing=4 width=650>";
echo "<th>".$lang_label["name"]."</th>";
echo "<th>".$lang_label["description"]."</th>";
echo "<th>".$lang_label["number_of_modules"]."</th>";
echo "<th>".$lang_label["action"]."</th>";
}
while ($row=mysql_fetch_array($result)){
if ($color == 1){

View File

@ -72,6 +72,12 @@ function clean_output_breaks ($string){
}
function output_clean_strict ($string){
$string = preg_replace('/[\|\@\$\%\/\(\)\=\?\*\&\#]/','',$string);
return $string;
}
// ---------------------------------------------------------------
// This function reads a string and returns it "clean"
// for use in DB, againts string XSS and so on

View File

@ -765,6 +765,11 @@ $lang_label["custom_graphs"]="Custom graphs";
$lang_label["custom_reporting"]="Custom reporting";
$lang_label["alert_text"]="Alert text";
$lang_label["text"]="Text";
$lang_label["delete_data_above"]="Delete data above";
global $lang_label;
global $help_label;
?>

View File

@ -213,17 +213,10 @@ if (comprueba_login() == 0) {
echo "&nbsp;<a href='index.php?sec=estado&amp;
sec2=operation/agentes/ver_agente&amp;id_agente=".$id_agente."'>
<b>".$nombre_agente."</b></a></td>";
if ( $agent_type == 0) {
// Show SO icon :)
echo "<td class='$tdcolor' align='center'>
<img border=0 src='images/".dame_so_icon($id_os)."'
height=18 alt='".dame_so_name($id_os)."'></td>";
} elseif ($agent_type == 1) {
// Show network icon
echo "<td class='$tdcolor' align='center'>
<img border=0 src='images/network.gif' height=18
alt='Network Agent'></td>";
}
alt='".dame_so_name($id_os)."'></td>";
// If there are a module interval bigger than agent interval
if ($biginterval > $intervalo) {
echo "<td class='$tdcolor'>

View File

@ -92,18 +92,19 @@ if (comprueba_login() == 0) {
echo "</select>";
if ($agent_type == 0) {
//if ($agent_type == 0) {
echo '<tr>
<td class="datos"><b>'.$lang_label["os"].'</b></td>
<td class="datos" colspan=2>
<img src="images/'.dame_so_icon($id_os).'"> - '.dame_so_name($id_os);
if ($os_version != "")
echo ' '.salida_limpia($os_version);
/*
} elseif ($agent_type == 1) {
echo '<tr>
<td class="datos"><b>'.$lang_label["agent_type"].'</b></td>
<td class="datos" colspan=2><img src="images/network.gif">';
}
}*/
echo '</td>';
echo '</tr>';
echo '<tr>

View File

@ -165,15 +165,13 @@ if (comprueba_login() == 0) {
$myvalue = $row3["datos"];
echo format_for_graph($myvalue );
} else
echo substr($row["datos"],0,12);
echo substr($row3["datos"],0,12);
$handle = "stat".$nombre_tipo_modulo."_".$row3["id_agente_modulo"];
$url = 'reporting/procesos.php?agente='.$row3["id_agente_modulo"];
$win_handle=dechex(crc32($row3["id_agente_modulo"].$row3["nombre"]));
echo "<td class=".$tdcolor." width='78'>";
$graph_label = entrada_limpia($row3["nombre"]);
$graph_label = output_clean_strict ($row3["nombre"]);
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?period=2419200&id=".$row3["id_agente_modulo"]."&label=".$graph_label."refresh=180000\", \"month_".$win_handle."\")'><img src='images/grafica_m.gif' border=0></a>&nbsp;";