Esempio n. 1
0
        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;
            }
        }