/usr/share/fusioninventory/lib/FusionInventory/Agent/Tools/Generic/License.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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | package FusionInventory::Agent::Tools::Generic::License;
use strict;
use warnings;
use base 'Exporter';
use English qw(-no_match_vars);
use Memoize;
use FusionInventory::Agent::Tools;
our @EXPORT = qw(
getAdobeLicenses
);
sub _parseAdobeSerial {
my ($raw) = @_;
# Thanks to Brandon Mulcahy
# http://www.a1vbcode.com/snippet-4796.asp
# http://blog.eka808.com/?p=251
my @subCipherKey = qw/
0000000001 5038647192 1456053789 2604371895
4753896210 8145962073 0319728564 7901235846
7901235846 0319728564 8145962073 4753896210
2604371895 1426053789 5038647192 3267408951
5038647192 2604371895 8145962073 7901235846
3267408951 1426053789 4753896210 0319728564/;
my $i = 0;
my $ret = "";
while ($raw =~ s/^(\d)//) {
$subCipherKey[$i++]=~ /^.{$1}(.)/;
$ret .= $1;
}
$ret =~ s/(\d{4})(\d{4})(\d{4})(\d{4})(\d{4})(\d{4})/$1-$2-$3-$4-$5/;
return $ret;
}
sub getAdobeLicenses {
my (%params) = (@_);
my $handle = getFileHandle(%params);
my @licenses;
my %data;
while (my $line = <$handle>) {
chomp($line);
my @f = split(/ <> /, $line);
next unless $f[3];
$f[1] =~ s/\{\|\}.*//;
$f[2] =~ s/\{\|\}.*//;
$f[3] =~ s/\{\|\}.*//;
if ($f[2] eq 'FLMap') {
push @{$data{$f[3]}{with}}, $f[1];
} elsif ($f[3] ne "unlicensed") {
$data{$f[1]}{$f[2]} = $f[3];
}
}
foreach my $key (keys %data) {
next unless $data{$key}{SN} || $data{$key}{with};
push @licenses, {
NAME => $key,
FULLNAME => $data{$key}{ALM_LicInfo_EpicAppName},
KEY => _parseAdobeSerial($data{$key}{SN}),
COMPONENTS => join('/', @{$data{$key}{with}})
}
}
return @licenses;
}
1;
__END__
=head1 NAME
FusionInventory::Agent::Tools::Generic::License - OS-independent license functions
=head1 DESCRIPTION
This module provides some OS-independent generic functions to access license
information.
=head1 FUNCTIONS
=head2 getAdobeLicenses
Returns a structured view of Adobe license.
|