Exemplo n.º 1
0
        public static void InitWarden()
        {
            MaievData m = new(Realmserver.SS_Hash);

            byte[] seedOut = m.GetBytes(16);
            byte[] seedIn  = m.GetBytes(16);
            Maiev.KeyOut = RC4.Init(seedOut);
            Maiev.KeyIn  = RC4.Init(seedIn);
        }
Exemplo n.º 2
0
            /* TODO ERROR: Skipped RegionDirectiveTrivia */
            public bool LoadModule(string Name, ref byte[] Data, byte[] Key)
            {
                Key = RC4.Init(Key);
                RC4.Crypt(ref Data, Key);
                int UncompressedLen = BitConverter.ToInt32(Data, 0);

                if (UncompressedLen < 0)
                {
                    Console.WriteLine("[WARDEN] Failed to decrypt {0}, incorrect length.", Name);
                    return(false);
                }

                var CompressedData = new byte[(Data.Length - 0x108)];

                Array.Copy(Data, 4, CompressedData, 0, CompressedData.Length);
                int    dataPos = 4 + CompressedData.Length;
                string Sign    = Conversions.ToString((char)Data[dataPos + 3]) + (char)Data[dataPos + 2] + (char)Data[dataPos + 1] + (char)Data[dataPos];

                if (Sign != "SIGN")
                {
                    Console.WriteLine("[WARDEN] Failed to decrypt {0}, sign missing.", Name);
                    return(false);
                }

                dataPos += 4;
                var Signature = new byte[256];

                Array.Copy(Data, dataPos, Signature, 0, Signature.Length);

                // Check signature
                if (CheckSignature(Signature, Data, Data.Length - 0x104) == false)
                {
                    Console.WriteLine("[WARDEN] Signature fail on Warden Module.");
                    return(false);
                }

                var DecompressedData = new ZipService().DeCompress(CompressedData);
                var ms = new MemoryStream(DecompressedData);
                var br = new BinaryReader(ms);

                ModuleData = PrepairModule(ref br);
                ms.Close();
                ms.Dispose();
                br = null;
                Console.WriteLine("[WARDEN] Successfully prepaired Warden Module.");
                if (!InitModule(ref ModuleData))
                {
                    return(false);
                }
                return(true);
            }