Esempio n. 1
0
        public int HandlePacket(BaseClient bcclient, PacketIn packet)
        {
            LobbyClient client = bcclient as LobbyClient;

            packet.Skip(25);
            string Username = packet.GetParsedString();

            Log.Notice("ASK_LOGIN", "Account: " + Username);
            try
            {
                client.Account = Databases.AccountTable.SingleOrDefault(a => a.Username == Username);
                if (client.Account.Verifier.Length <= 2 || client.Account.Salt.Length <= 2)
                {
                    Register(client);
                }
                client.Salt     = new FrameWork.NetWork.Crypto.BigInteger(client.Account.Salt, 16).ToByteArrayUnsigned();
                client.Verifier = new FrameWork.NetWork.Crypto.BigInteger(client.Account.Verifier, 16);
                Log.Succes("ASK_LOGIN", "Account exists: " + client.Account.Username);
                LOGIN_SALT.Send(client);
            }
            catch (ArgumentNullException)
            {
                Log.Error("ASK_LOGIN", "Database is busy");
                LOGIN_FAILED.Send(client, (int)ResponseCodes.RC_DATABASE_BUSY);
                client.Disconnect();
            }
            catch (Exception e)
            {
                Log.Error("ASK_LOGIN", "Account is not found");
                Log.Debug("ASK_LOGIN", e.ToString());
                LOGIN_FAILED.Send(client, (int)ResponseCodes.RC_LOGIN_INVALID_ACCOUNT);
                client.Disconnect();
            }
            return(0);
        }
Esempio n. 2
0
        public int HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = client as LobbyClient;

            byte[] clientModulus = new byte[64];
            for (int i = 0; i < 64; ++i)
            {
                clientModulus[i] = packet.GetUint8();
            }
            cclient.clientModulus = new FrameWork.NetWork.Crypto.BigInteger(1, clientModulus);
            ushort unk = packet.GetUint16();

            byte[] Proof = new byte[20];
            for (int i = 0; i < 20; ++i)
            {
                Proof[i] = packet.GetUint8();
            }
            cclient.Proof = Proof;
            if (IsBanned(cclient))
            {
                LOGIN_FAILED.Send(cclient, (int)ResponseCodes.RC_LOGIN_ACCOUNT_BLOCKED);
                cclient.Disconnect();
            }
            else
            {
                if (IsValid(cclient))
                {
                    LOGIN_SUCCES.Send(cclient);
                    cclient.ECrypt = new Encryption(cclient.SessionId);
                    CHARACTER_LIST.Send(cclient);
                }
                else
                {
                    LOGIN_FAILED.Send(cclient, (int)ResponseCodes.RC_LOGIN_INVALID_ACCOUNT);
                    cclient.Disconnect();
                }
            }
            return(0);
        }