Exemple #1
0
        void DoDiff()
        {
            try
            {
                if (FetchFromLogs)
                {
                    this.A = Session.FromLog(this.ALogId, this.LogSource);
                    this.B = Session.FromLog(this.BLogId, this.LogSource);
                }

                string RequestA  = "";
                string RequestB  = "";
                string ResponseA = "";
                string ResponseB = "";
                if (A != null)
                {
                    if (A.Request != null)
                    {
                        RequestA = A.Request.ToString();
                    }
                    if (A.Response != null)
                    {
                        ResponseA = A.Response.ToString();
                    }
                }
                if (B != null)
                {
                    if (B.Request != null)
                    {
                        RequestB = B.Request.ToString();
                    }
                    if (B.Response != null)
                    {
                        ResponseB = B.Response.ToString();
                    }
                }

                string[] RequestSidebySideResults  = DiffWindow.DoSideBySideDiff(RequestA, RequestB);
                string[] ResponseSidebySideResults = DiffWindow.DoSideBySideDiff(ResponseA, ResponseB);
                string   RequestSinglePageResults  = DiffWindow.DoSinglePageDiff(RequestA, RequestB);
                string   ResponseSinglePageResults = DiffWindow.DoSinglePageDiff(ResponseA, ResponseB);
                RequestDRV.ShowDiffResults(RequestSinglePageResults, RequestSidebySideResults[0], RequestSidebySideResults[1]);
                ResponseDRV.ShowDiffResults(ResponseSinglePageResults, ResponseSidebySideResults[0], ResponseSidebySideResults[1]);
            }
            catch (Exception Exp)
            {
                IronException.Report("Error doing diff on Sessions", Exp);
                ShowError();
            }
            EndDiff();
        }
Exemple #2
0
        void ShowSelectedLog(object SelectedLogInfoObject)
        {
            int    LogId      = (int)SelectedLogInfoObject;
            bool   EnableBtn  = false;
            string ScriptCode = "";

            try
            {
                Session Session = Session.FromScanLog(LogId);
                if (BaselineSession == null && BaselineLogId > 0)
                {
                    BaselineSession = Session.FromScanLog(BaselineLogId);
                }

                StringBuilder SB = new StringBuilder("<i<br>>To access the selected Request in the IronWASP Scripting shell for fuzzing or testing use the following code:<i<br>>");
                SB.Append(string.Format("<i<br>><i<hh>>Python:<i</hh>><i<br>>req = <i<cg>>Request<i</cg>>.<i<cb>>FromScanLog<i</cb>>({0})", LogId));
                SB.Append(string.Format("<i<br>><i<br>><i<hh>>Ruby:<i</hh>><i<br>>req = <i<cg>>Request<i</cg>>.<i<cb>>from_scan_log<i</cb>>({0})", LogId));
                ScriptCode = SB.ToString();

                SB = new StringBuilder(@"{\rtf1{\colortbl ;\red0\green77\blue187;\red247\green150\blue70;\red255\green0\blue0;\red0\green200\blue50;\red255\green255\blue255;}");
                SB.Append(Tools.RtfSafe(ScriptCode));
                ScriptCode = SB.ToString();
                ScriptCode = ScriptCode.Replace(" . ", ".").Replace(" (", "(").Replace("Request ", "Request").Replace(" From", "From").Replace(" from", "from").Replace("Log ", "Log").Replace("log ", "log");

                string RequestStr          = "";
                string ResponseStr         = "";
                string BaselineRequestStr  = "";
                string BaselineResponseStr = "";

                if (Session.Request != null)
                {
                    RequestStr = Session.Request.ToString();
                    RequestView.SetRequest(Session.Request);
                    EnableBtn = true;

                    if (Session.Response != null)
                    {
                        ResponseStr = Session.Response.ToString();
                        ResponseView.SetResponse(Session.Response, Session.Request);
                    }
                }
                if (BaselineSession != null)
                {
                    if (BaselineSession.Request != null)
                    {
                        BaselineRequestStr = BaselineSession.Request.ToString();
                        if (BaselineSession.Response != null)
                        {
                            BaselineResponseStr = BaselineSession.Response.ToString();
                        }
                    }
                }


                string[] RequestSidebySideResults  = DiffWindow.DoSideBySideDiff(BaselineRequestStr, RequestStr);
                string[] ResponseSidebySideResults = DiffWindow.DoSideBySideDiff(BaselineResponseStr, ResponseStr);

                string RequestSinglePageResults  = DiffWindow.DoSinglePageDiff(BaselineRequestStr, RequestStr);
                string ResponseSinglePageResults = DiffWindow.DoSinglePageDiff(BaselineResponseStr, ResponseStr);

                RequestDRV.ShowDiffResults(RequestSinglePageResults, RequestSidebySideResults[0], RequestSidebySideResults[1]);
                ResponseDRV.ShowDiffResults(ResponseSinglePageResults, ResponseSidebySideResults[0], ResponseSidebySideResults[1]);
            }
            catch (ThreadAbortException) { }
            catch (Exception Exp) { IronException.Report("Error loading Selected Log info in Scan Trace Viewer", Exp); }
            finally
            {
                EndLogLoad(EnableBtn, ScriptCode);
            }
        }