Skip to content

Commit

Permalink
Added license files
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown6656 committed Jul 26, 2020
1 parent fb3e3b3 commit 991c8fa
Show file tree
Hide file tree
Showing 12 changed files with 380 additions and 13 deletions.
53 changes: 44 additions & 9 deletions unlocker/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.IO;
using System;

namespace unlocker
{
using Properties;

public static class Program
{
public static readonly string[] OSSPP_PATHS =
{
//@"%ProgramFiles%\Microsoft Office\Office15\ospp.vbs",
//@"%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs",
@"%ProgramFiles%\Microsoft Office\Office15\ospp.vbs",
@"%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs",
@"%ProgramFiles%\Microsoft Office\Office16\ospp.vbs",
@"%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs",
};
Expand All @@ -27,6 +31,19 @@ public static class Program
"BTDRB",
"CPQVG"
};
public static readonly Dictionary<string, byte[]> LICENSES = new Dictionary<string, byte[]>
{
["ProPlusVL_KMS_Client-ppd.xrm-ms"] = Resources.ProPlusVL_KMS_Client_ppd,
["ProPlusVL_KMS_Client-ul.xrm-ms"] = Resources.ProPlusVL_KMS_Client_ul,
["ProPlusVL_MAK-ppd.xrm-ms"] = Resources.ProPlusVL_MAK_ppd,
["ProPlusVL_MAK-ul-phn.xrm-ms"] = Resources.ProPlusVL_MAK_ul_phn,
["ProPlusVL_KMS_Client-ul-oob.xrm-ms"] = Resources.ProPlusVL_KMS_Client_ul_oob,
["ProPlusVL_MAK-pl.xrm-ms"] = Resources.ProPlusVL_MAK_pl,
["ProPlusVL_MAK-ul-oob.xrm-ms"] = Resources.ProPlusVL_MAK_ul_oob,
};

public static readonly Regex REGEX_PROPLUSVL = new Regex(@"^proplusvl_(kms|mak).*\.xrm-ms$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static readonly Regex REGEX_LICDIR = new Regex(@"Licenses\d+", RegexOptions.Compiled | RegexOptions.IgnoreCase);

public static void Main()
{
Expand Down Expand Up @@ -112,7 +129,7 @@ Tuple<int, string> exec_ospp(string args)
stdout = Regex.Replace(stdout, @"^---[^\n\r]*---$", "", RegexOptions.Multiline).Replace("\n\n", "\n").Trim();

Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine($"Excuting 'cscript {proc.StartInfo.Arguments}' ...");
Console.WriteLine($"Excuting '%windir%\\system32\\cscript {proc.StartInfo.Arguments}' ...");

if (!string.IsNullOrWhiteSpace(stdout))
{
Expand All @@ -129,13 +146,31 @@ Tuple<int, string> exec_ospp(string args)
return new Tuple<int, string>(proc.ExitCode, stdout);
}
}
DirectoryInfo licencedir = new DirectoryInfo($"{ospp.Directory.FullName}/../root/Licenses16");
DirectoryInfo licensedir = new DirectoryInfo($"{ospp.Directory.FullName}/../root");

if (!licensedir.Exists)
licensedir.Create();

licensedir = licensedir.EnumerateDirectories().FirstOrDefault(dir => REGEX_LICDIR.IsMatch(dir.Name)) ?? licensedir.CreateSubdirectory("Licenses16");

foreach (string licence in LICENSES.Keys)
{
string licpath = Path.Combine(licensedir.FullName, licence);

if (!File.Exists(licpath))
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine($"Generating license file '{licpath}' from internal storage ...");

File.WriteAllBytes(licpath, LICENSES[licence]);

Console.WriteLine($"Written license file '{licpath}' from internal storage ({LICENSES[licence].Length} Bytes).");
}
}

if (licencedir.Exists)
foreach (FileInfo licence in licencedir.GetFiles())
if (Regex.IsMatch(licence.Name, @"^proplusvl_(kms|mak).*\.xrm-ms$", RegexOptions.Compiled | RegexOptions.IgnoreCase))
exec_ospp($"/inslic:\"{licence.FullName}\"");
// else : error
foreach (FileInfo licence in licensedir.GetFiles())
if (REGEX_PROPLUSVL.IsMatch(licence.Name))
exec_ospp($"/inslic:\"{licence.FullName}\"");

Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("Activating Microsoft Office ...");
Expand Down
1 change: 1 addition & 0 deletions unlocker/Properties/ProPlusVL_KMS_Client-ppd.xrm-ms
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" licenseId="{d1b5a795-88e9-4684-1982-918eb23bb14e}" xmlns:sx="urn:mpeg:mpeg21:2003:01-REL-SX-NS" xmlns:mx="urn:mpeg:mpeg21:2003:01-REL-MX-NS" xmlns:sl="http://www.microsoft.com/DRM/XrML2/SL/v2" xmlns:tm="http://www.microsoft.com/DRM/XrML2/TM/v2"><r:title>OfficeD450596F-894D-49E0-966A-FD39ED4C4C64 PPD License</r:title><r:grant><sl:appId><sl:guid>{0ff1ce15-a989-479d-af46-f275c6370663}</sl:guid></sl:appId><r:possessProperty/><tm:application xmlns:tm="http://www.microsoft.com/DRM/XrML2/TM/v2"><editionId xmlns="http://www.microsoft.com/DRM/XrML2/TM/v2" value="Office16ProPlusVL_KMS_Client"></editionId></tm:application><r:allConditions><sl:productPolicies xmlns:sl="http://www.microsoft.com/DRM/XrML2/SL/v2"><sl:priority>200</sl:priority><sl:policyInt name="office-E34AA7C4-8845-4BD7-BAC6-26554B60823B">1</sl:policyInt><sl:policyInt name="office-E34AA7C4-8845-4BD7-BAC6-16554B60823B">1</sl:policyInt><sl:policyInt name="office-27C919A6-3FA5-47F9-A3EC-BC7FF2AAD452">1</sl:policyInt><sl:policyInt name="office-27C919A6-3FA5-47F9-A3EC-1C7FF2AAD452">1</sl:policyInt><sl:policyInt name="office-D0AAD61F-53A1-4A02-8951-2710034FB948">1</sl:policyInt><sl:policyInt name="office-D0AAD61F-53A1-4A02-8951-1710034FB948">1</sl:policyInt><sl:policyInt name="office-C845E028-E091-442E-8202-21F596C559A0">1</sl:policyInt><sl:policyInt name="office-C845E028-E091-442E-8202-11F596C559A0">1</sl:policyInt><sl:policyInt name="office-C4ACE6DB-AA99-401F-8BE6-8784BD09F003">1</sl:policyInt><sl:policyInt name="office-C4ACE6DB-AA99-401F-8BE6-1784BD09F003">1</sl:policyInt><sl:policyInt name="office-C70B7A8B-6AE1-4B36-A93D-5EFD36C6FB03">1</sl:policyInt><sl:policyInt name="office-C70B7A8B-6AE1-4B36-A93D-1EFD36C6FB03">1</sl:policyInt><sl:policyInt name="office-E1AFBCD9-12F0-4FC0-9177-BFD3148AEC74">1</sl:policyInt><sl:policyInt name="office-E1AFBCD9-12F0-4FC0-9177-1FD3148AEC74">1</sl:policyInt><sl:policyInt name="office-3CFF5AB2-9B16-4A31-BC3F-FAD761D92780">1</sl:policyInt><sl:policyInt name="office-3CFF5AB2-9B16-4A31-BC3F-1AD761D92780">1</sl:policyInt><sl:policyInt name="office-B7722051-1934-460D-90E7-E07193E4B622">1</sl:policyInt><sl:policyInt name="office-B7722051-1934-460D-90E7-107193E4B622">1</sl:policyInt><sl:policyInt name="office-2A8FA8D7-B728-4792-AC02-463FD7A423BD">1</sl:policyInt><sl:policyInt name="office-2A8FA8D7-B728-4792-AC02-163FD7A423BD">1</sl:policyInt><sl:policyInt name="office-8265A5EF-46C7-4D46-812C-076F2A28F7CB">1</sl:policyInt><sl:policyInt name="office-8265A5EF-46C7-4D46-812C-176F2A28F7CB">1</sl:policyInt><sl:policyInt name="office-6C3DC9F9-B616-4849-8F45-F02439482948">1</sl:policyInt><sl:policyInt name="office-6C3DC9F9-B616-4849-8F45-102439482948">1</sl:policyInt><sl:policyInt name="office-2C6C511D-4542-4E0C-95D0-05D4406032F2">1</sl:policyInt><sl:policyInt name="office-2C6C511D-4542-4E0C-95D0-15D4406032F2">1</sl:policyInt><sl:policyInt name="office-7C6D92EF-7B45-46E5-8670-819663220E4E">1</sl:policyInt><sl:policyInt name="office-7C6D92EF-7B45-46E5-8670-119663220E4E">1</sl:policyInt><sl:policyInt name="office-F5B3D9A2-91E8-4026-ABE8-D45EEE7DDA78">1</sl:policyInt><sl:policyInt name="office-F5B3D9A2-91E8-4026-ABE8-145EEE7DDA78">1</sl:policyInt><sl:policyInt name="office-9E73CEA4-29D0-4D16-8FB9-5AB17387C960">1</sl:policyInt><sl:policyInt name="office-9E73CEA4-29D0-4D16-8FB9-1AB17387C960">1</sl:policyInt><sl:policyInt name="office-E0A76492-0FD5-4EC2-8570-AE1BAA61DC88">1</sl:policyInt><sl:policyInt name="office-E0A76492-0FD5-4EC2-8570-1E1BAA61DC88">1</sl:policyInt><sl:policyInt name="office-1D5FBFAF-C178-4059-A8E4-839096B57102">1</sl:policyInt><sl:policyInt name="office-1D5FBFAF-C178-4059-A8E4-139096B57102">1</sl:policyInt><sl:policyInt name="office-81DD86EC-5F1C-4DDE-9211-98AF184EAD47">1</sl:policyInt><sl:policyInt name="office-81DD86EC-5F1C-4DDE-9211-18AF184EAD47">1</sl:policyInt><sl:policyInt name="office-7ECBF2AA-14AA-4F89-B9A5-C064274CFA83">1</sl:policyInt><sl:policyInt name="office-7ECBF2AA-14AA-4F89-B9A5-1064274CFA83">1</sl:policyInt><sl:policyInt name="office-5CB729FA-5219-4597-939F-7813DC968A76">1</sl:policyInt><sl:policyInt name="office-5CB729FA-5219-4597-939F-1813DC968A76">1</sl:policyInt><sl:policyInt name="office-30CAC893-3CA4-494C-A5E9-A99141352216">1</sl:policyInt><sl:policyInt name="office-30CAC893-3CA4-494C-A5E9-199141352216">1</sl:policyInt><sl:policyInt name="office-DC5CCACD-A7AC-4FD3-9F70-9454B5DE5161">1</sl:policyInt><sl:policyInt name="office-DC5CCACD-A7AC-4FD3-9F70-1454B5DE5161">1</sl:policyInt><sl:policyInt name="office-C7C81382-22F6-4238-B606-1B9A03E30CC2">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.LyncPro">1</sl:policyInt><sl:policyInt name="office-DisallowPhone">1</sl:policyInt><sl:policyInt name="office-MPC">02260</sl:policyInt><sl:policyInt name="office-AllowTerminalService">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ProXML">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ProEE-DRM">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ProEE-Classify">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ProEE-BarcodesAndLabels">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ProEE-Workflow">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ProSlideLibraryPublish">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ProOutlookPolicyTags">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.SaveForXLServices">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.GroupPolicySupport">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.BusinessIntelligence">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.CommercialUse">1</sl:policyInt><sl:policyInt name="office-Activatable">1</sl:policyInt><sl:policyInt name="office-DisplayEULA">1</sl:policyInt><sl:policyInt name="office-EulaID">8</sl:policyInt><sl:policyInt name="office-AppPrivilege.OneNotePro">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.PremiumBI">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.IRM">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.PolicyNudge">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.ArchiveMailbox">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.SiteMailbox">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.RetentionPolicies">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.licensing_isPaid">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.licensing_isVolume">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.licensing_isCommercial">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.licensing_isPerpetual">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.omex_suppressTMS">1</sl:policyInt><sl:policyInt name="office-AppPrivilege.licensing_runOnNonCloud">1</sl:policyInt><sl:policyInt name="Security-SPP-CMIDExpirationPeriod">43200</sl:policyInt><sl:policyInt name="Security-Licensing-SLC-CMIDExpirationPeriod">43200</sl:policyInt><sl:policyInt name="Security-SPP-Reserved-EnableNotificationMode" attributes="override-only">1</sl:policyInt><sl:policyInt name="Security-SPP-ActivationResetCount">3</sl:policyInt><sl:policyInt name="Security-SPP-ActivationResetCountMax">2147483647</sl:policyInt><sl:policyStr name="office-LicenseType">KMS</sl:policyStr><sl:policyStr name="office-ApplicationBitmap">0x000011BB</sl:policyStr><sl:policyBin name="Security-SPP-Reserved-AuthenticationKey-V2">Rfj+jGa+rbPSN6SIYLTbqfzgmXH2oWQYuivrrIkbZsZfdSFdpS7KBmB+Ds1w7D83/EONdI8GeQErhlHvejMzc+6psW9HE2Ct7H1UNnN7zYS3sE0Szuu8rWUvoQBGPKAqK4/3wZaaIxiitfcDQ9IfxK9Hdv6kpHnvnWB5O8lvbHYqxuu4tUHL3p0j3pv+4LWyb/RWti3PJl8KOJV7YSygVsNQkLZEQQshGqNm1xBV6zmdKJX4wxrzZlrDkxLlJK72ClijBuK9r5/+MklJraFAlOXw0TTeFe3imRIMG0cfM+nWGehzdFDckyTjJKj/GZ87p+w48lYMA2+trvHreuExZhN9Ymq1NTbShb5ORphgZRrf/6IUduWdUX+5z98cR9aRqtAg7UU8lcZmNjLtgKlxDaPUzvOU5VINa8N1SVQshGzCR4G+WpX+jq6TJHwzpfpCXei4+ZgwwhpCI1MzOh9x8dxnQxR7Fp7sFbLxWCUc7+OJU2aREPRgKa2s8kUD2kGiJsiAL+OZkU/EwZrJ70ejxPKeBz/QlcC25vBkUahKGlghn9iiT64CiULPCOrKzjhW8kpYC9e+qZiQSm9s3ZY+BMpFStxyaaFQvqSZVjDMqAcDhzoWZbjs4D+dcLWqw3BmPx2LKqyn3PI3OYuzsBAHPzziygCiHFdSSZbr6d6tbw6gP3+p2ax3OhrKhDHeaY+LK7xLBIWO9joT1Z0ovFBnctZ7FXIqvFgXBHAjq8RQe8djqtCegn8giPl7muenLFxYrB18F1EWsx8e5Z0e4ad+9a+JdL386eCzbsg8KooymqM04Ynx8PLeUd3Ak6REHDPP3nsuDF1rq/2q6Qo2KCNOjcfYK9HkZ28tZBnpDYhmaLpzMLCbiHjJJWEoMF+35QUWxrhoWmi+YOAau+nTGQuf8zY7gfBT/4QUZP0Ur9lQl6Ci0D8Z2RUcsBszyw6iILy/J8o4Bi6kHSjarinhzZeAirnPLqbwiXbWd4/St2vPG/FFQ6Pbhy0OtSswDnNqLzbm/e/T9+tWzfedRB+d84F9pItVfuRv0fhcOI+fBrUZZF9bR01TdM6rISe8Z0+XYXYGqzTd0Pkfvf2zIvSL+h0uWBZAABOIXS3lwsAsFdN2RMyRN4QI62aUoWVx7T+slzoMpFANUcX0qmSODLjDQqOACPZw/NijNDYt046HUR+UmBltEjHHthRpF+2aTFbGRB+fIV4tJyQ2lUMaSstwlT2FIZori8GqsSKjoptfV2ftYbJa42+0ym0ul4VL3LxDWwlE+pXECwBymXUKeDzlRUg+PoDhRceu4kKLdR+OsrJ4aAJIOW/ibZk05HX8YUB0Jjs4TCXXqzG6+Si51cUhYkElOA8US/TZr5MYxzvaFt2O2xyGQxlAL72kLEZGCIrhh9HDq4MD+e1zslDALRGAiUpe6XoK9hct6fVcqPiUlh+3W3rv2IDNCeNsQUX6Ouh5RqhBuIxD5mPklaoGQTc3W5GgWoonKaNw+nS7aRUCNHgJPlWJooV/EK44f6J7XLJHwXeGihwEBFStxKYFS3xTmuiUssVO5FUCLN7cGr/CBF69mqhpZdyFcOwI5WarVYFUqiiT</sl:policyBin></sl:productPolicies></r:allConditions></r:grant><r:issuer><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.microsoft.com/xrml/lwc14n"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference><Transforms><Transform Algorithm="urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform"/><Transform Algorithm="http://www.microsoft.com/xrml/lwc14n"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>hZFI7krat77SgYK9Dtt9uI0G+cU=</DigestValue></Reference></SignedInfo><SignatureValue>ZCx5ZgRFitJuyL9TVdp8vn4zjXGd9PlgVrJzAVp8CujKAPb9WzNHHb4DhiuNKkOYA3S5mYAiUH/fmpMPkJJT0w4kJpeKvjLHiIUX/I+1+9uxbbVfFl22BeSfPWCcEVRx5PXf75TiGk6Y7IvRcPfENbI/545eU78RekFaCTsIGq2OOoO/BbAwuDy3wOY0GuSDOt7lVypLScZB2GkrVnyoNEd96xz1F7/FGgXLOyqW1Xb3AKTC6suqUWyxP1EHhAkZzTA6AttQdvruOPKUR98XOGqR9s9LUD9wvgmq2Gz+jORkUvFBlecqZZHqHlAXzJL3yErVcZ9vb6pFMp0DpjNrbQ==</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>lAi6wXhcWOjn1rN1aIy6z4YBcYlkdrxP9EEw7iiD0tg6i0aVOgZ/FS6IxiOgZXYwTgK/BHA7QN6/lvxnecZ2cETT7w7ZRByGUN1zTQKFwXdyQz/xdp5kZ81bmI3EQWLJBT6iW5K8HZr0qRsQRlExUrWZSOI449+Br2QgOMcBMS3FEMBS8XCBPgZ3z/V9ydztWjhopBB0ZngebWEjqwtlrXEB1M+WOPWUcljdJlp5pXNkiqCrJEzenMJ+tfTfD/8zv08LdhhIAmx1VLViItRqO9OD7l313X7bVyfTWTxGmf7D9YS5Sa0UCiOXM0qVZCVuQ5CzjLRLa13FaJurQ6SBhQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo></Signature><r:details><r:timeOfIssue>2018-06-27T23:07:58Z</r:timeOfIssue></r:details></r:issuer><r:otherInfo xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS"><tm:infoTables xmlns:tm="http://www.microsoft.com/DRM/XrML2/TM/v2"><tm:infoList tag="#global"><tm:infoStr name="licenseType">msft:sl/PPD</tm:infoStr><tm:infoStr name="licenseVersion">2.0</tm:infoStr><tm:infoStr name="licensorUrl">https://licensing.microsoft.com</tm:infoStr><tm:infoStr name="licenseCategory">msft:sl/PPD</tm:infoStr><tm:infoStr name="applicationId">{0ff1ce15-a989-479d-af46-f275c6370663}</tm:infoStr><tm:infoStr name="migratable">true</tm:infoStr></tm:infoList></tm:infoTables></r:otherInfo></r:license>
Loading

0 comments on commit 991c8fa

Please sign in to comment.