Skip to content

Commit

Permalink
decode Adobe S/N
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonéri Le Bouder committed Oct 25, 2012
1 parent 987ba7d commit 391306f
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion lib/FusionInventory/Agent/Tools/Generic/License.pm
Expand Up @@ -13,6 +13,33 @@ 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 $final = "";
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) = (@_);

Expand Down Expand Up @@ -45,7 +72,7 @@ sub getAdobeLicenses {
push @licenses, {
NAME => $key,
FULLNAME => $data{$key}{ALM_LicInfo_EpicAppName},
KEY => $data{$key}{SN},
KEY => _parseAdobeSerial($data{$key}{SN}),
COMPONENTS => join('/', @{$data{$key}{with}})
}
}
Expand Down

0 comments on commit 391306f

Please sign in to comment.