Beispiel #1
0
 public static Reflection GetReflections(string Input, Response Res)
 {
     List<string> Results = new List<string>();
     string ResString = Res.ToString();
     return GetReflections(Input, ResString);
 }
Beispiel #2
0
        internal static bool CanInterceptBasedOnFilter(Request Req, Response Res)
        {
            if (RequestRulesOnResponse)
            {
                if (!CanInterceptBasedOnFilter(Req)) return false;
            }

            //Check Hostnames
            if (InterceptCheckHostNames)
            {
                if (InterceptCheckHostNamesPlus && InterceptHostNames.Count > 0)
                {
                    bool Match = false;
                    foreach (string HostName in InterceptHostNames)
                    {
                        if (Res.Host.Equals(HostName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            Match = true;
                            break;
                        }
                    }
                    if (!Match)
                    {
                        return false;
                    }
                }
                if (InterceptCheckHostNamesMinus && DontInterceptHostNames.Count > 0)
                {
                    foreach (string HostName in DontInterceptHostNames)
                    {
                        if (Res.Host.Equals(HostName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return false;
                        }
                    }
                }
            }

            //Check Methods Rule
            int Code = Res.Code;
            switch (Code)
            {
                case 200:
                    if (!Intercept200)
                        return false;
                    break;
                case 301:
                case 302:
                    if (!Intercept301_2)
                        return false;
                    break;
                case 403:
                    if (!Intercept403)
                        return false;
                    break;
                case 500:
                    if (!Intercept500)
                        return false;
                    break;
                default:
                    if (Code > 199 && Code < 300)
                    {
                        if (!Intercept2xx)
                            return false;
                    }
                    else if (Code > 299 && Code < 400)
                    {
                        if (!Intercept3xx)
                            return false;
                    }
                    else if (Code > 399 && Code < 500)
                    {
                        if (!Intercept500)
                            return false;
                    }
                    else if (Code > 499 && Code < 600)
                    {
                        if (!Intercept5xx)
                            return false;
                    }
                    break;
            }

            if (Res.BodyLength > 0)
            {
                if (Res.ContentType.ToLower().Contains("html"))
                {
                    if (!InterceptHTML) return false;
                }
                else if (Res.ContentType.ToLower().Contains("css"))
                {
                    if (!InterceptCSS) return false;
                }
                else if (Res.ContentType.ToLower().Contains("javascript"))
                {
                    if (!InterceptJS) return false;
                }
                else if (Res.ContentType.ToLower().Contains("xml"))
                {
                    if (!InterceptXML) return false;
                }
                else if (Res.ContentType.ToLower().Contains("json"))
                {
                    if (!InterceptJSON) return false;
                }
                else if (Res.ContentType.ToLower().Contains("text"))
                {
                    if (!InterceptOtherText) return false;
                }
                else if (Res.ContentType.ToLower().Contains("jpg") || Res.ContentType.ToLower().Contains("png") || Res.ContentType.ToLower().Contains("jpeg") || Res.ContentType.ToLower().Contains("gif") || Res.ContentType.ToLower().Contains("ico"))
                {
                    if (!InterceptImg) return false;
                }
                else
                {
                    if (!InterceptOtherBinary) return false;
                }
            }

            //Check Keyword
            if (InterceptCheckResponseWithKeyword)
            {
                if (InterceptCheckResponseWithKeywordPlus && InterceptResponseWithKeyword.Length > 0)
                {
                    if (!Res.ToString().Contains(InterceptResponseWithKeyword))
                    {
                        return false;
                    }
                }
                if (InterceptCheckResponseWithKeywordMinus && DontInterceptResponseWithKeyword.Length > 0)
                {
                    if (Res.ToString().Contains(DontInterceptResponseWithKeyword))
                    {
                        return false;
                    }
                }
            }

            return true;
        }
Beispiel #3
0
 internal static void DisplayPluginResultsResponse(Response Res)
 {
     if (Res != null)
     {
         UI.ResultsResponseIDV.Text = Res.ToString();
     }
 }