Ejemplo n.º 1
0
 public void WriteModuleHeader(Client client, AuthPacket packet, Module module, int size = 0)
 {
     packet.WriteFourCC(module.Type);
     packet.WriteFourCC("\0\0" + Enum.GetName(typeof(Region), client.Session.Account.Region));
     packet.Write(module.Hash.ToByteArray());
     packet.Write(size == 0 ? module.Size : (uint)size, 10);
 }
Ejemplo n.º 2
0
        public void Write(AuthPacket packet)
        {
            packet.WriteFourCC(Data.Type);
            packet.WriteFourCC("\0\0" + Enum.GetName(typeof(Region), AccountRegion));
            packet.Write(Data.Hash.ToByteArray());
            packet.Write(Size == 0 ? Data.Size : Size, 10);

            WriteData(packet);
        }
Ejemplo n.º 3
0
        public static void SendProofVerification(AuthSession session, byte[] clientChallenge)
        {
            var proofVerification = new AuthPacket(AuthServerMessage.ProofRequest);

            proofVerification.Write(2, 3);

            session.Modules.ForEach(module =>
            {
                var moduleStart = module.Hash.Substring(0, 2);

                switch (moduleStart)
                {
                case "2e":
                case "85":
                case "20":
                    proofVerification.WriteFourCC("auth");
                    proofVerification.WriteFourCC("\0\0EU");
                    proofVerification.Write(module.Hash.ToByteArray());
                    proofVerification.Write(161, 10);

                    // Flush & write the state id
                    proofVerification.Flush();
                    proofVerification.Write(3, 8);

                    proofVerification.Write(session.SecureRemotePassword.ServerM);
                    proofVerification.Write(session.SecureRemotePassword.S2);

                    break;

                case "5e":
                case "8c":
                case "1a":
                    proofVerification.WriteFourCC("auth");
                    proofVerification.WriteFourCC("\0\0EU");
                    proofVerification.Write(module.Hash.ToByteArray());
                    proofVerification.Write(module.Size, 10);

                    break;

                default:
                    Log.Message(LogType.Error, "Module '{0}' not used in this state", moduleStart);
                    break;
                }
            });

            session.Send(proofVerification);
        }
Ejemplo n.º 4
0
        public static void SendProofRequest(AuthSession session)
        {
            // Default modules are Win64
            session.Modules = Manager.Modules.Module64List;

            // Switch module list for different systems
            if (session.Account.OS == "Win")
            {
                session.Modules = Manager.Modules.ModuleList;
            }
            else if (session.Account.OS == "Mc64")
            {
                session.Modules = Manager.Modules.ModuleMacList;
            }

            var proofRequest = new AuthPacket(AuthServerMessage.ProofRequest);

            proofRequest.Write(2, 3);

            session.Modules.ForEach(module =>
            {
                var moduleStart = module.Hash.Substring(0, 2);

                switch (moduleStart)
                {
                case "36":
                case "c3":
                case "b3":
                    proofRequest.WriteFourCC("auth");
                    proofRequest.WriteFourCC("\0\0EU");
                    proofRequest.Write(module.Hash.ToByteArray());
                    proofRequest.Write(module.Size, 10);

                    proofRequest.Write(module.Data.ToByteArray());

                    break;

                case "2e":
                case "85":
                case "20":
                    session.SecureRemotePassword = new SRP6a(session.Account.Salt, session.Account.Email, session.Account.PasswordVerifier);
                    session.SecureRemotePassword.CalculateB();

                    proofRequest.WriteFourCC("auth");
                    proofRequest.WriteFourCC("\0\0EU");
                    proofRequest.Write(module.Hash.ToByteArray());
                    proofRequest.Write(module.Size, 10);

                    // Flush & write the state id
                    proofRequest.Flush();
                    proofRequest.Write(0, 8);

                    proofRequest.Write(session.SecureRemotePassword.I);
                    proofRequest.Write(session.SecureRemotePassword.S);
                    proofRequest.Write(session.SecureRemotePassword.B);
                    proofRequest.Write(session.SecureRemotePassword.S2);

                    break;

                default:
                    Log.Message(LogType.Error, "Module '{0}' not used in this state", moduleStart);
                    break;
                }
            });

            session.Send(proofRequest);
        }