line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::MacOS::License; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
65021822
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
71
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
74
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
384
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
126
|
|
7
|
1
|
|
|
1
|
|
376
|
use FusionInventory::Agent::Tools::License; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
529
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
11
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{licenseinfo}; |
12
|
0
|
|
|
|
|
|
return 1; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doInventory { |
16
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
19
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Adobe |
22
|
0
|
|
|
|
|
|
my @found = getAdobeLicenses( |
23
|
|
|
|
|
|
|
command => 'sqlite3 -separator " <> " "/Library/Application Support/Adobe/Adobe PCD/cache/cache.db" "SELECT * FROM domain_data"' |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Transmit |
27
|
0
|
|
|
|
|
|
my @transmitFiles = glob('/System/Library/User Template/*.lproj/Library/Preferences/com.panic.Transmit.plist'); |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ($params{scan_homedirs}) { |
30
|
0
|
|
|
|
|
|
push @transmitFiles, glob('/Users/*/Library/Preferences/com.panic.Transmit.plist'); |
31
|
|
|
|
|
|
|
} else { |
32
|
0
|
|
|
|
|
|
$logger->warning( |
33
|
|
|
|
|
|
|
"'scan-homedirs' configuration parameters disabled, " . |
34
|
|
|
|
|
|
|
"ignoring transmit installations in user directories" |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
foreach my $transmitFile (@transmitFiles) { |
39
|
0
|
|
|
|
|
|
my $info = _getTransmitLicenses( |
40
|
|
|
|
|
|
|
command => "plutil -convert xml1 -o - '$transmitFile'" |
41
|
|
|
|
|
|
|
); |
42
|
0
|
0
|
|
|
|
|
next unless $info; |
43
|
0
|
|
|
|
|
|
push @found, $info; |
44
|
0
|
|
|
|
|
|
last; # One installation per machine |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# VMware |
48
|
0
|
|
|
|
|
|
my @vmwareFiles = glob('/Library/Application Support/VMware Fusion/license-*'); |
49
|
0
|
|
|
|
|
|
foreach my $vmwareFile (@vmwareFiles) { |
50
|
0
|
|
|
|
|
|
my %info; |
51
|
|
|
|
|
|
|
# e.g: |
52
|
|
|
|
|
|
|
# LicenseType = "Site" |
53
|
0
|
|
|
|
|
|
my $handle = getFileHandle(file => $vmwareFile); |
54
|
0
|
|
|
|
|
|
foreach (<$handle>) { |
55
|
0
|
0
|
|
|
|
|
next unless /^(\S+)\s=\s"(.*)"/; |
56
|
0
|
|
|
|
|
|
$info{$1} = $2; |
57
|
|
|
|
|
|
|
} |
58
|
0
|
0
|
|
|
|
|
next unless $info{Serial}; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my $date; |
61
|
0
|
0
|
|
|
|
|
if ($info{LastModified} =~ /(^2\d{3})-(\d{1,2})-(\d{1,2}) @ (\d{1,2}):(\d{1,2})/) { |
62
|
0
|
|
|
|
|
|
$date = getFormatedDate($1, $2, $3, $4, $5, 0); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
push @found, { |
66
|
|
|
|
|
|
|
NAME => $info{ProductID}, |
67
|
|
|
|
|
|
|
FULLNAME => $info{ProductID}." (".$info{LicenseVersion}.")", |
68
|
|
|
|
|
|
|
KEY => $info{Serial}, |
69
|
|
|
|
|
|
|
ACTIVATION_DATE => $date |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
foreach my $license (@found) { |
74
|
0
|
|
|
|
|
|
$inventory->addEntry(section => 'LICENSEINFOS', entry => $license); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _getTransmitLicenses { |
79
|
0
|
|
|
0
|
|
|
my (%params) = @_; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my %val; |
84
|
|
|
|
|
|
|
my $in; |
85
|
0
|
|
|
|
|
|
foreach my $line (<$handle>) { |
86
|
0
|
0
|
|
|
|
|
if ($in) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
$val{$in} = $1 if $line =~ /([\d\w\.-]+)<\/string>/; |
88
|
0
|
|
|
|
|
|
$in = undef; |
89
|
|
|
|
|
|
|
} elsif ($line =~ /SerialNumber2/) { |
90
|
0
|
|
|
|
|
|
$in = "KEY"; |
91
|
|
|
|
|
|
|
} elsif ($line =~ /PreferencesVersion<\/key>/) { |
92
|
0
|
|
|
|
|
|
$in = "VERSION"; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
return unless $val{KEY}; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
return { |
99
|
0
|
|
|
|
|
|
NAME => "Transmit", |
100
|
|
|
|
|
|
|
FULLNAME => "Panic's Transmit", |
101
|
|
|
|
|
|
|
KEY => $val{KEY} |
102
|
|
|
|
|
|
|
}; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |