You are not logged in.
Bonjour,
J'ai mis en place l'historisation des decryptages de password sur le plugin compte pour l'utilisation en interne de ce plugin.
Je vous transmet le code si qqs a besoin de cette fonctionnalité ou pour integration dans la prochaine release du plugin.
A chaque decryptage reussi un enregistrement contenant le libelle du mot de passe, le nom du user, et la date et heure est ajouté dans l'historisation. Cette Mise a jour s'effectue de facon transparente et les records d'historisation n'apparaissent dans l'historique que lors du rechargement de la page.
Creer un fichier hisoCompte.js dans le repertoire <ajax>
// ----------------------------------------------------------------------
// Original Author of file: Garret Stephane
// Purpose of file:
// ----------------------------------------------------------------------var xmlHttp
function callAjax(idcrypt,nameP) {
if (id.length==0) {
document.getElementByName("mdp2").innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null) {
alert ("Browser does not support HTTP Request")
return
}
var url="/glpi/plugins/compte/inc/plugin_compte.histo.php"
url=url+"?idcrypt="+idcrypt+"&nameP="+nameP
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}function stateChanged(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementByName("mdp2").innerHTML=xmlHttp.responseText
}
}function GetXmlHttpObject() {
var xmlHttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
Creer un fichier plugin_compte.histo.php dans le repertoire <inc>
<?php
/*
----------------------------------------------------------------------
GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2008 by the INDEPNET Development Team.http://indepnet.net/ http://glpi-project.org/
----------------------------------------------------------------------LICENSE
This file is part of GLPI.
GLPI 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.GLPI 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 GLPI; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------
*/// ----------------------------------------------------------------------
// Original Author of file: Garret Stephane
// Purpose of file:
// ----------------------------------------------------------------------if(!defined('GLPI_ROOT')){
define('GLPI_ROOT', '../../..');
include (GLPI_ROOT . "/inc/includes.php");
}global $DB,$CFG_GLPI, $LANG;
if(isset($_GET['idcrypt'])) {
//History log
$changes[0]='0';
$changes[1]= $_GET['nameP'];
$changes[2]= $LANG['plugin_compte'][36] ;
historyLog ($_GET['idcrypt'],PLUGIN_COMPTE_TYPE,$changes);
}
?>
Modifier le fichier plugin_compte.compte.class.php
Vers la ligne 329
echo "</td><td> <input type='button' name='decrypte' value='".$LANG['plugin_compte'][20]."' class='submit' onclick='var good_hash=\"$hash\";var hash=SHA256(SHA256(document.getElementById(\"aeskey\").value));
if(hash != good_hash) {
alert(\"".$LANG['plugin_compte'][22]."\");
return false;
};document.getElementsByName(\"mdp2\").item(0).value=AESDecryptCtr(document.getElementsByName(\"mdp\").item(0).value,SHA256(document.getElementById(\"aeskey\").value), 256);return false;'>";
Par
echo "<script src='/glpi/plugins/compte/ajax/histoCompte.js'></script>";
echo "</td><td> <input type='button' name='decrypte' value='".$LANG['plugin_compte'][20]."' class='submit' onclick='var good_hash=\"$hash\";var hash=SHA256(SHA256(document.getElementById(\"aeskey\").value));
if(hash != good_hash) {
alert(\"".$LANG['plugin_compte'][22]."\");
return false;
};document.getElementsByName(\"mdp2\").item(0).value=AESDecryptCtr(document.getElementsByName(\"mdp\").item(0).value,SHA256(document.getElementById(\"aeskey\").value), 256);var ret = callAjax(\"$ID\" , document.getElementsByName(\"name\").item(0).value);return false;'>";
Puis dans le fichier plugin_compte.display.function.php
vers la ligne 309
echo " <input type='button' name='decrypte' value='".$LANG['plugin_compte'][20]."' class='submit' onClick='var good_hash=\"$hash\";var hash=SHA256(SHA256(document.getElementById(\"aeskey\").value));
if(hash != good_hash) {
alert(\"".$LANG['plugin_compte'][22]."\");
return false;
};alert(AESDecryptCtr(\"".$data['mdp']."\",SHA256(document.getElementById(\"aeskey\").value), 256));return false;'>";
Par
echo "<script src='/glpi/plugins/compte/ajax/histoCompte.js'></script>";
echo " <input type='button' name='decrypte' value='".$LANG['plugin_compte'][20]."' class='submit' onClick='var good_hash=\"$hash\";var hash=SHA256(SHA256(document.getElementById(\"aeskey\").value));
if(hash != good_hash) {
alert(\"".$LANG['plugin_compte'][22]."\");
return false;
}; var ret =callAjax(".$data["ID"].",\"".$data["name"]."\");alert(AESDecryptCtr(\"".$data['mdp']."\",SHA256(document.getElementById(\"aeskey\").value), 256));return false;'>";
Ajouter dans les fichiers fr_FR, en_GB dans le repertoire <locales>
$LANG['plugin_compte'][36] = "Décrypté"; // pour fr_FR
$LANG['plugin_compte'][36] = "Uncrypted"; // pour en_GB
GLPI 0.7.2.4
CentOs 5
Offline
En voila une contribution bien sympatique
Ajouté a la prochaine version du plugin.
https://forge.indepnet.net/projects/roadmap/accounts
Merci à toi
Xavier Caillaud
Blog GLPI Infotel
Offline
Par contre sur IE8 ca ne marche pas..comme par hasard
Xavier Caillaud
Blog GLPI Infotel
Offline
Par contre sur IE8 ca ne marche pas..comme par hasard
t'as qu'à dire qu'il y a pas de support IE8 et zou
Offline
Poutant je l'utilise sur IE8 et Firefox 3.5.5 sans problème
GLPI 0.7.2.4
CentOs 5
Offline
apparemment ca viendrait du charset de php du serveur.
Xavier Caillaud
Blog GLPI Infotel
Offline
Tu peut essayer ca pour voir si ca modifie le comportement, il semblerai que innerHTML soit different en IE8 et cette fonctionnalité n'est pas utile dans ce cas.
je n'ai plus d'erreur sur la page en IE8
Modifier
var url="/glpi/plugins/compte/inc/plugin_compte.histo.php"
url=url+"?idcrypt="+idcrypt+"&nameP="+nameP
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}function stateChanged(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementByName("mdp2").innerHTML=xmlHttp.responseText
}
}
par
var url="/glpi/plugins/compte/inc/plugin_compte.histo.php"
url=url+"?idcrypt="+idcrypt+"&nameP="+nameP
// xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}// function stateChanged(){
// if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
// {
// document.getElementByName("mdp2").innerHTML=xmlHttp.responseText
// }
// }
GLPI 0.7.2.4
CentOs 5
Offline