Skip to content

Commit

Permalink
fix: Fix Cortex XDR version and base version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Jul 2, 2024
1 parent e94da76 commit f13cda5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/GLPI/Agent/Task/Inventory/Win32/AntiVirus.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f13cda5

Please sign in to comment.