From bd0bc6852dece7cbf8b1e6493795785a18a86603 Mon Sep 17 00:00:00 2001 From: Daniel <git@myrandor.com> Date: Thu, 16 Mar 2023 14:47:32 -0400 Subject: [PATCH] Force mac address update during status update scan --- app/subnets/scan/subnet-scan-execute-update-snmp-arp.php | 4 ++-- functions/classes/class.Scan.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php b/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php index cebeb6fb..a22a8af1 100644 --- a/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php +++ b/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php @@ -71,8 +71,8 @@ if (sizeof($all_subnet_hosts)>0) { // add to alive $result[$Subnets->transform_address($r['ip'], "decimal")]['code'] = 0; $result[$Subnets->transform_address($r['ip'], "decimal")]['status'] = "Online"; - // update alive time - @$Scan->ping_update_lastseen($result[$Subnets->transform_address($r['ip'], "decimal")]['id']); + // update alive time and mac address + @$Scan->ping_update_lastseen($result[$Subnets->transform_address($r['ip'], "decimal")]['id'], $r['mac']); } } } diff --git a/functions/classes/class.Scan.php b/functions/classes/class.Scan.php index 29b83570..aecf0263 100644 --- a/functions/classes/class.Scan.php +++ b/functions/classes/class.Scan.php @@ -587,11 +587,11 @@ class Scan extends Common_functions { * @param datetime $datetime * @return void */ - public function ping_update_lastseen ($id, $datetime = null) { + public function ping_update_lastseen ($id, $mac = null, $datetime = null) { # set datetime $datetime = is_null($datetime) ? date("Y-m-d H:i:s") : $datetime; # execute - try { $this->Database->updateObject("ipaddresses", array("id"=>$id, "lastSeen"=>$datetime), "id"); } + try { $this->Database->updateObject("ipaddresses", array("id"=>$id, "mac"=>$mac, "lastSeen"=>$datetime), "id"); } catch (Exception $e) { !$this->debugging ? : $this->Result->show("danger", $e->getMessage(), false); # log -- GitLab