コード例 #1
0
        //void HandleMessage::AuthLoginOk(Player* player, CryptManager* Crypt)
        private void AuthLoginOk(AuthLogin Ppacket,TcpClient tcpC)
        {
            // related to subscription, need info
            AuthLoginOk packet;
            packet.PacketLength = 0x28;
            packet.OPCode		= OPCode.AuthLO;
            packet.Unknown1		= 0x00;
            packet.Unknown2		= 0x00;
            packet.Unknown3		= 0x00;
            packet.Unknown4		= 0x00;
            packet.Unknown5		= 0x00;
            packet.Unknown6		= 0x00;
            packet.Unknown7		= 0x00;
            packet.Unknown8		= 0x00;
            packet.Unknown9		= 0x00;
            packet.Unknown10	= 0x00;

            //    Net::SendEncrypted(player->socket, (char*)&packet, 0x28, Crypt);
            SendEncrypted(packet, tcpC, 0x28);
            //    return;
        }
コード例 #2
0
        private void handleIncomingClient(object pTcpC)
        {
            TcpClient tcpC = (TcpClient)pTcpC;
            Display.displayMessage("On gère le client connecté!!");

            // Test AuthHello
            PacketManager pm = new PacketManager();
            pm.sendAuthHello(tcpC);
            Byte[] buffer = new byte[128];
            int result = tcpC.Client.Receive(buffer);

            for(int i=0; i<6; i++) //(0x32-2)/8; i++)
            {
                UInt32 a = BitConverter.ToUInt32(buffer, 2 + i * 8);
                UInt32 b = BitConverter.ToUInt32(buffer, 2 + i * 8 + 4);

                _bfp.BFDecrypt(ref a,ref b);

                Byte[] bA = BitConverter.GetBytes(a);
                Byte[] bB = BitConverter.GetBytes(b);

                for (int j = 0; j < 4; j++)
                {
                    buffer[2 + i * 8 + j] = bA[j];
                    buffer[2 + i * 8 + 4 + j] = bB[j];
                }
            }
            AuthLogin packet = new AuthLogin();
            packet.UserData = new Byte[30];
            packet = StructureOperations.RawDeserialize<AuthLogin>(buffer, 0);
            int size = Marshal.SizeOf(packet);
            if (packet.OPCode != OPCode.AuthL)
            {
                // f****d up !!
                throw new NotImplementedException("F****d up like JH said");
            }

            _op.decrypt(ref packet.UserData, packet.UserData.Length);

            AuthLoginOk(packet, tcpC);
        }