Exemplo n.º 1
0
 internal virtual void Decrypt()
 {
     Decr.AddRange(Payload);
     if (Identifier != 10100)
     {
         EncryptedPayload = Decr.ToArray();
         RC4.Decrypt(ref EncryptedPayload);
     }
 }
Exemplo n.º 2
0
        internal void Process()
        {
            switch (Identifier)
            {
            case 10100:
                _handler.Send(PacketBuilder2(20103, 4, LoginFailed.Payload(Constants.LoginFailed.Error.Default)));
                break;

            case 10101:
                Console.WriteLine(BitConverter.ToString(Payload).Replace("-", ""));
                var ToProcess = LoginOk.Array();
                _handler.Send(PacketBuilder(20104, 1, ToProcess));
                // var ToProcess2 = OwnHomeData.OwnHomeDataArray();
                // _handler.Send(PacketBuilder(24101, 1, ToProcess2));
                var ToProcess2 = SectorState.Array();
                _handler.Send(PacketBuilder(21903, 1, ToProcess2));
                Logger.Log($"We Sent SectorState", Logger.DefCon.DEBUGSERVER);
                break;

            case 10108:
                var ToProcess3 = KeepAliveOk.Array();
                _handler.Send(PacketBuilder(20108, 1, ToProcess3));
                Logger.Log($"We Sent KeepAliveOk", Logger.DefCon.DEBUGSERVER);
                break;

            case 14104:
                var ToProcess4 = SectorState.Array();
                _handler.Send(PacketBuilder(21903, 1, ToProcess4));
                Logger.Log($"We Sent SectorState", Logger.DefCon.DEBUGSERVER);
                break;

            case 14101:
                var ToProcess5 = OwnHomeData.OwnHomeDataArray();
                _handler.Send(PacketBuilder(24101, 1, ToProcess5));
                Logger.Log($"We Sent OwnHomeData", Logger.DefCon.DEBUGSERVER);
                break;

            case 14102:
                Console.WriteLine("Before : " + BitConverter.ToString(Payload).Replace("-", ""));
                RC4.Decrypt(ref Payload);
                Console.WriteLine("After : " + BitConverter.ToString(Payload).Replace("-", ""));

                /* var EndClientTurnMessage = Payload;
                 *
                 * int Tick;
                 * int Checksum;
                 * int Count;
                 *
                 * byte[] Commands;
                 *
                 * /// Begin Reading the ECT payload.
                 * using (var Reader = new Reader(Payload))
                 * {
                 *   Tick = Reader.ReadVInt();
                 *   Checksum = Reader.ReadVInt();
                 *   Count = Reader.ReadVInt();
                 *
                 *   Commands = Reader.ReadBytes((int)(Reader.BaseStream.Length - Reader.BaseStream.Position));
                 * }
                 *
                 * Console.WriteLine("Tick: " + Tick);
                 * Console.WriteLine("Checksum: " + Checksum);
                 * Console.WriteLine("Count: " + Count);
                 *
                 * if (Count > -1 && Count <= 50)
                 *    using (var Reader = new Reader(Commands))
                 *    {
                 *       for (var i = 0; i < Count; i++)
                 *       {
                 *            var CommandID = Reader.ReadVInt();
                 *
                 *           Console.WriteLine("Waiting to handle " + CommandID);
                 *        }
                 *   }*/
                break;

            case 10905:
                var ToProcess6 = InBoxData.Payload();
                _handler.Send(PacketBuilder(24445, 1, ToProcess6));
                break;

            case 14302:
                var ToProcess8 = AllianceData.Payload();
                _handler.Send(PacketBuilder(24301, 1, ToProcess8));
                break;

            default:
                Logger.Log($"Packet {Identifier} has not been handled!", Logger.DefCon.WARN);
                break;
            }
        }
Exemplo n.º 3
0
 public static byte[] Decrypt(byte[] payload)
 {
     byte[] Decrypted = payload;
     RC4Core.Decrypt(ref Decrypted);
     return(Decrypted);
 }