コード例 #1
0
        public static void HandleServerProofRequest(BattlenetPacket packet)
        {
            var modules = packet.Read <byte>(3);
            var module  = new BattlenetModuleHandler(packet);

            for (var i = 0; i < modules; ++i)
            {
                packet.ReadString("Type", 4, i);
                packet.ReadFourCC("Region", i);
                var id = Utilities.ByteArrayToHexString(packet.ReadBytes(32));
                packet.Stream.WriteLine(string.Format("[{0}] ModuleId: {1}", i, id));
                var dataSize = packet.Read <int>("Data size", 10, i);
                var data     = packet.ReadBytes(dataSize);

                var result = module.HandleData(id, data, i);
                if (!result.HasValue)
                {
                    packet.Stream.WriteLine(string.Format("[{0}] Data: {1}", i, Utilities.ByteArrayToHexString(data)));
                }
                else if (!result.Value)
                {
                    ModulesWaitingForData.Add(id);
                }
            }
        }
コード例 #2
0
        public static void HandleProofResponse(BattlenetPacket packet)
        {
            var modules = packet.Read <byte>(3);
            var module  = new BattlenetModuleHandler(packet);

            for (var i = 0; i < modules; ++i)
            {
                var dataSize = packet.Read <int>("Data size", 10, i);
                var data     = packet.ReadBytes(dataSize);
                if (!module.HandleData(ModulesWaitingForData[i], data, i).HasValue)
                {
                    packet.Stream.AddValue("Data", data, i);
                }
            }

            ModulesWaitingForData.Clear();
        }
コード例 #3
0
        public static void HandleProofResponse(BattlenetPacket packet)
        {
            var modules = packet.Read <byte>(3);
            var module  = new BattlenetModuleHandler(packet);

            for (var i = 0; i < modules; ++i)
            {
                var dataSize = packet.Read <int>("Data size", 10, i);
                var data     = packet.ReadBytes(dataSize);
                if (!module.HandleData(ModulesWaitingForData[i], data, i).HasValue)
                {
                    packet.Stream.WriteLine(string.Format("[{0}] Data: {1}", i, Utilities.ByteArrayToHexString(data)));
                }
            }

            ModulesWaitingForData.Clear();
        }
コード例 #4
0
        public static void HandleComplete(BattlenetPacket packet)
        {
            var failed = packet.Read <bool>(1);

            if (failed)
            {
                if (packet.Read <bool>(1)) // has module
                {
                    packet.ReadString("Type", 4);
                    packet.ReadFourCC("Region");
                    var id       = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32));
                    var dataSize = packet.Read <int>("Data size", 10);
                    var data     = packet.ReadBytes(dataSize);
                    var module   = new BattlenetModuleHandler(packet);

                    if (!module.HandleData(id, data).HasValue)
                    {
                        packet.Stream.AddValue("Data", data);
                    }
                }

                var errorType = packet.Read <byte>(2);
                if (errorType == 1)
                {
                    packet.Read <ushort>("Result", 16);
                    packet.Read <uint>("Timeout", 32);
                }
            }
            else
            {
                var modules = packet.Read <byte>(3);
                var module  = new BattlenetModuleHandler(packet);
                for (var i = 0; i < modules; ++i)
                {
                    packet.ReadString("Type", 4);
                    packet.ReadFourCC("Region");
                    var id       = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32));
                    var dataSize = packet.Read <int>("Data size", 10);
                    var data     = packet.ReadBytes(dataSize);

                    if (!module.HandleData(id, data, i).HasValue)
                    {
                        packet.Stream.AddValue("Data", data, i);
                    }
                }

                packet.Stream.AddValue("Ping timeout", packet.Read <uint>(32) + int.MinValue);

                var hasOptionalData = packet.Read <bool>(1);
                if (hasOptionalData)
                {
                    var hasConnectionInfo = packet.Read <bool>(1);
                    if (hasConnectionInfo)
                    {
                        packet.Read <uint>("Threshold", 32);
                        packet.Read <uint>("Rate", 32);
                    }
                }

                packet.ReadString("First name", packet.Read <int>(8));
                packet.ReadString("Last name", packet.Read <int>(8));

                packet.Read <uint>("Account id", 32);
                packet.Read <byte>("Region", 8);
                packet.Read <ulong>("Account flags", 64);

                packet.Read <byte>("Game account region", 8);
                packet.ReadString("Game account name", packet.Read <int>(5) + 1);
                packet.Read <ulong>("Game account flags", 64);

                packet.Read <uint>("Failed logins", 32);
                if (packet.Read <bool>("Has RaF blob", 1))
                {
                    packet.ReadBytes("RaF Data", packet.Read <int>(10));
                }
            }
        }
コード例 #5
0
        public static void HandleComplete(BattlenetPacket packet)
        {
            var failed = packet.Read <bool>(1);

            if (failed)
            {
                if (packet.Read <bool>(1)) // has module
                {
                    var type     = packet.ReadString(4);
                    var region   = packet.ReadFourCC();
                    var id       = Utilities.ByteArrayToHexString(packet.ReadBytes(32));
                    var dataSize = packet.Read <int>(10);
                    var data     = packet.ReadBytes(dataSize);
                    var module   = new BattlenetModuleHandler(packet);

                    packet.Stream.WriteLine(string.Format("Type: {0}", type));
                    packet.Stream.WriteLine(string.Format("Region: {0}", region));
                    packet.Stream.WriteLine(string.Format("ModuleId: {0}", id));
                    packet.Stream.WriteLine(string.Format("Data size: {0}", dataSize));
                    if (!module.HandleData(id, data).HasValue)
                    {
                        packet.Stream.WriteLine(string.Format("Data: {0}", Utilities.ByteArrayToHexString(data)));
                    }
                }

                var errorType = packet.Read <byte>(2);
                if (errorType == 1)
                {
                    packet.Stream.WriteLine(string.Format("Result: {0}", packet.Read <ushort>(16)));
                    packet.Stream.WriteLine(string.Format("Unk: {0}", packet.Read <uint>(32)));
                }
            }
            else
            {
                var modules = packet.Read <byte>(3);
                var module  = new BattlenetModuleHandler(packet);
                for (var i = 0; i < modules; ++i)
                {
                    var type     = packet.ReadString(4);
                    var region   = packet.ReadFourCC();
                    var id       = Utilities.ByteArrayToHexString(packet.ReadBytes(32));
                    var dataSize = packet.Read <int>(10);
                    var data     = packet.ReadBytes(dataSize);

                    packet.Stream.WriteLine(string.Format("[{0}] Type: {1}", i, type));
                    packet.Stream.WriteLine(string.Format("[{0}] Region: {1}", i, region));
                    packet.Stream.WriteLine(string.Format("[{0}] ModuleId: {1}", i, id));
                    packet.Stream.WriteLine(string.Format("[{0}] Data size: {1}", i, dataSize));
                    if (!module.HandleData(id, data, i).HasValue)
                    {
                        packet.Stream.WriteLine(string.Format("[{0}] Data: {1}", i, Utilities.ByteArrayToHexString(data)));
                    }
                }

                packet.Stream.WriteLine(string.Format("Ping timeout: {0}", packet.Read <uint>(32) + int.MinValue));

                var hasOptionalData = packet.Read <bool>(1);
                if (hasOptionalData)
                {
                    var hasConnectionInfo = packet.Read <bool>(1);
                    if (hasConnectionInfo)
                    {
                        packet.Read <uint>("Threshold", 32);
                        packet.Read <uint>("Rate", 32);
                    }
                }

                packet.ReadString("First name", packet.Read <int>(8));
                packet.ReadString("Last name", packet.Read <int>(8));

                packet.Read <uint>("Account id", 32);

                packet.Read <byte>("Unk8", 8);
                packet.Read <ulong>("Unk64", 64);
                packet.Read <byte>("Unk8", 8);

                packet.ReadString("Account name", packet.Read <int>(5) + 1);

                packet.Read <ulong>("Unk64", 64);
                packet.Read <uint>("Unk32", 32);
                if (packet.Read <bool>("Unk1", 1))
                {
                    packet.Stream.WriteLine(string.Format("Data: {0}", Utilities.ByteArrayToHexString(packet.ReadBytes(packet.Read <int>(10)))));
                }
            }
        }