コード例 #1
0
ファイル: Auth.cs プロジェクト: kkjjgithub/mCPPS-UWP
        protected override async Task HandleLogin(Penguin penguin, string packet)
        {
            if (penguin.LoginStep != "Randkey")
            {
                await RemovePenguin(penguin);

                return;
            }

            XmlDocument login_xml = new XmlDocument();

            login_xml.LoadXml(packet);

            string username, password, dbpassword, dbpassword_encrypted;

            username = login_xml.GetElementsByTagName("nick")[0].InnerText;
            password = login_xml.GetElementsByTagName("pword")[0].InnerText;

            if (!await Database.UsernameExists(username))
            {
                // await penguin.Send("%xt%e%-1%100%");
                // await RemovePenguin(penguin);
                await penguin.Send("%xt%gs%-1%65.184.60.189:6113:mCPPS:4%");

                await penguin.Send("%xt%l%-1%1%97debb64dcb0b0f1598f605318bc28fc%0%");

                return;
            }

            Crypt2 crypt = new Crypt2();

            dbpassword = (string)await Database.GetColumnFromUsername(username, "Password");

            dbpassword_encrypted = GetAuthenticationHash(dbpassword, penguin.Randkey);

            if (!crypt.BCryptVerify(password, dbpassword))
            {
                await penguin.Send("%xt%e%-1%101%");

                return;
            }
        }
コード例 #2
0
        private async Task HandlePolicy(Penguin penguin)
        {
            if (penguin.LoginStep == null)
            {
                await penguin.Send("<cross-domain-policy><allow-access-from domain='*' to-ports='*' /></cross-domain-policy>");

                return;
            }

            await RemovePenguin(penguin);
        }
コード例 #3
0
        private async Task HandleRandomKey(Penguin penguin)
        {
            if (penguin.LoginStep == "Versioncheck")
            {
                penguin.Randkey = "e4a2dbcca10a7246817a83cdmCPPS";
                await penguin.Send("<msg t='sys'><body action='rndK' r='-1'><k>" + penguin.Randkey + "</k></body></msg>");

                penguin.LoginStep = "Randkey";
                return;
            }
            await RemovePenguin(penguin);
        }
コード例 #4
0
        private async Task HandleVersionCheck(Penguin penguin)
        {
            await penguin.Send("<msg t='sys'><body action='apiOK' r='0'></body></msg>");

            penguin.LoginStep = "Versioncheck";
        }