ajout fichiers
This commit is contained in:
parent
6e5cf004e7
commit
cfe3507e9c
11
admin/scripts_distants/windows_server/code.php
Normal file
11
admin/scripts_distants/windows_server/code.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
// ce script sert à chiffrer le mot de passe administrateur du domaine
|
||||
include('lib.php');
|
||||
$Cle = "maSuperCle";
|
||||
$MonTexte = "mot de passe admin";
|
||||
$TexteCrypte = Crypte($MonTexte,$Cle);
|
||||
$TexteClair = Decrypte($TexteCrypte,$Cle);
|
||||
echo "Texte original : $MonTexte <Br>";
|
||||
echo "Texte crypté : $TexteCrypte <Br>";
|
||||
echo "Texte décrypté : $TexteClair <Br>";
|
||||
?>
|
55
admin/scripts_distants/windows_server/lib.php
Normal file
55
admin/scripts_distants/windows_server/lib.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
// Variables
|
||||
// =========
|
||||
$cle = "maSuperCle";
|
||||
$mdp = "Am7KM1NgUnOOZ1hhjGBMMgBnBzNUYA==";
|
||||
|
||||
|
||||
// Fonctions
|
||||
// =========
|
||||
|
||||
function GenerationCle($Texte,$CleDEncryptage)
|
||||
{
|
||||
$CleDEncryptage = md5($CleDEncryptage);
|
||||
$Compteur=0;
|
||||
$VariableTemp = "";
|
||||
for ($Ctr=0;$Ctr<strlen($Texte);$Ctr++)
|
||||
{
|
||||
if ($Compteur==strlen($CleDEncryptage))
|
||||
$Compteur=0;
|
||||
$VariableTemp.= substr($Texte,$Ctr,1) ^ substr($CleDEncryptage,$Compteur,1);
|
||||
$Compteur++;
|
||||
}
|
||||
return $VariableTemp;
|
||||
}
|
||||
|
||||
function Crypte($Texte,$Cle)
|
||||
{
|
||||
srand((double)microtime()*1000000);
|
||||
$CleDEncryptage = md5(rand(0,32000) );
|
||||
$Compteur=0;
|
||||
$VariableTemp = "";
|
||||
for ($Ctr=0;$Ctr<strlen($Texte);$Ctr++)
|
||||
{
|
||||
if ($Compteur==strlen($CleDEncryptage))
|
||||
$Compteur=0;
|
||||
$VariableTemp.= substr($CleDEncryptage,$Compteur,1).(substr($Texte,$Ctr,1) ^ substr($CleDEncryptage,$Compteur,1) );
|
||||
$Compteur++;
|
||||
}
|
||||
return base64_encode(GenerationCle($VariableTemp,$Cle) );
|
||||
}
|
||||
|
||||
function Decrypte($Texte,$Cle)
|
||||
{
|
||||
$Texte = GenerationCle(base64_decode($Texte),$Cle);
|
||||
$VariableTemp = "";
|
||||
for ($Ctr=0;$Ctr<strlen($Texte);$Ctr++)
|
||||
{
|
||||
$md5 = substr($Texte,$Ctr,1);
|
||||
$Ctr++;
|
||||
$VariableTemp.= (substr($Texte,$Ctr,1) ^ $md5);
|
||||
}
|
||||
return $VariableTemp;
|
||||
}
|
||||
?>
|
21
admin/scripts_distants/windows_server/task.php
Normal file
21
admin/scripts_distants/windows_server/task.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// Ce script renvoie au format json la liste des tâches en cours sur une machine $host
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
include('lib.php');
|
||||
$hote = $_GET['host'];
|
||||
// Récupérer sur un POST, récupérer en https
|
||||
// ajouter une clé partagée à tester
|
||||
//$command = "tasklist /fo csv /nh /v /u IUT\Administrateur /p ".Decrypte($mdp, $cle)." /s ".$hote." | findstr IUT | sort";
|
||||
$command = "tasklist /fo csv /nh /v /u IUT\Administrateur /p ".Decrypte($mdp, $cle)." /s ".$hote." | sort";
|
||||
//$command = 'task.bat "'.Decrypte($mdp, $cle).'" '.$hote;
|
||||
$res = array();
|
||||
$tab_task = array();
|
||||
$i = 0;
|
||||
exec($command, $res);
|
||||
foreach($res as $li) {
|
||||
$tab_task[$i] = utf8_encode($li);
|
||||
$i++;
|
||||
}
|
||||
$tasks = json_encode($tab_task);
|
||||
echo $tasks;
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user