DTux
/
dtux__moha
Archived
1
0
Fork 0

new script presence.php\ndebug

This commit is contained in:
Daniel Tartavel 2022-08-28 23:44:21 +02:00
parent b5c30b1ae4
commit 2b4fc54071
4 changed files with 38 additions and 6 deletions

View File

@ -507,7 +507,7 @@ function PropertiesDashboard($argList)
$response .= '<input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $propertyObject["name"] . '" value="' . _("Update") . "\" onmouseup=\"getPropertyValue('" . $device->topic . "','" . $device->friendlyName . "','" . $propertyObject["name"] . "')\">";
}else
{
$response .= $value;
$response .= bool2string($value);
}
$response .= EOLH;
}else

View File

@ -0,0 +1,6 @@
<?php
macAdressses = array(
"Daniel" => "84:CF:BF:8E:E6:A6"
);
?>

View File

@ -43,26 +43,34 @@ class alerte_intrusion extends hook
}
}
public function testPortes($send=true, $opened=true) :array
public function testPortes($deviceList=false, $send=true, $opened=true) :array
{
global $indexDevices;
$portes = array();
logger(DEBUG, _("Function alerte_intrusion->testPorte"), __FILE__ . ":" . __LINE__);
if ($deviceList === false) $deviceList = $this->deviceList;
$msg = "";
foreach ($this->devicelist as $device => $property)
foreach ($deviceList as $device => $property)
{
if (!$opened)
//echo "device: " . $device . "\n";
//echo "opened = " . bool2string($opened);
//echo " value = " . var_dump($indexDevices[$device]->properties[$property]);
if ($opened)
{
if($indexDevices[$device]->properties[$property] == false)
if($indexDevices[$device]->properties[$property]["value"] === false)
{
//echo "porte opened";
$portes[] = $indexDevices[$device]->friendlyName;
$msg .= $indexDevices[$device]->friendlyName . "\n";
}
}else
{
if($indexDevices[$device]->properties[$property] == true)
if($indexDevices[$device]->properties[$property]["value"] === true)
{
//echo "porte closed";
$portes[] = $indexDevices[$device]->friendlyName;
$msg .= $indexDevices[$device]->friendlyName . "\n";
}

18
presence.php Normal file
View File

@ -0,0 +1,18 @@
<?php require "config/liste_telephones.php";
function presence()
{
$result = array();
$command = "sudo nmap -n -sP 192.168.1.*";
exec($command, $result);
var_dump($result);
foreach ($macAddresses as $name =>$value)
{
$key = array_search($value, $result);
}
}
presence();
?>