示例#1
0
        static void Main(string[] args)
        {
            if (args.Length >= 1)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;

                Console.WriteLine("Connection Patcher");
                Console.WriteLine("Press Enter to patch...");

                Console.ReadKey(true);

                var commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                var system32      = Environment.GetFolderPath(Environment.SpecialFolder.System);
                var hostsPath     = Path.Combine(system32, "drivers/etc/hosts");
                var modulePath    = "";
                var moduleFile    = "";

                // Let's use Win64 as default module
                var modulePatch      = Patches.Windows.x64.Password;
                var modulePattern    = Patterns.Windows.x64.Password;
                var patchBNet        = Patches.Windows.x64.BNet;
                var patternBNet      = Patterns.Windows.x64.BNet;
                var patchSend        = Patches.Windows.x64.Send;
                var patternSend      = Patterns.Windows.x64.Send;
                var patchSignature   = Patches.Windows.x64.Signature;
                var patternSignature = Patterns.Windows.x64.Signature;
                var fileName         = "";

                Console.ForegroundColor = ConsoleColor.White;
                Console.Write("Creating patched binaries for ");

                using (var patcher = new Patcher(args[0]))
                {
                    switch (patcher.Type)
                    {
                    case BinaryTypes.Pe32:
                        Console.WriteLine("Win32 client...");
                        patchBNet        = Patches.Windows.x86.BNet;
                        patternBNet      = Patterns.Windows.x86.BNet;
                        patchSend        = Patches.Windows.x86.Send;
                        patternSend      = Patterns.Windows.x86.Send;
                        patchSignature   = Patches.Windows.x86.Signature;
                        patternSignature = Patterns.Windows.x86.Signature;
                        fileName         = patcher.Binary.Replace(".exe", "") + "_Patched.exe";

                        modulePath    = commonAppData + "/Blizzard Entertainment/Battle.net/Cache/";
                        moduleFile    = "8f52906a2c85b416a595702251570f96d3522f39237603115f2f1ab24962043c.auth";
                        modulePatch   = Patches.Windows.x86.Password;
                        modulePattern = Patterns.Windows.x86.Password;
                        break;

                    case BinaryTypes.Pe64:
                        Console.WriteLine("Win64 client...");
                        fileName = patcher.Binary.Replace(".exe", "") + "_Patched.exe";

                        modulePath = commonAppData + "/Blizzard Entertainment/Battle.net/Cache/";
                        moduleFile = "0a3afee2cade3a0e8b458c4b4660104cac7fc50e2ca9bef0d708942e77f15c1d.auth";
                        break;

                    case BinaryTypes.Mach32:
                        throw new NotSupportedException("Type: " + patcher.Type + " not supported!");

                    case BinaryTypes.Mach64:
                        Console.WriteLine("Mac client...");
                        patchBNet        = Patches.Mac.x64.BNet;
                        patternBNet      = Patterns.Mac.x64.BNet;
                        patchSend        = Patches.Mac.x64.Send;
                        patternSend      = Patterns.Mac.x64.Send;
                        patchSignature   = Patches.Mac.x64.Signature;
                        patternSignature = Patterns.Mac.x64.Signature;
                        fileName         = patcher.Binary + " Patched";

                        modulePath    = "";
                        moduleFile    = "97eeb2e28e9e56ed6a22d09f44e2ff43c93315e006bbad43bafc0defaa6f50ae.auth";
                        modulePatch   = Patches.Mac.x64.Password;
                        modulePattern = Patterns.Mac.x64.Password;
                        hostsPath     = "/private/etc/hosts";
                        break;

                    default:
                        throw new NotSupportedException("Type: " + patcher.Type + " not supported!");
                    }

                    patcher.Patch(patchBNet, patternBNet);
                    patcher.Patch(patchSend, patternSend);
                    patcher.Patch(patchSignature, patternSignature);

                    patcher.Binary = fileName;

                    patcher.Finish();

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Patching done.");

                    CreateModule(moduleFile, modulePath, modulePatch, modulePattern);

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Successfully created your patched binaries.");
                }

                Console.ForegroundColor = ConsoleColor.White;
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Wrong number of arguments: Missing client file.");
            }

            Console.ForegroundColor = ConsoleColor.Gray;
            Thread.Sleep(5000);

            Environment.Exit(0);
        }
示例#2
0
        static void Main(string[] args)
        {
            if (args.Length >= 1)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("Cypher Systems Connection Patcher");

                Console.ForegroundColor = ConsoleColor.White;
                Console.Write("Creating patched binaries for ");

                using (var patcher = new Patcher(args[0]))
                {
                    // always set wowBuild to current build of the .exe files
                    uint wowBuild = patcher.GetBuildNumber();

                    // define logical limits in case the exe was tinkered with and the build number was changed
                    if (wowBuild == 0 || wowBuild < 10000 || wowBuild > 65535) // Build number has to be exactly 5 characters long
                    {
                        Console.WriteLine("Build number was out of range. Build: " + wowBuild);
                        return;
                    }

                    Console.WriteLine($"Determined build number: {wowBuild}");

                    Console.WriteLine("patching Portal");
                    patcher.Patch(Patches.Common.Portal, Encoding.UTF8.GetBytes(Patterns.Common.Portal));

                    Console.WriteLine("patching redirect RSA Modulus");
                    patcher.Patch(Patches.Common.Modulus, Patterns.Common.Modulus);

                    Console.WriteLine("patching BNet certificate file location");
                    patcher.Patch(Patches.Common.CertBundleUrl, Patterns.Common.CertBundleUrl);

                    Console.WriteLine("patching BNet certificate file signature");

                    RSACryptoServiceProvider provider = PemKeyUtils.GetRSAProviderFromPemFile(Patches.Common.CertificatePrivateKey);
                    patcher.Patch(provider.ExportParameters(true).Modulus.Reverse().ToArray(), Patterns.Common.CertSignatureModulus);

                    string verPatch = Patches.Common.VersionsFile;
                    patcher.Patch(verPatch.Replace("build", wowBuild.ToString()).ToCharArray(), Patterns.Common.VersionsFile);

                    Console.WriteLine("patching launcher login parameters location");
                    // change registry/CFPreferences path
                    switch (patcher.Type)
                    {
                    case BinaryTypes.Pe64:
                        patcher.Patch(Patches.Windows.LauncherLoginParametersLocation, Patterns.Windows.LauncherLoginParametersLocation);
                        patcher.Binary = patcher.Binary.Replace(".exe", "_Patched.exe");
                        break;

                    case BinaryTypes.Mach64:
                        patcher.Patch(Patches.Mac.LauncherLoginParametersLocation, Patterns.Mac.LauncherLoginParametersLocation);
                        patcher.Binary = patcher.Binary.Replace(".app", "Patched.app");
                        break;

                    case BinaryTypes.Pe32:
                    case BinaryTypes.Mach32:
                    default:
                        throw new NotSupportedException("Type: " + patcher.Type + " not supported!");
                    }
                    patcher.Finish();

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Patching done.");
                    Console.WriteLine("Successfully created your patched binaries.");
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Wrong number of arguments: Missing client file.");
            }

            Console.ForegroundColor = ConsoleColor.Gray;
            Thread.Sleep(5000);

            Environment.Exit(0);
        }