Exemplo n.º 1
0
        public static string GetResponseTriggerHighlighting(string Trigg, Response Res)
        {
            StringBuilder SB        = new StringBuilder();
            string        ResHeader = Res.GetHeadersAsString();
            string        ResBody   = Res.BodyString;

            List <string> AllTriggerVariations = new List <string>();

            AllTriggerVariations.Add(Trigg);
            if (!AllTriggerVariations.Contains(CookieParameters.Encode(Trigg)))
            {
                AllTriggerVariations.Add(CookieParameters.Encode(Trigg));
            }
            if (!AllTriggerVariations.Contains(HeaderParameters.Encode(Trigg)))
            {
                AllTriggerVariations.Add(HeaderParameters.Encode(Trigg));
            }

            try
            {
                List <string> HeaderAdjustments = GetHeaderVariations(Trigg, Res.Headers, ResHeader);
                foreach (string HA in HeaderAdjustments)
                {
                    if (!AllTriggerVariations.Contains(HA))
                    {
                        AllTriggerVariations.Add(HA);
                    }
                }
            }
            catch { }

            List <string> HeaderTriggerVariations = new List <string>();

            foreach (string CurrentVariation in AllTriggerVariations)
            {
                if (!HeaderTriggerVariations.Contains(CurrentVariation) && ResHeader.Contains(CurrentVariation))
                {
                    HeaderTriggerVariations.Add(CurrentVariation);
                }
            }
            ResHeader = Highlighter.InsertHighlights(ResHeader, HeaderTriggerVariations);

            ResBody = GetResponseBodyHighlighting(ResBody, Trigg);
            if (!ResHeader.Contains("<i<hlg>>") && !ResBody.Contains("<i<hlg>>"))
            {
                foreach (string TriggLine in Tools.SplitLines(Trigg))
                {
                    ResBody = GetResponseBodyHighlighting(ResBody, TriggLine);
                }
            }

            SB.Append(Highlighter.SnipHeaderSection(ResHeader).TrimEnd());
            SB.AppendLine(); SB.AppendLine();
            SB.Append(Highlighter.SnipBodySection(ResBody));
            return(SB.ToString().Replace("\n", "<i<br>>"));
        }
Exemplo n.º 2
0
        static string GetResponseBodyHighlighting(string ResBody, string Trigg)
        {
            List <string> AllTriggerVariations = new List <string>();

            AllTriggerVariations.Add(Trigg);

            List <string> BodyTriggerVariations = new List <string>();

            foreach (string CurrentVariation in AllTriggerVariations)
            {
                if (!BodyTriggerVariations.Contains(CurrentVariation) && ResBody.Contains(CurrentVariation))
                {
                    BodyTriggerVariations.Add(Trigg);
                }
            }
            ResBody = Highlighter.InsertHighlights(ResBody, BodyTriggerVariations);
            return(ResBody);
        }
Exemplo n.º 3
0
        static string GetRequestBodyHighlighting(string ReqBody, string Trigg)
        {
            List <string> AllTriggerVariations = new List <string>();

            AllTriggerVariations.Add(Trigg);
            if (!AllTriggerVariations.Contains(BodyParameters.Encode(Trigg)))
            {
                AllTriggerVariations.Add(BodyParameters.Encode(Trigg));
            }

            List <string> BodyTriggerVariations = new List <string>();

            foreach (string CurrentVariation in AllTriggerVariations)
            {
                if (!BodyTriggerVariations.Contains(CurrentVariation) && ReqBody.Contains(CurrentVariation))
                {
                    BodyTriggerVariations.Add(CurrentVariation);
                }
            }
            ReqBody = Highlighter.InsertHighlights(ReqBody, BodyTriggerVariations);
            return(ReqBody);
        }