void AnalyzeTraceId(int CurrentId, string TraceOverviewMessage, IronTrace ScanTraceRecord)
        {
            ShowAnalysisStatus(string.Format("Analyzing Trace ID - {0}", CurrentId));

            BehaviourAnalysis BA = new BehaviourAnalysis(this.Keywords, this.RoundtripIncrease, this.RoundtripIncreaseFactor, this.InsertedCharsCount);
            BA.Analyze(TraceOverviewMessage, ScanTraceRecord.Section);

            bool CodeResultFound = false;
            bool KeywordsResultFound = false;
            string BodyResultFound = "";
            bool SetCookieFound = false;
            bool HeadersFound = false;
            string RoundtripFound = "";

            BehaviourAnalysisResults Results = new BehaviourAnalysisResults(BA.Results);

            if (Results.SetCookies.Count > 0) SetCookieFound = true;
            if (Results.Codes.Count > 0) CodeResultFound = true;
            if (Results.Keywords.Count > 0) KeywordsResultFound = true;
            if (Results.Headers.Count > 0) HeadersFound = true;

            if (Results.InsertedChars.Count > 0) BodyResultFound = string.Format("{0} chars", Results.InsertedChars[Results.InsertedChars.Count - 1]);
            if (Results.PlusRoundtripDiffs.Count > 0 || Results.MinusRoundtripDiffs.Count > 0)
            {
                int PlusMax = 0;
                int MinusMax = 0;
                if (Results.PlusRoundtripDiffs.Count > 0) PlusMax = Results.PlusRoundtripDiffs[Results.PlusRoundtripDiffs.Count - 1];
                if (Results.MinusRoundtripDiffs.Count > 0) MinusMax = Results.MinusRoundtripDiffs[Results.MinusRoundtripDiffs.Count - 1];
                if (PlusMax > MinusMax)
                    RoundtripFound = string.Format("+{0} ms", PlusMax);
                else
                    RoundtripFound = string.Format("-{0} ms", MinusMax);
            }

            if (CodeResultFound || KeywordsResultFound || BodyResultFound.Length > 0 || SetCookieFound || HeadersFound || RoundtripFound.Length > 0)
            {
                List<object> Vals = new List<object>() { CurrentId, ScanTraceRecord.Section, ScanTraceRecord.PluginName, CodeResultFound, KeywordsResultFound, BodyResultFound, SetCookieFound, HeadersFound, RoundtripFound, BA.BaseLineLogId, BA.BaseLinePayload, BA.BaseLineRoundtripTime, BA.BaseLineSession.Response.Code, BA.ResultsXml };
                AddAnalysisResultEntry(Vals);
            }
        }
예제 #2
0
        void AnalyzeTraceId(int CurrentId, string TraceOverviewMessage, IronTrace ScanTraceRecord)
        {
            ShowAnalysisStatus(string.Format("Analyzing Trace ID - {0}", CurrentId));

            BehaviourAnalysis BA = new BehaviourAnalysis(this.Keywords, this.RoundtripIncrease, this.RoundtripIncreaseFactor, this.InsertedCharsCount);

            BA.Analyze(TraceOverviewMessage, ScanTraceRecord.Section);

            bool   CodeResultFound     = false;
            bool   KeywordsResultFound = false;
            string BodyResultFound     = "";
            bool   SetCookieFound      = false;
            bool   HeadersFound        = false;
            string RoundtripFound      = "";

            BehaviourAnalysisResults Results = new BehaviourAnalysisResults(BA.Results);

            if (Results.SetCookies.Count > 0)
            {
                SetCookieFound = true;
            }
            if (Results.Codes.Count > 0)
            {
                CodeResultFound = true;
            }
            if (Results.Keywords.Count > 0)
            {
                KeywordsResultFound = true;
            }
            if (Results.Headers.Count > 0)
            {
                HeadersFound = true;
            }

            if (Results.InsertedChars.Count > 0)
            {
                BodyResultFound = string.Format("{0} chars", Results.InsertedChars[Results.InsertedChars.Count - 1]);
            }
            if (Results.PlusRoundtripDiffs.Count > 0 || Results.MinusRoundtripDiffs.Count > 0)
            {
                int PlusMax  = 0;
                int MinusMax = 0;
                if (Results.PlusRoundtripDiffs.Count > 0)
                {
                    PlusMax = Results.PlusRoundtripDiffs[Results.PlusRoundtripDiffs.Count - 1];
                }
                if (Results.MinusRoundtripDiffs.Count > 0)
                {
                    MinusMax = Results.MinusRoundtripDiffs[Results.MinusRoundtripDiffs.Count - 1];
                }
                if (PlusMax > MinusMax)
                {
                    RoundtripFound = string.Format("+{0} ms", PlusMax);
                }
                else
                {
                    RoundtripFound = string.Format("-{0} ms", MinusMax);
                }
            }

            if (CodeResultFound || KeywordsResultFound || BodyResultFound.Length > 0 || SetCookieFound || HeadersFound || RoundtripFound.Length > 0)
            {
                List <object> Vals = new List <object>()
                {
                    CurrentId, ScanTraceRecord.Section, ScanTraceRecord.PluginName, CodeResultFound, KeywordsResultFound, BodyResultFound, SetCookieFound, HeadersFound, RoundtripFound, BA.BaseLineLogId, BA.BaseLinePayload, BA.BaseLineRoundtripTime, BA.BaseLineSession.Response.Code, BA.ResultsXml
                };
                AddAnalysisResultEntry(Vals);
            }
        }
        void AnalyzeTraceId(int CurrentId, string TraceOverviewMessage, IronTrace ScanTraceRecord)
        {
            ShowAnalysisStatus(string.Format("Analyzing Trace ID - {0}", CurrentId));
            List<Dictionary<string, string>> OverviewEntries = IronTrace.GetOverviewEntriesFromXml(TraceOverviewMessage);
            List<string> Payloads = new List<string>();
            List<int> RoundTrips = new List<int>();
            List<int> LogIds = new List<int>();
            foreach (Dictionary<string, string> Entry in OverviewEntries)
            {
                try
                {
                    int LogId = Int32.Parse(Entry["log_id"]);
                    int Time = Int32.Parse(Entry["time"]);
                    Payloads.Add(Entry["payload"]);
                    LogIds.Add(LogId);
                    RoundTrips.Add(Time);
                }
                catch { }
            }
            BehaviourAnalysis BA = new BehaviourAnalysis(this.Keywords, this.RoundtripIncrease, this.RoundtripIncreaseFactor, this.InsertedCharsCount);
            BA.Analyze(Payloads, LogIds, RoundTrips, ScanTraceRecord.Section);

            bool CodeResultFound = false;
            bool KeywordsResultFound = false;
            string BodyResultFound = "";
            bool SetCookieFound = false;
            bool HeadersFound = false;
            string RoundtripFound = "";

            BehaviourAnalysisResults Results = new BehaviourAnalysisResults(BA.Results);

            if (Results.SetCookies.Count > 0) SetCookieFound = true;
            if (Results.Codes.Count > 0) CodeResultFound = true;
            if (Results.Keywords.Count > 0) KeywordsResultFound = true;
            if (Results.Headers.Count > 0) HeadersFound = true;

            if (Results.InsertedChars.Count > 0) BodyResultFound = string.Format("{0} chars", Results.InsertedChars[Results.InsertedChars.Count - 1]);
            if (Results.PlusRoundtripDiffs.Count > 0 || Results.MinusRoundtripDiffs.Count > 0)
            {
                int PlusMax = 0;
                int MinusMax = 0;
                if (Results.PlusRoundtripDiffs.Count > 0) PlusMax = Results.PlusRoundtripDiffs[Results.PlusRoundtripDiffs.Count - 1];
                if (Results.MinusRoundtripDiffs.Count > 0) MinusMax = Results.MinusRoundtripDiffs[Results.MinusRoundtripDiffs.Count - 1];
                if (PlusMax > MinusMax)
                    RoundtripFound = string.Format("+{0} ms", PlusMax);
                else
                    RoundtripFound = string.Format("-{0} ms", MinusMax);
            }

            if (CodeResultFound || KeywordsResultFound || BodyResultFound.Length > 0 || SetCookieFound || HeadersFound || RoundtripFound.Length > 0)
            {
                List<object> Vals = new List<object>() { CurrentId, ScanTraceRecord.Section, ScanTraceRecord.PluginName, CodeResultFound, KeywordsResultFound, BodyResultFound, SetCookieFound, HeadersFound, RoundtripFound, BA.BaseLineLogId, BA.BaseLinePayload, BA.BaseLineRoundtripTime, BA.BaseLineSession.Response.Code, BA.ResultsXml };
                AddAnalysisResultEntry(Vals);
            }
        }