コード例 #1
0
        public QPacket(byte[] data)
        {
            MemoryStream m = new MemoryStream(data);

            m_oSourceVPort      = new VPort(Helper.ReadU8(m));
            m_oDestinationVPort = new VPort(Helper.ReadU8(m));
            m_byPacketTypeFlags = Helper.ReadU8(m);
            type  = (PACKETTYPE)(m_byPacketTypeFlags & 0x7);
            flags = new List <PACKETFLAG>();
            ExtractFlags();
            m_bySessionID = Helper.ReadU8(m);
            m_uiSignature = Helper.ReadU32(m);
            uiSeqId       = Helper.ReadU16(m);
            if (type == PACKETTYPE.SYN || type == PACKETTYPE.CONNECT)
            {
                m_uiConnectionSignature = Helper.ReadU32(m);
            }
            if (type == PACKETTYPE.DATA)
            {
                m_byPartNumber = Helper.ReadU8(m);
            }
            if (flags.Contains(PACKETFLAG.FLAG_HAS_SIZE))
            {
                payloadSize = Helper.ReadU16(m);
            }
            MemoryStream pl = new MemoryStream();

            for (int i = (int)m.Position; i < m.Length - 1; i++)
            {
                pl.WriteByte(Helper.ReadU8(m));
            }
            payload     = pl.ToArray();
            payloadSize = (ushort)payload.Length;
            if (payload != null && payload.Length > 0)
            {
                payload         = Helper.Decrypt(Global.keyDATA, payload);
                usesCompression = payload[0] != 0;
                if (usesCompression)
                {
                    MemoryStream m2 = new MemoryStream();
                    m2.Write(payload, 1, payload.Length - 1);
                    payload = Helper.Decompress(m2.ToArray());
                }
                else
                {
                    MemoryStream m2 = new MemoryStream();
                    m2.Write(payload, 1, payload.Length - 1);
                    payload = m2.ToArray();
                }
                payloadSize = (ushort)payload.Length;
            }
            checkSum = Helper.ReadU8(m);
        }
コード例 #2
0
        public RMCPacket(QPacket p)
        {
            MemoryStream m = new MemoryStream(p.payload);

            Helper.ReadU32(m);
            ushort b = Helper.ReadU8(m);

            isRequest = (b >> 7) == 1;
            try
            {
                if ((b & 0x7F) != 0x7F)
                {
                    proto = (PROTOCOL)(b & 0x7F);
                }
                else
                {
                    b     = Helper.ReadU16(m);
                    proto = (PROTOCOL)(b);
                }
            }
            catch
            {
                callID   = Helper.ReadU32(m);
                methodID = Helper.ReadU32(m);
                WriteLog("Error: Unknown RMC packet protocol 0x" + b.ToString("X2"));
                return;
            }
            callID   = Helper.ReadU32(m);
            methodID = Helper.ReadU32(m);
            switch (proto)
            {
            case PROTOCOL.Authentication:
                HandleAuthenticationMethods(m);
                break;

            case PROTOCOL.Secure:
                HandleSecureMethods(m);
                break;

            default:
                WriteLog("Error: No reader implemented for packet protocol " + proto);
                break;
            }
        }
コード例 #3
0
ファイル: RMCPacket.cs プロジェクト: Aquilabot/GRPBackendWV
        public RMCPacket(QPacket p)
        {
            MemoryStream m = new MemoryStream(p.payload);

            Helper.ReadU32(m);
            ushort b = Helper.ReadU8(m);

            isRequest = (b >> 7) == 1;
            try
            {
                if ((b & 0x7F) != 0x7F)
                {
                    proto = (PROTOCOL)(b & 0x7F);
                }
                else
                {
                    b     = Helper.ReadU16(m);
                    proto = (PROTOCOL)(b);
                }
            }
            catch
            {
                callID   = Helper.ReadU32(m);
                methodID = Helper.ReadU32(m);
                WriteLog(1, "Error: Unknown RMC packet protocol 0x" + b.ToString("X2"));
                return;
            }
            callID   = Helper.ReadU32(m);
            methodID = Helper.ReadU32(m);
            switch (proto)
            {
            case PROTOCOL.Authentication:
                HandleAuthenticationMethods(m);
                break;

            case PROTOCOL.Secure:
                HandleSecureMethods(m);
                break;

            case PROTOCOL.Telemetry:
                HandleTelemetryMethods(m);
                break;

            case PROTOCOL.AMMGameClient:
            case PROTOCOL.PlayerProfileService:
            case PROTOCOL.ArmorService:
            case PROTOCOL.InventoryService:
            case PROTOCOL.LootService:
            case PROTOCOL.WeaponService:
            case PROTOCOL.FriendsService:
            case PROTOCOL.ChatService:
            case PROTOCOL.MissionService:
            case PROTOCOL.PartyService:
            case PROTOCOL.StatisticsService:
            case PROTOCOL.AchievementsService:
            case PROTOCOL.ProgressionService:
            case PROTOCOL.DBGTelemetry:
            case PROTOCOL.RewardService:
            case PROTOCOL.StoreService:
            case PROTOCOL.AdvertisementsService:
            case PROTOCOL.SkillsService:
            case PROTOCOL.Loadout:
            case PROTOCOL.UnlockService:
            case PROTOCOL.AvatarService:
            case PROTOCOL.WeaponProficiencyService:
            case PROTOCOL.OpsProtocolService:
            case PROTOCOL.ServerInfo:
            case PROTOCOL.LeaderboardService:
            case PROTOCOL.PveArchetypeService:
            case PROTOCOL.InboxMessageService:
            case PROTOCOL.ProfanityFilterService:
            case PROTOCOL.AbilityService:
            case PROTOCOL.SurveyService:
            case PROTOCOL.OverlordNewsProtocol:
                break;

            default:
                WriteLog(1, "Error: No reader implemented for packet protocol " + proto);
                break;
            }
        }