Ejemplo n.º 1
0
        public bool SearchFilter(string sMethod, object searchParam, string input)
        {
            LogLevel p = (LogLevel)searchParam;
            string   targetFilterName = "";

            foreach (KeyValuePair <string, object> pair in filterNames)
            {
                LogLevel comp = (LogLevel)pair.Value;
                if (comp == p)
                {
                    targetFilterName = pair.Key;
                    break;
                }
            }

            if (targetFilterName == "")
            {
                return(true); // if target filter is not found output the text, perhaps there is no filter for a specific object
            }

            if (sMethod == "and")
            {
                return(Manager.RunAllCompareAnd(targetFilterName, input));
            }
            else if (sMethod == "or")
            {
                return(Manager.RunAllCompareOr(targetFilterName, input));
            }
            else
            {
                console.WriteLine("[ERROR] Invalid SearchFilter option sMethod", console.GetIntercativeGroup());
                return(true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check's if a host need's to be blocked based on HostName
        /// </summary>
        /// <param name="httpRequest">The current Request object</param>
        /// <returns>True if host need's to be blocked</returns>

        public bool CheckHost(Request httpRequest)
        {
            string host         = httpRequest.headers["Host"];
            bool   serviceState = CheckServiceState(BlockServices.Host);

            if (!serviceState)
            {
                return(false);
            }
            bool result = false;

            if (vf.IsFilterEmpty("mitm_hostblock_white"))
            {
                result = vf.RunAllCompareOr("mitm_hostblock_black", host);
            }
            else
            {
                result = !vf.RunAllCompareOr("mitm_hostblock_white", host);  //revert the value, because we don't want to block whitelisted hosts
            }
            return(result);
        }