Beispiel #1
0
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            // for 1.115c+ The First client packet Changes.
            if (client.Version < GameClient.eClientVersion.Version1115)
            {
                int  rc4        = packet.ReadByte();
                byte clientType = (byte)packet.ReadByte();
                client.ClientType   = (GameClient.eClientType)(clientType & 0x0F);
                client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
                client.MajorBuild   = (byte)packet.ReadByte();
                client.MinorBuild   = (byte)packet.ReadByte();
                client.MinorRev     = packet.ReadString(1);
                if (rc4 == 1)
                {
                    //DOLConsole.Log("SBox=\n");
                    //DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
                    packet.Read(client.PacketProcessor.Encoding.SBox, 0, 256);
                    client.PacketProcessor.Encoding.EncryptionState = eEncryptionState.PseudoRC4Encrypted;
                    //DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
                    //DOLConsole.Log("SBox=\n");
                    //DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
                }
                else
                {
                    //Send the crypt key to the client
                    client.Out.SendVersionAndCryptKey();
                }
            }
            else
            {
                // if the DataSize is above 7 then the RC4 key is bundled
                if (packet.DataSize > 7)
                {
                    if (Properties.CLIENT_ENABLE_ENCRYPTION_RC4)
                    {
                        var length = packet.ReadIntLowEndian();
                        var key    = new byte[length];
                        packet.Read(key, 0, (int)length);
                        client.PacketProcessor.Encoding.SBox            = key;
                        client.PacketProcessor.Encoding.EncryptionState = eEncryptionState.PseudoRC4Encrypted;
                    }
                    return;
                }

                // register client type
                byte clientType = (byte)packet.ReadByte();
                client.ClientType   = (GameClient.eClientType)(clientType & 0x0F);
                client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
                // the next 4 bytes are the game.dll version but not in string form
                // ie: 01 01 19 61 = 1.125a
                // this version is handled elsewhere before being sent here.
                packet.Skip(3);                         // skip the numbers in the version
                client.MinorRev = packet.ReadString(1); // get the minor revision letter // 1125d support
                packet.Skip(2);                         // build


                //Send the crypt key to the client
                client.Out.SendVersionAndCryptKey();
            }
        }
Beispiel #2
0
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            // for 1.115c+ The First client packet Changes.
            if (client.Version < GameClient.eClientVersion.Version1115)
            {
                int  rc4        = packet.ReadByte();
                byte clientType = (byte)packet.ReadByte();
                client.ClientType   = (GameClient.eClientType)(clientType & 0x0F);
                client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
                byte major = (byte)packet.ReadByte();
                byte minor = (byte)packet.ReadByte();
                byte build = (byte)packet.ReadByte();
                if (rc4 == 1)
                {
                    //DOLConsole.Log("SBox=\n");
                    //DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
                    packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox, 0, 256);
                    ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState = PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
                    //DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
                    //DOLConsole.Log("SBox=\n");
                    //DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
                }
                else
                {
                    //Send the crypt key to the client
                    client.Out.SendVersionAndCryptKey();
                }
            }
            else
            {
                // we don't handle Encryption for 1.115c
                // the rc4 secret can't be unencrypted from RSA.

                // register client type
                byte clientType = (byte)packet.ReadByte();
                client.ClientType   = (GameClient.eClientType)(clientType & 0x0F);
                client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);

                // if the DataSize is above 7 then the RC4 key is bundled
                // this is stored in case we find a way to handle encryption someday !
                if (packet.DataSize > 7)
                {
                    packet.Skip(6);
                    ushort length = packet.ReadShortLowEndian();
                    packet.Read(client.PacketProcessor.Encoding.SBox, 0, length);
                    // ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
                }

                //Send the crypt key to the client
                client.Out.SendVersionAndCryptKey();
            }
        }
Beispiel #3
0
		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			// for 1.115c+ The First client packet Changes.
			if (client.Version < GameClient.eClientVersion.Version1115)
			{
				int rc4 = packet.ReadByte();
				byte clientType = (byte)packet.ReadByte();
				client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
				client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
				byte major = (byte)packet.ReadByte();
				byte minor = (byte)packet.ReadByte();
				byte build = (byte)packet.ReadByte();
				if(rc4==1)
				{
					//DOLConsole.Log("SBox=\n");
					//DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
					packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256);
					((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
					//DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
					//DOLConsole.Log("SBox=\n");
					//DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
				}
				else
				{
				  //Send the crypt key to the client
					client.Out.SendVersionAndCryptKey();
				}
			}
			else
			{
				// we don't handle Encryption for 1.115c
				// the rc4 secret can't be unencrypted from RSA.
				
				// register client type
				byte clientType = (byte)packet.ReadByte();
				client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
				client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
				
				// if the DataSize is above 7 then the RC4 key is bundled
				// this is stored in case we find a way to handle encryption someday !
				if (packet.DataSize > 7)
				{
					packet.Skip(6);
					ushort length = packet.ReadShortLowEndian();
					packet.Read(client.PacketProcessor.Encoding.SBox, 0, length);
					// ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
				}
				
				//Send the crypt key to the client
				client.Out.SendVersionAndCryptKey();
			}
		}
Beispiel #4
0
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            // we don't handle Encryption for 1.115c
            // the rc4 secret can't be unencrypted from RSA.

            // register client type
            byte clientType = (byte)packet.ReadByte();

            client.ClientType   = (GameClient.eClientType)(clientType & 0x0F);
            client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);

            // if the DataSize is above 7 then the RC4 key is bundled
            // this is stored in case we find a way to handle encryption someday !
            if (packet.DataSize > 7)
            {
                packet.Skip(6);
                ushort length = packet.ReadShortLowEndian();
                packet.Read(client.PacketProcessor.Encoding.SBox, 0, length);

                // ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
            }

            // Send the crypt key to the client
            client.Out.SendVersionAndCryptKey();
        }
		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int rc4 = packet.ReadByte();
			byte clientType = (byte)packet.ReadByte();
			client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
			client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
			byte major = (byte)packet.ReadByte();
			byte minor = (byte)packet.ReadByte();
			byte build = (byte)packet.ReadByte();
			if(rc4==1)
			{
				//DOLConsole.Log("SBox=\n");
				//DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
				packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256);
				((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
				//DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
				//DOLConsole.Log("SBox=\n");
				//DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
			}
			else
			{
			  //Send the crypt key to the client
				client.Out.SendVersionAndCryptKey();
			}
		}
Beispiel #6
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            // e.g. 00 36 01 0B 03                                    .6...
            var rc4        = packet.ReadByte();
            var clientType = (byte)packet.ReadByte();

            client.ClientType   = clientType & 0x0F;
            client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
            var major = (byte)packet.ReadByte();
            var minor = (byte)packet.ReadByte();
            var build = (byte)packet.ReadByte();

            if (rc4 == 0)
            {
                // Send the plain version response
                client.Out.SendVersionAndCryptKey();

                /* not yet supported. encryption hacked & removed by connect.exe */
                //if (client.Version >= GameClient.eClientVersion.Version1110) {
                //    if (log.IsDebugEnabled)
                //        log.Debug("Switching to RSA encyption for '" + client + "'");

                //    var enc = (PacketEncoding1110)client.PacketProcessor.Encoding;
                //    enc.CryptMode = PacketEncoding1110.eCryptMode.RSA;
                //}
            }
            else if (rc4 == 1)
            {
                // RC4 was requested
                if (client.Version >= GameClient.eClientVersion.Version1110)
                {
                    var commonKey = new byte[packet.ReadByte()];
                    packet.Read(commonKey, 0, commonKey.Length);

                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Enabling RC4 for '" + client + "' (commonKey.size=" + commonKey.Length + ")");
                    }

                    var enc = (PacketEncoding1110)client.PacketProcessor.Encoding;
                    enc.CommonKey = commonKey;
                    enc.CryptMode = PacketEncoding1110.eCryptMode.RC4;
                    client.RegionServerUniqueId++; // rotate ID to cause re-sync
                }
                else
                {
                    log.Warn("Client '" + client + "' requested RC4, but we don't support encryption.");
                }
            }
            return(1);
        }