/// <summary> /// Imports sessions loaded by Fiddler from new SAZ into extension. /// </summary> void XWebSecExtension_Load(object sender, FiddlerApplication.ReadSAZEventArgs e) { viewControl.EnableLoadingOverlay(); Session[] allSessions = e.arrSessions; try { FiddlerApplication.Log.LogString("[XWebSec] Loading " + allSessions.GetLength(0) + " sessions."); //Adding sessions like Fiddler without clearing domainData.addSessions(allSessions); viewControl.UpdateUI(domainData); } catch (Exception exc) { viewControl.DisableLoadingOverlay(); MessageBox.Show($"Xbox Web Security Plugin encountered a fatal exception while loading: {exc.ToString()}"); } viewControl.DisableLoadingOverlay(); }
// ///////////////// #endregion #region LoadSAZ ///////////////// // // Handle loading a SAZ file. // private void HandleLoadSaz(object sender, FiddlerApplication.ReadSAZEventArgs e) { FiddlerApplication.Prefs.SetBoolPref("extensions.EXOFiddlerExtension.LoadSaz", true); calledColumnsUI.AddAllEnabledColumns(); calledColumnsUI.OrderColumns(); FiddlerApplication.UI.lvSessions.BeginUpdate(); foreach (var session in e.arrSessions) { // Populate the ElapsedTime column on load SAZ, if the column is enabled, and the extension is enabled. if (bElapsedTimeColumnEnabled) { if (session.Timers.ClientBeginRequest.ToString("H:mm:ss.fff") == "0:00:00.000" || session.Timers.ClientDoneResponse.ToString("H:mm:ss.fff") == "0:00:00.000") { session["X-ElapsedTime"] = "No Data"; } /*else if (session.Timers.ServerDoneResponse.ToString("H:mm:ss.fff") == "0:00:00.000" || session.Timers.ServerDoneResponse.ToString("yyyy/MM/dd") == "0001/01/01") * { * session["X-ElapsedTime"] = "No Data"; * }*/ else { double Milliseconds = Math.Round((session.Timers.ClientDoneResponse - session.Timers.ClientBeginRequest).TotalMilliseconds); if (Milliseconds < 1000) { session["X-ElapsedTime"] = Milliseconds + "ms"; } else if (Milliseconds >= 1000 && Milliseconds < 2000) { session["X-ElapsedTime"] = Math.Round((session.Timers.ClientDoneResponse - session.Timers.ClientBeginRequest).TotalSeconds) + " second"; } else { session["X-ElapsedTime"] = Math.Round((session.Timers.ClientDoneResponse - session.Timers.ClientBeginRequest).TotalSeconds) + " seconds"; } //session["X-ElapsedTime"] = session.oResponse.iTTLB.ToString() + "ms"; } } // Populate the ExchangeType column on load SAZ, if the column is enabled, and the extension is enabled if (bExchangeTypeColumnEnabled && bExtensionEnabled) { calledSessionRuleSet.SetExchangeType(session); } // Populate the ResponseServer column on load SAZ, if the column is enabled, and the extension is enabled if (bResponseServerColumnEnabled && bExtensionEnabled) { calledSessionRuleSet.SetResponseServer(session); } // Populate the Authentication column on load SAZ, if the column is enabled, and the extension is enabled if (bAuthColumnEnabled && bExtensionEnabled) { calledSessionRuleSet.SetAuthentication(session); } if (bExtensionEnabled) { // Colourise sessions on load SAZ. calledSessionRuleSet.OnPeekAtResponseHeaders(session); //Run whatever function you use in IAutoTamper session.RefreshUI(); } } FiddlerApplication.UI.lvSessions.EndUpdate(); }