Esempio n. 1
0
        public BanCheck(IConfigSource source, IUserAccountService UserAccountService)
        {
            IConfig config = source.Configs["GrieferProtection"];

            if (config == null)
            {
                return;
            }

            m_enabled = config.GetBoolean("Enabled", true);

            if (!m_enabled)
            {
                return;
            }

            string bannedViewers = config.GetString("ViewersToBan", "");

            m_bannedViewers = Util.ConvertToList(bannedViewers);
            string allowedViewers = config.GetString("ViewersToAllow", "");

            m_allowedViewers = Util.ConvertToList(allowedViewers);
            m_useIncludeList = config.GetBoolean("UseAllowListInsteadOfBanList", false);

            m_checkOnLogin = config.GetBoolean("CheckForSimilaritiesOnLogin", m_checkOnLogin);
            m_checkOnTimer = config.GetBoolean("CheckForSimilaritiesOnTimer", m_checkOnTimer);
            TimerMinutes   = config.GetInt("MinutesForTimerToCheck", TimerMinutes);

            if (m_checkOnTimer)
            {
                System.Timers.Timer timer = new System.Timers.Timer(TimerMinutes * 1000 * 60);
                timer.Elapsed += new System.Timers.ElapsedEventHandler(CheckOnTimer);
                timer.Start();
            }

            GrieferAllowLevel = (AllowLevel)Enum.Parse(typeof(AllowLevel), config.GetString("GrieferAllowLevel", "AllowKnown"));

            presenceInfo     = Aurora.DataManager.DataManager.RequestPlugin <IPresenceInfo> ();
            m_accountService = UserAccountService;

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand(
                    "UserInfo", "UserInfo [UUID] or [First] [Last]", "Info on a given user", UserInfo);
                MainConsole.Instance.Commands.AddCommand(
                    "SetUserInfo", "SetUserInfo [UUID] or [First] [Last] [Flags]", "Sets the info of the given user [Flags]: Clean, Suspected, Known, Banned", SetUserInfo);
                MainConsole.Instance.Commands.AddCommand(
                    "block user", "block user [UUID] or [Name]", "Blocks a given user from connecting anymore", BlockUser);
                MainConsole.Instance.Commands.AddCommand(
                    "ban user", "ban user [UUID] or [Name]", "Blocks a given user from connecting anymore", BlockUser);
                MainConsole.Instance.Commands.AddCommand(
                    "unblock user", "unblock user [UUID] or [Name]", "Removes the block for logging in on a given user", UnBlockUser);
                MainConsole.Instance.Commands.AddCommand(
                    "unban user", "unban user [UUID] or [Name]", "Removes the block for logging in on a given user", UnBlockUser);
            }
        }
Esempio n. 2
0
        public BanCheck(IConfigSource source, IUserAccountService UserAccountService)
        {
            IConfig config = source.Configs["GrieferProtection"];

            if (config == null)
            {
                return;
            }

            m_enabled = config.GetBoolean("Enabled", true);

            if (!m_enabled)
            {
                return;
            }

            string bannedViewers = config.GetString("ViewersToBan", "");

            m_bannedViewers = Util.ConvertToList(bannedViewers, false);
            string allowedViewers = config.GetString("ViewersToAllow", "");

            m_allowedViewers = Util.ConvertToList(allowedViewers, false);
            m_useIncludeList = config.GetBoolean("UseAllowListInsteadOfBanList", false);

            m_checkOnLogin = config.GetBoolean("CheckForSimilaritiesOnLogin", m_checkOnLogin);
            m_checkOnTimer = config.GetBoolean("CheckForSimilaritiesOnTimer", m_checkOnTimer);

            if (m_checkOnTimer)
            {
                _checkForSimilaritiesLater.Start(5, CheckForSimilaritiesMultiple);
            }

            GrieferAllowLevel =
                (AllowLevel)Enum.Parse(typeof(AllowLevel), config.GetString("GrieferAllowLevel", "AllowKnown"));

            presenceInfo     = Framework.Utilities.DataManager.RequestPlugin <IPresenceInfo>();
            m_accountService = UserAccountService;

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand(
                    "show user info", "show user info", "Info on a given user", UserInfo, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "set user info", "set user info", "Sets the info of the given user", SetUserInfo, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "block user", "block user", "Blocks a given user from connecting anymore", BlockUser, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "ban user", "ban user", "Blocks a given user from connecting anymore", BlockUser, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "unblock user", "unblock user", "Removes the block for logging in on a given user", UnBlockUser, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "unban user", "unban user", "Removes the block for logging in on a given user", UnBlockUser, false, true);
            }
        }
Esempio n. 3
0
        public BanCheck(IConfigSource source, IUserAccountService userAccountService)
        {
            IConfig config = source.Configs ["GrieferProtection"];

            if (config == null)
            {
                return;
            }

            m_enabled = config.GetBoolean("Enabled", true);

            if (!m_enabled)
            {
                return;
            }

            string bannedViewers = config.GetString("ViewersToBan", "");

            m_bannedViewers = Util.ConvertToList(bannedViewers, false);
            string allowedViewers = config.GetString("ViewersToAllow", "");

            m_allowedViewers = Util.ConvertToList(allowedViewers, false);
            m_useIncludeList = config.GetBoolean("UseAllowListInsteadOfBanList", false);
            m_debug          = config.GetBoolean("UserCheckDebugInfo", false);

            m_checkOnLogin = config.GetBoolean("CheckForSimilaritiesOnLogin", m_checkOnLogin);
            m_checkOnTimer = config.GetBoolean("CheckForSimilaritiesOnTimer", m_checkOnTimer);

            if (m_checkOnTimer)
            {
                _checkForSimilaritiesLater.Start(5, CheckForSimilaritiesMultiple);
            }

            GrieferAllowLevel =
                (AllowLevel)Enum.Parse(typeof(AllowLevel), config.GetString("GrieferAllowLevel", "AllowKnown"));

            presenceInfo     = Framework.Utilities.DataManager.RequestPlugin <IPresenceInfo> ();
            m_accountService = userAccountService;

            if (m_accountService.IsLocalConnector)
            {
                AddCommands();                      // only add if we are local
            }
        }
Esempio n. 4
0
        public BanCheck (IConfigSource source, IUserAccountService userAccountService)
        {
            IConfig config = source.Configs ["GrieferProtection"];
            if (config == null)
                return;

            m_enabled = config.GetBoolean ("Enabled", true);

            if (!m_enabled)
                return;

            string bannedViewers = config.GetString ("ViewersToBan", "");
            m_bannedViewers = Util.ConvertToList (bannedViewers, false);
            string allowedViewers = config.GetString ("ViewersToAllow", "");
            m_allowedViewers = Util.ConvertToList (allowedViewers, false);
            m_useIncludeList = config.GetBoolean ("UseAllowListInsteadOfBanList", false);
            m_debug = config.GetBoolean ("UserCheckDebugInfo", false);

            m_checkOnLogin = config.GetBoolean ("CheckForSimilaritiesOnLogin", m_checkOnLogin);
            m_checkOnTimer = config.GetBoolean ("CheckForSimilaritiesOnTimer", m_checkOnTimer);

            if (m_checkOnTimer)
                _checkForSimilaritiesLater.Start (5, CheckForSimilaritiesMultiple);

            GrieferAllowLevel =
                (AllowLevel)Enum.Parse (typeof (AllowLevel), config.GetString ("GrieferAllowLevel", "AllowKnown"));

            presenceInfo = Framework.Utilities.DataManager.RequestPlugin<IPresenceInfo> ();
            m_accountService = userAccountService;

            if (m_accountService.IsLocalConnector)
                AddCommands ();                     // only add if we are local
        }
Esempio n. 5
0
        public BanCheck (IConfigSource source, IUserAccountService UserAccountService)
        {
            IConfig config = source.Configs["GrieferProtection"];
            if (config == null)
                return;

            m_enabled = config.GetBoolean ("Enabled", true);

            if (!m_enabled)
                return;

            string bannedViewers = config.GetString("ViewersToBan", "");
            m_bannedViewers = Util.ConvertToList(bannedViewers);
            string allowedViewers = config.GetString("ViewersToAllow", "");
            m_allowedViewers = Util.ConvertToList(allowedViewers);
            m_useIncludeList = config.GetBoolean("UseAllowListInsteadOfBanList", false);

            m_checkOnLogin = config.GetBoolean ("CheckForSimilaritiesOnLogin", m_checkOnLogin);
            m_checkOnTimer = config.GetBoolean ("CheckForSimilaritiesOnTimer", m_checkOnTimer);
            TimerMinutes = config.GetInt ("MinutesForTimerToCheck", TimerMinutes);

            if (m_checkOnTimer)
            {
                System.Timers.Timer timer = new System.Timers.Timer (TimerMinutes * 1000 * 60);
                timer.Elapsed += new System.Timers.ElapsedEventHandler (CheckOnTimer);
                timer.Start ();
            }

            GrieferAllowLevel = (AllowLevel)Enum.Parse (typeof (AllowLevel), config.GetString ("GrieferAllowLevel", "AllowKnown"));

            presenceInfo = Aurora.DataManager.DataManager.RequestPlugin<IPresenceInfo> ();
            m_accountService = UserAccountService;

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand(
                    "UserInfo", "UserInfo [UUID] or [First] [Last]", "Info on a given user", UserInfo);
                MainConsole.Instance.Commands.AddCommand(
                    "SetUserInfo", "SetUserInfo [UUID] or [First] [Last] [Flags]", "Sets the info of the given user [Flags]: Clean, Suspected, Known, Banned", SetUserInfo);
                MainConsole.Instance.Commands.AddCommand(
                    "block user", "block [UUID] or [Name]", "Blocks a given user from connecting anymore", BlockUser);
                MainConsole.Instance.Commands.AddCommand(
                    "unblock user", "unblock [UUID] or [Name]", "Removes the block for logging in on a given user", UnBlockUser);
            }
        }
Esempio n. 6
0
        public BanCheck(IConfigSource source, IUserAccountService UserAccountService)
        {
            IConfig config = source.Configs["GrieferProtection"];
            if (config == null)
                return;

            m_enabled = config.GetBoolean("Enabled", true);

            if (!m_enabled)
                return;

            string bannedViewers = config.GetString("ViewersToBan", "");
            m_bannedViewers = Util.ConvertToList(bannedViewers, false);
            string allowedViewers = config.GetString("ViewersToAllow", "");
            m_allowedViewers = Util.ConvertToList(allowedViewers, false);
            m_useIncludeList = config.GetBoolean("UseAllowListInsteadOfBanList", false);

            m_checkOnLogin = config.GetBoolean("CheckForSimilaritiesOnLogin", m_checkOnLogin);
            m_checkOnTimer = config.GetBoolean("CheckForSimilaritiesOnTimer", m_checkOnTimer);

            if (m_checkOnTimer)
                _checkForSimilaritiesLater.Start(5, CheckForSimilaritiesMultiple);

            GrieferAllowLevel =
                (AllowLevel) Enum.Parse(typeof (AllowLevel), config.GetString("GrieferAllowLevel", "AllowKnown"));

            presenceInfo = Framework.Utilities.DataManager.RequestPlugin<IPresenceInfo>();
            m_accountService = UserAccountService;

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand(
                    "show user info", "show user info", "Info on a given user", UserInfo, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "set user info", "set user info", "Sets the info of the given user", SetUserInfo, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "block user", "block user", "Blocks a given user from connecting anymore", BlockUser, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "ban user", "ban user", "Blocks a given user from connecting anymore", BlockUser, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "unblock user", "unblock user", "Removes the block for logging in on a given user", UnBlockUser, false, true);
                MainConsole.Instance.Commands.AddCommand(
                    "unban user", "unban user", "Removes the block for logging in on a given user", UnBlockUser, false, true);
            }
        }