/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Win32/AntiVirus.pm is in fusioninventory-agent 1:2.3.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | package FusionInventory::Agent::Task::Inventory::Win32::AntiVirus;
use strict;
use warnings;
use FusionInventory::Agent::Tools::Win32;
my $seen;
sub isEnabled {
return 1;
}
sub doInventory {
my (%params) = @_;
my $inventory = $params{inventory};
# Doesn't works on Win2003 Server
# On Win7, we need to use SecurityCenter2
foreach my $instance (qw/SecurityCenter SecurityCenter2/) {
my $moniker = "winmgmts:{impersonationLevel=impersonate,(security)}!//./root/$instance";
foreach my $object (getWMIObjects(
moniker => $moniker,
class => "AntiVirusProduct",
properties => [ qw/
companyName displayName instanceGuid onAccessScanningEnabled
productUptoDate versionNumber productState
/ ]
)) {
next unless $object;
my $antivirus = {
COMPANY => $object->{companyName},
NAME => $object->{displayName},
GUID => $object->{instanceGuid},
VERSION => $object->{versionNumber},
ENABLED => $object->{onAccessScanningEnabled},
UPTODATE => $object->{productUptoDate}
};
if ($object->{productState}) {
my $bin = sprintf( "%b\n", $object->{productState});
# http://blogs.msdn.com/b/alejacma/archive/2008/05/12/how-to-get-antivirus-information-with-wmi-vbscript.aspx?PageIndex=2#comments
if ($bin =~ /(\d)\d{5}(\d)\d{6}(\d)\d{5}$/) {
$antivirus->{UPTODATE} = $1 || $2;
$antivirus->{ENABLED} = $3 ? 0 : 1;
}
}
# avoid duplicates
next if $seen->{$antivirus->{NAME}}->{$antivirus->{VERSION}||'_undef_'}++;
$inventory->addEntry(
section => 'ANTIVIRUS',
entry => $antivirus
);
}
}
}
1;
|