$ show massgravel/Microsoft-Activation-Scripts
A collection of monolithic batch scripts (.cmd) that activate Microsoft Windows and Office using multiple methods: HWID (digital license generation), Ohook (DLL injection for Office), Online KMS (volume license with renewal), and TSforge (low-level licensing data manipulation). Each script is self-contained, containing extensive embedded PowerShell and, in one case, embedded C# code that is compiled and executed at runtime. The scripts demonstrate deep knowledge of Windows licensing internals, service management, and API calls via P/Invoke. However, the architecture is fragile: common setup logic is duplicated across all scripts, code is split between batch and PowerShell sections via fragile label splitting, and product keys/IDs are hardcoded. The repository is highly popular (192k+ stars) and functional but not well-engineered, with significant technical debt and maintenance complexity.
The LLM identified 3 files worth highlighting for reuse:
Contains a reusable PowerShell reflection pattern (dk_reflection) that dynamically creates P/Invoke methods for Windows DLLs (slc.dll, pkeyhelper.dll). This pattern can be extracted as a PowerShell module for calling native licensing APIs without external dependencies. Demonstrates deep understanding of Windows licensing internals and PowerShell CLR interop.
Implements Office activation via Ohook by injecting custom sppc32.dll/sppc64.dll (embedded as base64). The DLL is timestamp-modified to evade AV. The pattern of embedding binary blobs as base64 in batch scripts and extracting them for DLL injection is a reusable technique for similar activation bypass scenarios. The script also manages symlinks and license file installation.
Embeds C# classes (LibTSforge.Activators.KMS4k, LibTSforge.Activators.ZeroCID) inside a batch script that are compiled and executed at runtime via PowerShell. Demonstrates a hybrid batch/PowerShell/C# pattern for performing low-level licensing operations that require CLR access, specifically modifying Software Protection Platform data files. This approach can be adapted for other tasks needing managed code execution from batch.