Beispiel #1
0
        public BattlenetRpcErrorCode HandleLogon(Bgs.Protocol.Authentication.V1.LogonRequest logonRequest)
        {
            if (logonRequest.Program != "WoW")
            {
                Log.outDebug(LogFilter.Session, "Battlenet.LogonRequest: {0} attempted to log in with game other than WoW (using {1})!", GetClientInfo(), logonRequest.Program);
                return(BattlenetRpcErrorCode.BadProgram);
            }

            if (logonRequest.Platform != "Win" && logonRequest.Platform != "Wn64" && logonRequest.Platform != "Mc64")
            {
                Log.outDebug(LogFilter.Session, "Battlenet.LogonRequest: {0} attempted to log in from an unsupported platform (using {1})!", GetClientInfo(), logonRequest.Platform);
                return(BattlenetRpcErrorCode.BadPlatform);
            }

            if (logonRequest.Locale.ToEnum <LocaleConstant>() == LocaleConstant.enUS && logonRequest.Locale != "enUS")
            {
                Log.outDebug(LogFilter.Session, "Battlenet.LogonRequest: {0} attempted to log in with unsupported locale (using {1})!", GetClientInfo(), logonRequest.Locale);
                return(BattlenetRpcErrorCode.BadLocale);
            }

            _locale = logonRequest.Locale;
            _os     = logonRequest.Platform;
            _build  = (uint)logonRequest.ApplicationVersion;

            var endpoint = Global.SessionMgr.GetAddressForClient(GetRemoteIpAddress());

            ChallengeExternalRequest externalChallenge = new ChallengeExternalRequest();

            externalChallenge.PayloadType = "web_auth_url";

            externalChallenge.Payload = ByteString.CopyFromUtf8(string.Format("https://{0}:{1}/bnetserver/login/", endpoint.Address, endpoint.Port));
            SendRequest((uint)OriginalHash.ChallengeListener, 3, externalChallenge);
            return(BattlenetRpcErrorCode.Ok);
        }
        BattlenetRpcErrorCode HandleLogon(LogonRequest logonRequest, NoData response)
        {
            if (logonRequest.Program != "WoW")
            {
                Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in with game other than WoW (using {logonRequest.Program})!");
                return(BattlenetRpcErrorCode.BadProgram);
            }

            if (logonRequest.Platform != "Win" && logonRequest.Platform != "Wn64" && logonRequest.Platform != "Mc64")
            {
                Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in from an unsupported platform (using {logonRequest.Platform})!");
                return(BattlenetRpcErrorCode.BadPlatform);
            }

            if (!SharedConst.IsValidLocale(logonRequest.Locale.ToEnum <Locale>()))
            {
                Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in with unsupported locale (using {logonRequest.Locale})!");
                return(BattlenetRpcErrorCode.BadLocale);
            }

            locale = logonRequest.Locale;
            os     = logonRequest.Platform;
            build  = (uint)logonRequest.ApplicationVersion;

            var endpoint = Global.LoginServiceMgr.GetAddressForClient(GetRemoteIpEndPoint().Address);

            ChallengeExternalRequest externalChallenge = new ChallengeExternalRequest();

            externalChallenge.PayloadType = "web_auth_url";
            externalChallenge.Payload     = ByteString.CopyFromUtf8($"https://{endpoint.Address}:{endpoint.Port}/bnetserver/login/");

            SendRequest((uint)OriginalHash.ChallengeListener, 3, externalChallenge);
            return(BattlenetRpcErrorCode.Ok);
        }
Beispiel #3
0
    private void OnExternalChallengeCallback(RPCContext context)
    {
        ChallengeExternalRequest request = ChallengeExternalRequest.ParseFrom(context.Payload);

        if (!request.IsInitialized || !request.HasPayload)
        {
            object[] args = new object[] { request.IsInitialized, request.HasRequestToken, request.HasPayload, request.HasPayloadType };
            base.ApiLog.LogWarning("Bad ChallengeExternalRequest received IsInitialized={0} HasRequestToken={1} HasPayload={2} HasPayloadType={3}", args);
        }
        else if (request.PayloadType != "web_auth_url")
        {
            object[] objArray2 = new object[] { request.PayloadType };
            base.ApiLog.LogWarning("Received a PayloadType we don't know how to handle PayloadType={0}", objArray2);
        }
        else
        {
            ExternalChallenge challenge = new ExternalChallenge {
                PayLoadType = request.PayloadType,
                URL         = Encoding.ASCII.GetString(request.Payload)
            };
            object[] objArray3 = new object[] { challenge.PayLoadType, challenge.URL };
            base.ApiLog.LogDebug("Received external challenge PayLoadType={0} URL={1}", objArray3);
            if (this.m_nextExternalChallenge == null)
            {
                this.m_nextExternalChallenge = challenge;
            }
            else
            {
                this.m_nextExternalChallenge.Next = challenge;
            }
        }
    }
        public static async void HandleLogonRequest(LogonRequest logonRequest, BnetSession session)
        {
            // TODO: Implement version checks, etc.
            //if (DB.Auth.Any<Application>(a => a.Program == logonRequest.Program))
            {
                var challengeExternalRequest = new ChallengeExternalRequest
                {
                    PayloadType = "web_auth_url",
                    Payload = ByteString.CopyFromUtf8($"https://{BnetConfig.BnetChallengeHost}:{BnetConfig.BnetChallengeBindPort}/login/{session.Guid}")
                };

                await session.Send(challengeExternalRequest, BnetServiceHash.AuthenticationClientService, 3);
            }
        }
        public static async void HandleLogonRequest(LogonRequest logonRequest, BnetSession session)
        {
            // TODO: Implement version checks, etc.
            //if (DB.Auth.Any<Application>(a => a.Program == logonRequest.Program))
            {
                var challengeExternalRequest = new ChallengeExternalRequest
                {
                    PayloadType = "web_auth_url",
                    Payload     = ByteString.CopyFromUtf8($"https://{BnetConfig.BnetChallengeHost}:{BnetConfig.BnetChallengeBindPort}/login/{session.Guid}")
                };

                await session.Send(challengeExternalRequest, BnetServiceHash.AuthenticationClientService, 3);
            }
        }
        public static void HandleConnectRequest(AuthSession session, LogonRequest logonRequest)
        {
            if (logonRequest.WebClientVerification)
            {
                while (true)
                {
IL_98:
                    uint arg_78_0 = 2859478583u;
                    while (true)
                    {
                        uint num;
                        switch ((num = (arg_78_0 ^ 2148169041u)) % 5u)
                        {
                        case 0u:
                            goto IL_98;

                        case 2u:
                        {
                            ChallengeExternalRequest challengeExternalRequest = new ChallengeExternalRequest();
                            challengeExternalRequest.PayloadType = Module.smethod_36 <string>(573305427u);
                            arg_78_0 = (num * 4022609958u ^ 1698604317u);
                            continue;
                        }

                        case 3u:
                        {
                            ChallengeExternalRequest challengeExternalRequest;
                            challengeExternalRequest.Payload = ByteString.CopyFromUtf8(Module.smethod_33 <string>(4154950356u));
                            arg_78_0 = (num * 836868245u ^ 2968312731u);
                            continue;
                        }

                        case 4u:
                        {
                            ChallengeExternalRequest challengeExternalRequest;
                            session.Send(challengeExternalRequest, 3151632159u, 3u);
                            arg_78_0 = (num * 950688502u ^ 1062584357u);
                            continue;
                        }
                        }
                        goto Block_2;
                    }
                }
                Block_2 :;
            }
        }
Beispiel #7
0
        public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
        {
            switch (methodId)
            {
            case 3:
            {
                ChallengeExternalRequest request = new ChallengeExternalRequest();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnExternalChallenge(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnExternalChallenge(bgs.protocol.challenge.v1.ChallengeExternalRequest: {1} status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 4:
            {
                ChallengeExternalResult request = new ChallengeExternalResult();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnExternalChallengeResult(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnExternalChallengeResult(bgs.protocol.challenge.v1.ChallengeExternalResult: {1} status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            default:
                Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
                SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
                break;
            }
        }
        private void OnExternalChallengeCallback(RPCContext context)
        {
            ChallengeExternalRequest challengeExternalRequest = ChallengeExternalRequest.ParseFrom(context.Payload);

            if (!challengeExternalRequest.IsInitialized || !challengeExternalRequest.HasPayload)
            {
                base.ApiLog.LogWarning("Bad ChallengeExternalRequest received IsInitialized={0} HasRequestToken={1} HasPayload={2} HasPayloadType={3}", new object[]
                {
                    challengeExternalRequest.IsInitialized,
                    challengeExternalRequest.HasRequestToken,
                    challengeExternalRequest.HasPayload,
                    challengeExternalRequest.HasPayloadType
                });
                return;
            }
            if (challengeExternalRequest.PayloadType != "web_auth_url")
            {
                base.ApiLog.LogWarning("Received a PayloadType we don't know how to handle PayloadType={0}", new object[]
                {
                    challengeExternalRequest.PayloadType
                });
                return;
            }
            ExternalChallenge externalChallenge = new ExternalChallenge();

            externalChallenge.PayLoadType = challengeExternalRequest.PayloadType;
            externalChallenge.URL         = Encoding.ASCII.GetString(challengeExternalRequest.Payload);
            base.ApiLog.LogDebug("Received external challenge PayLoadType={0} URL={1}", new object[]
            {
                externalChallenge.PayLoadType,
                externalChallenge.URL
            });
            if (this.m_nextExternalChallenge == null)
            {
                this.m_nextExternalChallenge = externalChallenge;
            }
            else
            {
                this.m_nextExternalChallenge.Next = externalChallenge;
            }
        }
 BattlenetRpcErrorCode HandleOnExternalChallenge(ChallengeExternalRequest request)
 {
     Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeListener.OnExternalChallenge: {1}",
                  GetCallerInfo(), request.ToString());
     return(BattlenetRpcErrorCode.RpcNotImplemented);
 }