From f13cda5727fbaa0bc1171e97d4c9b9ec82f221b2 Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Tue, 2 Jul 2024 10:50:56 +0200 Subject: [PATCH] fix: Fix Cortex XDR version and base version detection --- lib/GLPI/Agent/Task/Inventory/Win32/AntiVirus.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/GLPI/Agent/Task/Inventory/Win32/AntiVirus.pm b/lib/GLPI/Agent/Task/Inventory/Win32/AntiVirus.pm index c1fb4a931..723ec9bb5 100644 --- a/lib/GLPI/Agent/Task/Inventory/Win32/AntiVirus.pm +++ b/lib/GLPI/Agent/Task/Inventory/Win32/AntiVirus.pm @@ -154,7 +154,7 @@ sub doInventory { unless ($found_enabled) { # AV must be set as a service - my $services = getServices(logger => $logger); + my $services = getServices(logger => $logger); foreach my $support ({ # Cortex XDR support @@ -167,7 +167,7 @@ sub doInventory { my $service = $services->{$support->{service}} or next; - $antivirus->{NAME} = $service->{NAME} || $support->{name}; + $antivirus->{NAME} = $support->{name} || $service->{NAME}; $antivirus->{ENABLED} = $service->{STATUS} =~ /running/i ? 1 : 0; if (my $cmd = $support->{command}) { @@ -532,15 +532,15 @@ sub _setCortexInfos { $antivirus->{COMPANY} = "Palo Alto Networks"; my $version = getFirstMatch( - command => "$command info", - pattern => /^Cortex XDR .* ([0-9.]+)$/, + command => "\"$command\" info", + pattern => qr/^Cortex XDR .* ([0-9.]+)$/, logger => $logger ); $antivirus->{VERSION} = $version if $version; my $base_version = getFirstMatch( - command => "$command info query", - pattern => /^Content Version:\s+(\S+)$/i, + command => "\"$command\" info query", + pattern => qr/^Content Version:\s+(\S+)$/i, logger => $logger ); $antivirus->{BASE_VERSION} = $base_version if $base_version;