Inheritance: IDisposable
        static void Main(string[] args)
        {
            if (args.Length == 1)
            {
                using (var patcher = new Patcher(args[0]))
                {
                    Console.WriteLine("Arctium Connection Patcher");
                    Console.WriteLine("Press Enter to patch...");
                    Console.ReadKey(true);

                    switch (patcher.Type)
                    {
                    case BinaryTypes.Pe32:
                        patcher.Patch(Patches.Windows.x86.Send, Patterns.Windows.x86.Send);
                        patcher.Patch(Patches.Windows.x86.Email, Patterns.Windows.x86.Email);
                        patcher.Patch(Patches.Windows.x86.User, Patterns.Windows.x86.User);
                        patcher.Patch(Patches.Windows.x86.RaF, Patterns.Windows.x86.RaF);
                        patcher.Patch(Patches.Windows.x86.Rcv, Patterns.Windows.x86.Rcv);

                        patcher.Binary = patcher.Binary.Replace(".exe", "") + "_Patched.exe";

                        patcher.Finish();
                        break;

                    case BinaryTypes.Pe64:
                        patcher.Patch(Patches.Windows.x64.Send, Patterns.Windows.x64.Send);
                        patcher.Patch(Patches.Windows.x64.Email, Patterns.Windows.x64.Email);
                        patcher.Patch(Patches.Windows.x64.User, Patterns.Windows.x64.User);
                        patcher.Patch(Patches.Windows.x64.RaF, Patterns.Windows.x64.RaF);
                        patcher.Patch(Patches.Windows.x64.Rcv, Patterns.Windows.x64.Rcv);

                        patcher.Binary = patcher.Binary.Replace(".exe", "") + "_Patched.exe";

                        patcher.Finish();
                        break;

                    case BinaryTypes.Mach32:
                        patcher.Patch(Patches.Mac.x86.Send, Patterns.Mac.x86.Send);
                        patcher.Patch(Patches.Mac.x86.Email, Patterns.Mac.x86.Email);
                        patcher.Patch(Patches.Mac.x86.User, Patterns.Mac.x86.User);
                        patcher.Patch(Patches.Mac.x86.RaF, Patterns.Mac.x86.RaF);
                        patcher.Patch(Patches.Mac.x86.Rcv, Patterns.Mac.x86.Rcv);

                        patcher.Binary = patcher.Binary + " Patched";

                        patcher.Finish();
                        break;

                    case BinaryTypes.Mach64:
                        patcher.Patch(Patches.Mac.x64.Send, Patterns.Mac.x64.Send);
                        patcher.Patch(Patches.Mac.x64.Email, Patterns.Mac.x64.Email);
                        patcher.Patch(Patches.Mac.x64.User, Patterns.Mac.x64.User);
                        patcher.Patch(Patches.Mac.x64.RaF, Patterns.Mac.x64.RaF);
                        patcher.Patch(Patches.Mac.x64.Rcv, Patterns.Mac.x64.Rcv);

                        patcher.Binary = patcher.Binary + " Patched";

                        patcher.Finish();
                        break;

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

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

                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("Writing patched file...");
                }

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

                Thread.Sleep(5000);
                Environment.Exit(0);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (args.Length >= 1)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;

                Console.WriteLine("Arctium 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       = "/Users/Shared/Blizzard/Battle.net/Cache/";
                            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;
                Console.WriteLine("Adding host rewrite...");

                var host = args.Length == 2 ? args[1] : "127.0.0.1";
                var hostName = args.Length == 3 ? (" " + args[2] + ".logon.battle.net") : " arctium.logon.battle.net";
                var exists = false;

                using (var sr = new StreamReader(hostsPath))
                {
                    while (!sr.EndOfStream)
                    {
                        var line = sr.ReadLine();

                        if (line == host + hostName)
                        {
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.WriteLine("Host rewrite not needed... ;)");

                            exists = true;

                            break;
                        }
                    }
                }

                if (!exists)
                {
                    try
                    {
                        using (var stream = new StreamWriter(hostsPath, true, Encoding.UTF8))
                        {
                            stream.WriteLine("");
                            stream.WriteLine("{0}{1}", host, hostName);
                        }

                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Host rewrite successfully added.");
                    }
                    catch (Exception e)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(string.Format("Can't write host file! Exception type: {0}", e.GetType()));
                        Console.WriteLine("You must add the following line:");

                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine("{0}{1}", host, hostName);

                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("to your host file before using Arctium WoD Sandbox!");
                    }
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Wrong number of arguments: Missing client file.");
            }

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

            Environment.Exit(0);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            if (args.Length >= 1)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;

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

                Console.ReadKey(true);

                var commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                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 patchConnect     = Patches.Windows.x64.Connect;
                var patternConnect   = Patterns.Windows.x64.Connect;
                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;
                        patchConnect     = Patches.Windows.x86.Connect;
                        patternConnect   = Patterns.Windows.x86.Connect;
                        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;
                        patchConnect     = Patterns.Windows.x64.Connect;
                        patternConnect   = Patterns.Windows.x64.Connect;
                        patchSignature   = Patches.Mac.x64.Signature;
                        patternSignature = Patterns.Mac.x64.Signature;
                        fileName         = patcher.Binary + " Patched";

                        modulePath    = "/Users/Shared/Blizzard/Battle.net/Cache/";
                        moduleFile    = "97eeb2e28e9e56ed6a22d09f44e2ff43c93315e006bbad43bafc0defaa6f50ae.auth";
                        modulePatch   = Patches.Mac.x64.Password;
                        modulePattern = Patterns.Mac.x64.Password;
                        break;

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

                    patcher.Patch(patchBNet, patternBNet);
                    patcher.Patch(patchConnect, patternConnect);
                    patcher.Patch(patchSignature, patternSignature);

                    patcher.Patch(Patches.Common.Portal, Patterns.Common.Portal);
                    patcher.Patch(Patches.Common.Modulus, Patterns.Common.Modulus);

                    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.");
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Wrong number of arguments: Missing client file.");
            }

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

            Environment.Exit(0);
        }
Beispiel #4
0
        static void PatchModule(string file, string path, byte[] patches, byte[] pattern)
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Patching module...");

            using (var patcher2 = new Patcher(file))
            {
                patcher2.Patch(patches, pattern);

                var moduleName = Helper.GetFileChecksum(patcher2.binary) + ".auth";
                var modulePath = path + moduleName[0] + moduleName[1] + "/" + moduleName[2] + moduleName[3];

                if (!Directory.Exists(modulePath))
                    Directory.CreateDirectory(modulePath);

                patcher2.Binary = modulePath + "/" + moduleName;

                patcher2.Finish();
            }

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

            Console.ForegroundColor = ConsoleColor.Gray;
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            if (args.Length == 1)
            {
                using (var patcher = new Patcher(args[0]))
                {
                    Console.WriteLine("Client Connection Patcher");
                    Console.WriteLine("Press Enter to patch...");
                    Console.ReadKey(true);

                    switch (patcher.Type)
                    {
                        case BinaryTypes.Pe32:
                            patcher.Patch(Patches.Windows.x86.Send, Patterns.Windows.x86.Send);
                            patcher.Patch(Patches.Windows.x86.Email, Patterns.Windows.x86.Email);
                            patcher.Patch(Patches.Windows.x86.User, Patterns.Windows.x86.User);
                            patcher.Patch(Patches.Windows.x86.RaF, Patterns.Windows.x86.RaF);
                            patcher.Patch(Patches.Windows.x86.Rcv, Patterns.Windows.x86.Rcv);

                            patcher.Binary = patcher.Binary.Replace(".exe", "") + "_Patched.exe";

                            patcher.Finish();
                            break;
                        case BinaryTypes.Pe64:
                            patcher.Patch(Patches.Windows.x64.Send, Patterns.Windows.x64.Send);
                            patcher.Patch(Patches.Windows.x64.Email, Patterns.Windows.x64.Email);
                            patcher.Patch(Patches.Windows.x64.User, Patterns.Windows.x64.User);
                            patcher.Patch(Patches.Windows.x64.RaF, Patterns.Windows.x64.RaF);
                            patcher.Patch(Patches.Windows.x64.Rcv, Patterns.Windows.x64.Rcv);

                            patcher.Binary = patcher.Binary.Replace(".exe", "") + "_Patched.exe";

                            patcher.Finish();
                            break;
                        case BinaryTypes.Mach32:
                            patcher.Patch(Patches.Mac.x86.Send, Patterns.Mac.x86.Send);
                            patcher.Patch(Patches.Mac.x86.Email, Patterns.Mac.x86.Email);
                            patcher.Patch(Patches.Mac.x86.User, Patterns.Mac.x86.User);
                            patcher.Patch(Patches.Mac.x86.RaF, Patterns.Mac.x86.RaF);
                            patcher.Patch(Patches.Mac.x86.Rcv, Patterns.Mac.x86.Rcv);

                            patcher.Binary = patcher.Binary + " Patched";

                            patcher.Finish();
                            break;
                        case BinaryTypes.Mach64:
                            patcher.Patch(Patches.Mac.x64.Send, Patterns.Mac.x64.Send);
                            patcher.Patch(Patches.Mac.x64.Email, Patterns.Mac.x64.Email);
                            patcher.Patch(Patches.Mac.x64.User, Patterns.Mac.x64.User);
                            patcher.Patch(Patches.Mac.x64.RaF, Patterns.Mac.x64.RaF);
                            patcher.Patch(Patches.Mac.x64.Rcv, Patterns.Mac.x64.Rcv);

                            patcher.Binary = patcher.Binary + " Patched";
                             
                            patcher.Finish();
                            break;
                        default:
                            throw new NotSupportedException("Type: " + patcher.Type + " not supported!");
                    }

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

                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("Writing patched file...");
                }

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

                Thread.Sleep(5000);
                Environment.Exit(0);
            }
        }
        static void Main(string[] args)
        {
            if (args.Length >= 1)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;

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

                Console.ReadKey(true);

                var commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                var modulePath    = "";
                var moduleFile    = "";

                // Let's use Win32 as default module
                var patchSend          = Patches.Windows.x86.Send;
                var offsetSend         = Offsets.Windows.x86.Send;
                var patchRecv          = Patches.Windows.x86.Recv;
                var offsetRecv         = Offsets.Windows.x86.Recv;
                var patchBNet          = Patches.Windows.x86.BNet;
                var offsetBNet         = Offsets.Windows.x86.BNet;
                var patchSignature     = Patches.Windows.x86.Signature;
                var offsetSignature    = Offsets.Windows.x86.Signature;
                var fileName           = args[0].Replace(".exe", "_Patched.exe");
                var battleNetFileName  = args[0].Replace("Wow.exe", "Battle.net.dll");
                var modulePatch        = Patches.Windows.x86.Password;
                var modulePattern      = Patterns.Windows.x86.Password;
                var realmListPatch     = Patches.Windows.x86.RealmList;
                var realmListoffset    = Offsets.Windows.x86.RealmList;
                var realmListBnPatch   = Patches.Windows.x86.RealmListBn;
                var realmListBnPattern = Patterns.Windows.x86.RealmListBn;

                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...");
                        modulePath = commonAppData + "/Blizzard Entertainment/Battle.net/Cache/";
                        moduleFile = "8f52906a2c85b416a595702251570f96d3522f39237603115f2f1ab24962043c.auth";
                        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:
                    //    break;
                    //case BinaryTypes.Mach64:
                    //    Console.WriteLine("Mc64 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       = "/Users/Shared/Blizzard/Battle.net/Cache/";
                    //    moduleFile       = "97eeb2e28e9e56ed6a22d09f44e2ff43c93315e006bbad43bafc0defaa6f50ae.auth";
                    //    modulePatch      = Patches.Mac.x64.Password;
                    //    modulePattern    = Patterns.Mac.x64.Password;
                    //    break;
                    default:
                        throw new NotSupportedException("Type: " + patcher.Type + " not supported!");
                    }

                    if (!File.Exists(battleNetFileName + "_backup"))
                    {
                        File.Copy(battleNetFileName, battleNetFileName + "_backup");
                        File.SetAttributes(battleNetFileName + "_backup", File.GetAttributes(battleNetFileName + "_backup") | FileAttributes.ReadOnly);
                    }

                    using (var bnpatcher = new Patcher(battleNetFileName))
                    {
                        bnpatcher.Patch(patchBNet, null, offsetBNet);
                        bnpatcher.Patch(patchSignature, null, offsetSignature);
                        bnpatcher.Patch(realmListBnPatch, realmListBnPattern);
                        bnpatcher.Finish();
                    }

                    patcher.Patch(patchSend, null, offsetSend);
                    patcher.Patch(patchRecv, null, offsetRecv);
                    patcher.Patch(realmListPatch, null, realmListoffset);

                    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.");
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Wrong number of arguments: Missing client file.");
            }

            Console.ForegroundColor = ConsoleColor.Gray;
            Thread.Sleep(5000);
            Environment.Exit(0);
        }
        static void Main(string[] args)
        {
            if (args.Length >= 1)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;

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

                Console.ReadKey(true);

                var commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                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 patchConnect      = Patches.Windows.x64.Connect;
                var patternConnect    = Patterns.Windows.x64.Connect;
                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;
                            patchConnect     = Patches.Windows.x86.Connect;
                            patternConnect   = Patterns.Windows.x86.Connect;
                            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;
                            patchConnect     = Patterns.Windows.x64.Connect;
                            patternConnect   = Patterns.Windows.x64.Connect;
                            patchSignature   = Patches.Mac.x64.Signature;
                            patternSignature = Patterns.Mac.x64.Signature;
                            fileName         = patcher.Binary + " Patched";

                            modulePath       = "/Users/Shared/Blizzard/Battle.net/Cache/";
                            moduleFile       = "97eeb2e28e9e56ed6a22d09f44e2ff43c93315e006bbad43bafc0defaa6f50ae.auth";
                            modulePatch      = Patches.Mac.x64.Password;
                            modulePattern    = Patterns.Mac.x64.Password;
                            break;
                        default:
                            throw new NotSupportedException("Type: " + patcher.Type + " not supported!");
                    }

                    patcher.Patch(patchBNet, patternBNet);
                    patcher.Patch(patchConnect, patternConnect);
                    patcher.Patch(patchSignature, patternSignature);

                    patcher.Patch(Patches.Common.Portal, Patterns.Common.Portal);
                    patcher.Patch(Patches.Common.Modulus, Patterns.Common.Modulus);

                    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.");
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Wrong number of arguments: Missing client file.");
            }

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

            Environment.Exit(0);
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            if (args.Length >= 1)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;

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

                Console.ReadKey(true);

                var commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                var modulePath    = "";
                var moduleFile    = "";

                // Let's use Win32 as default module
                var patchSend         = Patches.Windows.x86.Send;
                var offsetSend        = Offsets.Windows.x86.Send;
                var patchRecv         = Patches.Windows.x86.Recv;
                var offsetRecv        = Offsets.Windows.x86.Recv;
                var patchBNet         = Patches.Windows.x86.BNet;
                var offsetBNet        = Offsets.Windows.x86.BNet;
                var patchSignature    = Patches.Windows.x86.Signature;
                var offsetSignature   = Offsets.Windows.x86.Signature;
                var fileName          = args[0].Replace(".exe", "_Patched.exe");
                var battleNetFileName = args[0].Replace("Wow.exe", "Battle.net.dll");
                var modulePatch       = Patches.Windows.x86.Password;
                var modulePattern     = Patterns.Windows.x86.Password;
                var realmListPatch    = Patches.Windows.x86.RealmList;
                var realmListoffset   = Offsets.Windows.x86.RealmList;
                var realmListBnPatch  = Patches.Windows.x86.RealmListBn;
                var realmListBnPattern = Patterns.Windows.x86.RealmListBn;

                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...");
                            modulePath        = commonAppData + "/Blizzard Entertainment/Battle.net/Cache/";
                            moduleFile        = "8f52906a2c85b416a595702251570f96d3522f39237603115f2f1ab24962043c.auth";
                            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:
                        //    break;
                        //case BinaryTypes.Mach64:
                        //    Console.WriteLine("Mc64 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       = "/Users/Shared/Blizzard/Battle.net/Cache/";
                        //    moduleFile       = "97eeb2e28e9e56ed6a22d09f44e2ff43c93315e006bbad43bafc0defaa6f50ae.auth";
                        //    modulePatch      = Patches.Mac.x64.Password;
                        //    modulePattern    = Patterns.Mac.x64.Password;
                        //    break;
                        default:
                            throw new NotSupportedException("Type: " + patcher.Type + " not supported!");
                    }

                    if (!File.Exists(battleNetFileName + "_backup"))
                    {
                        File.Copy(battleNetFileName, battleNetFileName + "_backup");
                        File.SetAttributes(battleNetFileName + "_backup", File.GetAttributes(battleNetFileName + "_backup") | FileAttributes.ReadOnly);
                    }

                    using (var bnpatcher = new Patcher(battleNetFileName))
                    {
                        bnpatcher.Patch(patchBNet, null, offsetBNet);
                        bnpatcher.Patch(patchSignature, null, offsetSignature);
                        bnpatcher.Patch(realmListBnPatch, realmListBnPattern);
                        bnpatcher.Finish();
                    }

                    patcher.Patch(patchSend, null, offsetSend);
                    patcher.Patch(patchRecv, null, offsetRecv);
                    patcher.Patch(realmListPatch, null, realmListoffset);

                    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.");
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Wrong number of arguments: Missing client file.");
            }

            Console.ForegroundColor = ConsoleColor.Gray;
            Thread.Sleep(5000);
            Environment.Exit(0);
        }