line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::MacOS::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
84173268
|
use strict; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
78
|
|
4
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
99
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
693
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
423
|
|
7
|
2
|
|
|
2
|
|
1170
|
use FusionInventory::Agent::Tools::MacOS; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
732
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
return |
13
|
|
|
|
|
|
|
!$params{no_category}->{software} && |
14
|
0
|
|
0
|
|
|
0
|
canRun('/usr/sbin/system_profiler'); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub doInventory { |
18
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
my $softwares = _getSoftwaresList(logger => $params{logger}); |
23
|
0
|
0
|
|
|
|
0
|
return unless $softwares; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
foreach my $software (@$softwares) { |
26
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
27
|
|
|
|
|
|
|
section => 'SOFTWARES', |
28
|
|
|
|
|
|
|
entry => $software |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _getSoftwaresList { |
34
|
1
|
|
|
1
|
|
36
|
my $infos = getSystemProfilerInfos( |
35
|
|
|
|
|
|
|
type => 'SPApplicationsDataType', |
36
|
|
|
|
|
|
|
@_ |
37
|
|
|
|
|
|
|
); |
38
|
1
|
|
|
|
|
16
|
my $info = $infos->{Applications}; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
2
|
my @softwares; |
41
|
1
|
|
|
|
|
78
|
foreach my $name (keys %$info) { |
42
|
491
|
|
|
|
|
677
|
my $app = $info->{$name}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Windows application found by Parallels (issue #716) |
45
|
|
|
|
|
|
|
next if |
46
|
|
|
|
|
|
|
$app->{'Get Info String'} && |
47
|
491
|
100
|
100
|
|
|
2021
|
$app->{'Get Info String'} =~ /^\S+, [A-Z]:\\/; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
push @softwares, { |
50
|
|
|
|
|
|
|
NAME => $name, |
51
|
|
|
|
|
|
|
VERSION => $app->{'Version'}, |
52
|
|
|
|
|
|
|
COMMENTS => $app->{'Kind'} ? '[' . $app->{'Kind'} . ']' : undef, |
53
|
407
|
100
|
|
|
|
2153
|
PUBLISHER => $app->{'Get Info String'}, |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
29
|
return \@softwares; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |