This commit is contained in:
jbousquie 2016-11-29 14:57:33 +01:00
parent 8134808e59
commit 8d4a51680f
2 changed files with 30 additions and 33 deletions

28
admin/scripts_clients.php Normal file
View File

@ -0,0 +1,28 @@
<?php
include_once('winlog_admin_conf.php');
include_once('session.php');
$username = Username();
$profil = Profil($username);
FiltreProfil($profil);
if ($profil < 2) {
header('Location: '.$winlog_url);
}
?>
<!DOCTYPE HTML>
<html lang="fr">
<head>
<title>Winlog</title>
<meta charset="utf-8">
<link rel="stylesheet" media="screen" type="text/css" title="default" href="default.css">
</head>
<body>
<p class="header">WINLOG</p>
<div><a href="generate_vbs.php?f=logon">logon.vbs</a></div>
<div><a href="generate_vbs.php?f=logout">logout.vbs</a></div>
<div><a href="generate_vbs.php?f=matos">matos.vbs</a></div>
</body>
</html>

View File

@ -2,37 +2,8 @@ On error resume next
'audit des déconnexions active directory
'on émet un POST HTTP, sans passer par le proxy, sur le serveur de log des connexions
Dim o, n, data, secopt, strComputer, objWMIService, colItems, objItem
Dim manufacturer, model, systemType, mac, ip, description, ipItem
Dim o, n, data
Set o = CreateObject("WinHttp.WinHttpRequest.5.1")
strComputer = "localhost"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
' collecte marque, modele, arch
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objItem in colItems
manufacturer = trim(objItem.Manufacturer)
model = trim(objItem.Model)
systemType = trim(objItem.SystemType)
next
' collecte mac address
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration")
mac = "["
ip = "["
description = "["
For Each objItem in colItems
if Not IsNull(objItem.IPAddress) then
For Each ipItem in objItem.IPAddress
mac = mac & chr(34) & objItem.MACAddress & chr(34) & ","
ip = ip & chr(34) & ipItem & chr(34) & ","
description = description & chr(34) & objItem.Description & chr(34) & ","
next
end if
next
mac = mac & "]"
ip = ip & "]"
description = description & "]"
' emission requête
Set n = CreateObject("wscript.network")
@ -40,8 +11,6 @@ o.setproxy 1
o.Option(4) = 13056 'pour forcer à ignorer toutes les erreurs de certificats
o.open "POST", "https://winlog.iut.local/", False
o.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
data = "code=HK9!-uu&action=D&username=" & LCase(n.Username) & "&computer=" & n.ComputerName
data = data & "&manufacturer=" & manufacturer & "&model=" & model & "&systemType=" & systemType
data = data & "&mac=" & mac & "&ip=" & ip & "&descr=" & description
data = "code=#####&action=D&username=" & LCase(n.Username) & "&computer=" & n.ComputerName
o.send data