Exemple #1
0
        /// <summary>
        ///  This method starts off by sending a random string 10 characters
        ///  in length, known as the Server challenge key. This is used by
        ///  the client to return a client challenge key, which is used
        ///  to validate login information later.
        ///  </summary>
        public void SendServerChallenge()
        {
            // First we need to create a random string the length of 10 characters
            string buffer = "";

            rand = new Random((int)DateTime.Now.Ticks);
            for (int i = 0; i < 10; i++)
            {
                buffer += chars[rand.Next(chars.Length)];
            }

            // Next we send the client the challenge key
            serverChallengeKey = buffer;
            Stream.Write("\\lc\\1\\challenge\\{0}\\id\\1\\final\\", serverChallengeKey);
        }
Exemple #2
0
        /// <summary>
        /// This method is requested by the client whenever an accounts existance needs validated
        /// </summary>
        /// <param name="recv"></param>
        private void SendGPSP(string[] recv)
        {
            // Try to get user data from database
            try
            {
                ClientData = Server.Database.GetUser(GetParameterValue(recv, "email"), GetParameterValue(recv, "pass"));
            }
            catch
            {
                Dispose();
                return;
            }

            if (ClientData == null)
            {
                Stream.Write("\\nr\\{0}\\ndone\\\\final\\");
                return;
            }

            Stream.Write("\\nr\\1\\nick\\{0}\\uniquenick\\{1}\\ndone\\\\final\\",
                         (string)ClientData["name"], (string)ClientData["name"]
                         );
        }