Exemple #1
0
 public static bool _AuthenticateOnly(NetObject NetObj)
 {
     #region VerifyPass
     if (NetObj.UserObject.IsUtilityUser())
     {
         //Password Auth not applicable to non-clients.
         return(true);
     }
     NetObj.ClientObject.SendMessage("Password Authentication Mode Initialised.");
     NetObj.ClientObject.SendMessage("Please Enter Your Password: "******"Still waiting for a response for the Password Authentication Module.");
             NetObj.ClientObject.SendMessage("Please Enter a Password, or you will be disconnected in 30 Seconds.");
             NetObj.TextWaiters.Add(WaitForMessage);
             NetObj.ClientObject.GetChatPacketBeforeLoginStarter();
             if (!WaitForMessage.WaitOne(30000))
             {
                 NetObj.ClientObject.SendMessage("No Response for the Password Authentication Module. You have been disconnected.");
                 NetObj.TextWaiters.RemoveAll(x => x == WaitForMessage);
                 return(false);
             }
         }
         string ThisMessage = NetObj.TextInput;
         if (ThisMessage.ToUpper() == "/EXIT")
         {
             NetObj.ClientObject.SendMessage("Leaving the Password Authentication Mode...");
             return(false);
         }
         if (SaltGenerator.Encrypt(ThisMessage) == NetObj.UserObject.Password || ThisMessage == NetObj.UserObject.Password && NetObj.UserObject.Password == "")
         {
             NetObj.ClientObject.SendMessage("Password Correct, You are now logged in.");
             NetObj.ClientObject.SendMessage("\n\n\n\n\n\n\n\n\n\n");
             return(true);
         }
         else
         {
             NetObj.ClientObject.ComplexTaskWaiter();
             Thread.Sleep(1000); //This is to stop brute force bots from breaking or lagging the server out!
             NetObj.ClientObject.ComplexTaskComplete.Set();
             NetObj.ClientObject.SendMessage("Password incorrect, Please Try Again.");
         }
     }
     #endregion
 }
Exemple #2
0
        public static bool NewSaltGenerated = false; //if changed to true, ALL passwords in the database will be removed!

        public static void LoadSalt()
        {
            if (File.Exists("Orb.DLL"))
            {
                Logger.Console.WriteLine("&5    Salt Loaded.");
                PasswordSalt = Assembly.LoadFrom("Orb.dll").GetType("Database").GetField("PasswordSalt").GetValue(null).ToString();
            }
            else
            {
                Logger.Console.WriteLine("&d    Orb.DLL Not Found: New Salt Generated.");
                PasswordSalt     = SaltGenerator.NewSalt();
                NewSaltGenerated = true;
            }
        }
Exemple #3
0
        public static bool Orb_Command_Maintenence_User_Password_Change_Method(Server.NetObject NetObj, CommandReader Command)
        {
            if (NetObj.UserObject.IsUtilityUser())
            {
                NetObj.ClientObject.SendMessage("This Command is not availabile from the Server Console.");
                return(false);
            }
            NetObj.ClientObject.SendMessage("Password Change Mode Initialised. Please type \"/EXIT\" at any time to exit this interface.");
            if (NetObj.UserObject.Password == "")
            {
                NetObj.ClientObject.SendMessage("You do not have a password set at the moment.");
            }
            else
            {
                #region OldPass
                NetObj.ClientObject.SendMessage("Please Verify Your Old Password: "******"Still waiting for a response for the Password Changing Module.");
                        NetObj.ClientObject.SendMessage("Please Enter a Password, or type \"/EXIT\" to leave the Module.");
                        NetObj.ClientObject.SendMessage("You will be automatically removed in 30 Seconds.");
                        if (!WaitForMessage.WaitOne(30000))
                        {
                            NetObj.ClientObject.SendMessage("Leaving the Password Changing Module...");
                            NetObj.TextWaiters.RemoveAll(x => x == WaitForMessage);
                            return(false);
                        }
                    }
                    string ThisMessage = NetObj.TextInput;
                    if (ThisMessage.ToUpper() == "/EXIT")
                    {
                        NetObj.ClientObject.SendMessage("Leaving the Password Change Mode...");
                        return(false);
                    }
                    if (SaltGenerator.Encrypt(ThisMessage) == NetObj.UserObject.Password)
                    {
                        break;
                    }
                    else
                    {
                        Thread.Sleep(1000); //This is to stop brute force bots from breaking or lagging the server out!
                        NetObj.ClientObject.SendMessage("Password incorrect.");
                        NetObj.ClientObject.SendMessage("Leaving the Password Change Mode...");
                        return(false);
                    }
                }
                #endregion
            }
            string NewPass = "";
            #region NewPass1
            NetObj.ClientObject.SendMessage("Please Enter Your New Password: "******"Still waiting for a response for the Password Changing Module.");
                    NetObj.ClientObject.SendMessage("Please Enter a Password, or type \"/EXIT\" to leave the Module.");
                    NetObj.ClientObject.SendMessage("You will be automatically removed in 30 Seconds.");
                    if (!WaitForMessage.WaitOne(30000))
                    {
                        NetObj.ClientObject.SendMessage("Leaving the Password Changing Module...");
                        NetObj.TextWaiters.RemoveAll(x => x == WaitForMessage);
                        return(false);
                    }
                }
                string ThisMessage = NetObj.TextInput;
                if (ThisMessage.ToUpper() == "/EXIT")
                {
                    NetObj.ClientObject.SendMessage("Leaving the Password Change Mode...");
                    return(false);
                }
                if (ThisMessage == "")
                {
                    NewPass = "";
                }
                else
                {
                    NewPass = SaltGenerator.Encrypt(ThisMessage);
                }
                break;
            }
            #endregion
            #region NewPass2
            NetObj.ClientObject.SendMessage("Please Verify Your New Password: "******"Still waiting for a response for the Password Changing Module.");
                    NetObj.ClientObject.SendMessage("Please Enter a Password, or type \"/EXIT\" to leave the Module.");
                    NetObj.ClientObject.SendMessage("You will be automatically removed in 30 Seconds.");
                    if (!WaitForMessage.WaitOne(30000))
                    {
                        NetObj.ClientObject.SendMessage("Leaving the Password Changing Module...");
                        NetObj.TextWaiters.RemoveAll(x => x == WaitForMessage);
                        return(false);
                    }
                }
                string ThisMessage = NetObj.TextInput;
                if (ThisMessage.ToUpper() == "/EXIT")
                {
                    NetObj.ClientObject.SendMessage("Leaving the Password Change Mode...");
                    return(false);
                }
                if (ThisMessage == "" && NewPass == "")
                {
                    NetObj.UserObject.Password = "";
                    break;
                }
                else if (SaltGenerator.Encrypt(ThisMessage).ToUpper() == NewPass.ToUpper())
                {
                    NetObj.UserObject.Password = SaltGenerator.Encrypt(ThisMessage);
                    break;
                }
                else
                {
                    NetObj.ClientObject.SendMessage("Passwords do not match.");
                    NetObj.ClientObject.SendMessage("Leaving the Password Change Mode...");
                    return(false);
                }
            }
            #endregion
            #region PasswordUpdated
            NetObj.UserObject.SaveAll();
            NetObj.ClientObject.SendMessage("Your password has been changed successfully.");
            if (!NetObj.UserObject.UsePassword)
            {
                NetObj.ClientObject.SendMessage("Remember to use \"/ENABLEPASSWORD\" to allow password authentication fallback!");
            }
            NetObj.ClientObject.SendMessage("Leaving the Password Changing Module...");
            return(true);

            #endregion
        }