예제 #1
0
        private void Parse_CHEAT_CHECKS(BinaryReader gr)
        {
            //AppendFormatLine("====== CHEAT CHECKS START ======");
            //AppendLine();

            List <string> strings = new List <string>();

            strings.Add("");

            var opcode = gr.ReadByte();

            byte len;

            while ((len = gr.ReadByte()) != 0)
            {
                var strBytes = gr.ReadBytes(len);
                var str      = Encoding.ASCII.GetString(strBytes);
                strings.Add(str);
            }
            var rest   = gr.BaseStream.Length - gr.BaseStream.Position;
            var checks = gr.ReadBytes((int)rest);
            var reader = new BinaryReader(new MemoryStream(checks), Encoding.ASCII);

            while (reader.BaseStream.Position + 1 != reader.BaseStream.Length)
            {
                var xor = checks[checks.Length - 1];

                var check     = reader.ReadByte();
                var checkType = (byte)(check ^ xor);

                CheckType checkType2;
                if (!WardenData.CheckTypes.TryGetValue(checkType, out checkType2))
                {
                    WardenData.ShowForm(strings, checks, check);
                    break;
                }

                switch (checkType2)
                {
                case CheckType.TIMING_CHECK:
                    Parse_TIMING_CHECK(check, checkType);
                    break;

                case CheckType.MEM_CHECK:
                    Parse_MEM_CHECK(strings, reader, check, checkType);
                    break;

                case CheckType.PAGE_CHECK_A:
                case CheckType.PAGE_CHECK_B:
                    Parse_PAGE_CHECK(reader, check, checkType);
                    break;

                case CheckType.PROC_CHECK:
                    Parse_PROC_CHECK(strings, reader, check, checkType);
                    break;

                case CheckType.MPQ_CHECK:
                    Parse_MPQ_CHECK(strings, reader, check, checkType);
                    break;

                case CheckType.LUA_STR_CHECK:
                    Parse_LUA_STR_CHECK(strings, reader, check, checkType);
                    break;

                case CheckType.DRIVER_CHECK:
                    Parse_DRIVER_CHECK(strings, reader, check, checkType);
                    break;

                default:
                    AppendFormatLine("Unknown CheckType {0}", checkType2);
                    break;
                }
            }
            //AppendFormatLine("====== CHEAT CHECKS END ======");
            //AppendLine();
        }
예제 #2
0
        public override void Parse()
        {
            BinaryReader gr = Packet.CreateReader();

            WardenData.CheckInfos.Clear();

            var wardenOpcode = gr.ReadByte();

            gr.BaseStream.Position = 0;
            //AppendFormatLine("S->C Warden Opcode: {0:X2}", wardenOpcode);

            switch (wardenOpcode)
            {
            case 0x00:
            {
                var opcode = gr.ReadByte();
                var md5    = gr.ReadBytes(16);      // md5
                var rc4    = gr.ReadBytes(16);      // rc4 key
                var len    = gr.ReadInt32();        // len
                AppendFormatLine("MD5: 0x{0}", md5.ToHexString());
                AppendFormatLine("RC4: 0x{0}", rc4.ToHexString());
                AppendFormatLine("Len: {0}", len);
                AppendLine();
            }
            break;

            case 0x01:
            {
                var opcode = gr.ReadByte();
                var len    = gr.ReadInt16();
                var chunk  = gr.ReadBytes(len);
                AppendFormatLine("Received warden module chunk, len {0}", len);
                AppendLine();
            }
            break;

            case 0x02:
                Parse_CHEAT_CHECKS(gr);
                break;

            case 0x03:
            {
                while (gr.BaseStream.Position != gr.BaseStream.Length)
                {
                    var opcode   = gr.ReadByte();
                    var len      = gr.ReadInt16();
                    var checkSum = gr.ReadUInt32();
                    var data     = gr.ReadBytes(len);

                    AppendFormatLine("Len: {0}", len);
                    AppendFormatLine("Checksum: 0x{0:X8} {1}", checkSum, WardenData.ValidateCheckSum(checkSum, data));
                    AppendFormatLine("Data: 0x{0}", data.ToHexString());
                    AppendLine();
                }
            }
            break;

            case 0x05:
            {
                var opcode = gr.ReadByte();
                var seed   = gr.ReadBytes(16);
                AppendFormatLine("Seed: 0x{0}", seed.ToHexString());
                AppendLine();
            }
            break;

            default:
                AppendFormatLine("Unknown warden opcode {0}", wardenOpcode);
                break;
            }

            CheckPacket(gr);
        }