internal Proxy(bool bIsPrimary) { if (bIsPrimary) { try { NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(this.NetworkChange_NetworkAvailabilityChanged); NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(this.NetworkChange_NetworkAddressChanged); } catch (Exception) { } try { this.watcherPrefNotify = new PreferenceBag.PrefWatcher?(FiddlerApplication.Prefs.AddWatcher("fiddler.network", new EventHandler <PrefChangeEventArgs>(this.onNetworkPrefsChange))); this.SetDefaultEgressEndPoint(FiddlerApplication.Prefs["fiddler.network.egress.ip"]); CONFIG.SetNoDecryptList(FiddlerApplication.Prefs["fiddler.network.https.NoDecryptionHosts"]); CONFIG.sFiddlerListenHostPort = FiddlerApplication.Prefs.GetStringPref("fiddler.network.proxy.RegistrationHostName", "127.0.0.1") + ":" + CONFIG.ListenPort.ToString(); ClientChatter._cbClientReadBuffer = FiddlerApplication.Prefs.GetInt32Pref("fiddler.network.sockets.ClientReadBufferSize", 0x2000); ServerChatter._cbServerReadBuffer = FiddlerApplication.Prefs.GetInt32Pref("fiddler.network.sockets.ServerReadBufferSize", 0x8000); } catch (Exception) { } } }
internal static void ReadRegistry(MenuItem miAddTo, Hashtable htMapping) { RegistryKey key = Registry.CurrentUser.OpenSubKey(CONFIG.GetRegPath("MenuExt")); if (key != null) { bool flag = true; foreach (string str in key.GetSubKeyNames()) { MenuItem item; if (flag) { item = new MenuItem("-"); htMapping.Add(item, null); miAddTo.MenuItems.Add(item); flag = false; } item = new MenuItem(str); htMapping.Add(item, null); item.Click += new EventHandler(MenuExt.HandleItemClick); miAddTo.MenuItems.Add(item); } key.Close(); } }
private void btnRespondImport_Click(object sender, EventArgs e) { string fileName; OpenFileDialog dialog = new OpenFileDialog { DefaultExt = "saz", RestoreDirectory = true, InitialDirectory = CONFIG.GetPath("Captures"), Title = "Import file for replay", Filter = "SAZ / Rules (*.saz;*.farx)|*.saz;*.farx|ZIP Files (*.zip)|*.zip" }; if (DialogResult.OK == dialog.ShowDialog(this)) { fileName = dialog.FileName; } else { dialog.Dispose(); return; } dialog.Dispose(); if (fileName.EndsWith(".farx", StringComparison.OrdinalIgnoreCase)) { FiddlerApplication._AutoResponder.ImportFARX(fileName); } else { FiddlerApplication._AutoResponder.ImportSAZ(fileName); } }
private static bool CreateCert(string sHostname, bool isRoot) { if (!isRoot && !rootCertExists()) { lock (oRootCertCreationLock) { if ((FindCert(CONFIG.sMakeCertRootCN, false) == null) && !createRootCert()) { FiddlerApplication.DoNotifyUser("Creation of the root certificate was not successful.", "Certificate Error"); return(false); } } } if (sHostname.IndexOfAny(new char[] { '"', '\r', '\n' }) == -1) { int num; string str3; string path = CONFIG.GetPath("MakeCert"); if (!File.Exists(path)) { FiddlerApplication.DoNotifyUser("Cannot locate:\n\t\"" + path + "\"\n\nPlease move makecert.exe to the Fiddler installation directory.", "MakeCert.exe not found"); throw new FileNotFoundException("Cannot locate: " + path + ". Please move makecert.exe to the Fiddler installation directory."); } string sParams = string.Format(isRoot ? CONFIG.sMakeCertParamsRoot : CONFIG.sMakeCertParamsEE, sHostname, CONFIG.sMakeCertSubjectO, CONFIG.sMakeCertRootCN); lock (oEECertCreationLock) { if (FindCert(sHostname, false) == null) { str3 = Utilities.GetExecutableOutput(path, sParams, out num); if (CONFIG.bDebugCertificateGeneration) { FiddlerApplication.Log.LogFormat("/Fiddler.CertMaker>{3}-CreateCert({0}) => ({1}){2}", new object[] { sHostname, num, (num == 0) ? "." : ("\r\n" + str3), Thread.CurrentThread.ManagedThreadId }); } if (num == 0) { Thread.Sleep(150); } } else { if (CONFIG.bDebugCertificateGeneration) { FiddlerApplication.Log.LogFormat("/Fiddler.CertMaker>{1} A racing thread already successfully CreatedCert({0})", new object[] { sHostname, Thread.CurrentThread.ManagedThreadId }); } return(true); } } if (num == 0) { return(true); } string sMessage = string.Format("Creation of the interception certificate failed.\n\nmakecert.exe returned {0}.\n\n{1}", num, str3); FiddlerApplication.Log.LogFormat("Fiddler.CertMaker> [{0}{1}] Returned Error: {2} ", new object[] { path, sParams, sMessage }); if (CONFIG.bDebugCertificateGeneration) { FiddlerApplication.DoNotifyUser(sMessage, "Unable to Generate Certificate"); } } return(false); }
internal void SaveDefaultRules() { if (this._bRuleListIsDirty) { this.SaveRules(CONFIG.GetPath("AutoResponderDefaultRules")); this._bRuleListIsDirty = false; } }
private void EnsureTranscoders() { if (((this.m_Importers == null) || (this.m_Exporters == null)) || ((this.m_Importers.Count == 0) || (this.m_Exporters.Count == 0))) { this.ScanPathForTranscoders(CONFIG.GetPath("Transcoders_Machine")); this.ScanPathForTranscoders(CONFIG.GetPath("Transcoders_User")); } }
public bool Attach() { if (!this._bIsAttached) { this.CollectConnectoidAndGatewayInfo(); WinINETProxyInfo oNewInfo = new WinINETProxyInfo { bUseManualProxies = true, bAllowDirect = true, sHttpProxy = CONFIG.sFiddlerListenHostPort }; if (CONFIG.bCaptureCONNECT) { oNewInfo.sHttpsProxy = CONFIG.sFiddlerListenHostPort; } else { oNewInfo.sHttpsProxy = this.piPrior.sHttpsProxy; } if (this.piPrior.bUseManualProxies) { oNewInfo.sFtpProxy = this.piPrior.sFtpProxy; oNewInfo.sSocksProxy = this.piPrior.sSocksProxy; } if (CONFIG.bCaptureFTP) { oNewInfo.sFtpProxy = CONFIG.sFiddlerListenHostPort; } oNewInfo.sHostsThatBypass = CONFIG.sHostsThatBypassFiddler; if (CONFIG.bHookWithPAC) { if (FiddlerApplication.Prefs.GetBoolPref("fiddler.proxy.pacfile.usefileprotocol", true)) { oNewInfo.sPACScriptLocation = "file://" + CONFIG.GetPath("Pac"); } else { oNewInfo.sPACScriptLocation = "http://" + CONFIG.sFiddlerListenHostPort + "/proxy.pac"; } } if (!CONFIG.bIsViewOnly) { if (this.oAllConnectoids.HookConnections(oNewInfo)) { this._bIsAttached = true; FiddlerApplication.OnFiddlerAttach(); this.WriteAutoProxyPACFile(true); } else { FiddlerApplication.DoNotifyUser("Failed to register Fiddler as the system proxy.", "Error"); _setDynamicRegistryKey(false); return(false); } _setDynamicRegistryKey(true); } } return(true); }
private MakeCertEngine() { if (Environment.OSVersion.Version.Major > 5) { this.string_1 = "sha256"; } this.string_0 = CONFIG.GetPath("MakeCert"); if (!System.IO.File.Exists(this.string_0)) { FiddlerApplication.Log.LogFormat("Cannot locate:\n\t\"{0}\"\n\nPlease move makecert.exe to the Fiddler installation directory.", new object[] { this.string_0 }); throw new FileNotFoundException("Cannot locate: \"" + this.string_0 + "\". Please move makecert.exe to the Fiddler installation directory."); } }
internal void ScanExtensions() { this.ScanPathForExtensions(CONFIG.GetPath("AutoFiddlers_User")); this.ScanPathForExtensions(CONFIG.GetPath("AutoFiddlers_Machine")); if (this.m_Extensions.Count > 0) { FiddlerApplication.FiddlerBoot += new SimpleEventHandler(this.DoOnLoad); } if (CONFIG.IsMicrosoftMachine && (this.m_Extensions.Count > 5)) { FiddlerApplication.logSelfHostOnePerSession(60); } }
private void WriteAutoProxyPACFile(bool bUseFiddler) { if (!CONFIG.bIsViewOnly) { try { System.IO.File.WriteAllText(CONFIG.GetPath("Pac"), this._GetPACScriptText(bUseFiddler)); } catch (Exception exception) { FiddlerApplication.Log.LogFormat("Failed to update PAC file to indicate Listening={0} due to {1}", new object[] { bUseFiddler, exception.Message }); } } }
public void CheckForUpdates(bool bVerbose) { try { VersionStruct verServer = new VersionStruct(); verServer = this.GetLatestVersion(CONFIG.bIsBeta); FiddlerApplication.Prefs.SetStringPref("fiddler.welcomemsg", verServer.sWelcomeMsg); int num = CompareVersions(ref verServer, CONFIG.FiddlerVersionInfo); if ((num > 1) || (bVerbose && (num > 0))) { verServer.sWhatIsNew = verServer.sWhatIsNew + string.Format("\r\n\r\n------------------------------\r\nWould you like to learn more?\r\n{0}{1}&IsBeta={2}", CONFIG.GetUrl("ChangeList"), Application.ProductVersion, CONFIG.bIsBeta.ToString()); frmUpdate oUpdatePrompt = new frmUpdate("Update Announcement (from v" + Application.ProductVersion + " to v" + verServer.Major.ToString() + "." + verServer.Minor.ToString() + "." + verServer.Build.ToString() + "." + verServer.Private.ToString() + ")", "Good news! An improved version of Fiddler is now available.\r\n\r\n" + verServer.sWhatIsNew, !verServer.bMustCleanInstall, bVerbose ? MessageBoxDefaultButton.Button1 : MessageBoxDefaultButton.Button2) { StartPosition = FormStartPosition.CenterScreen }; DialogResult updateDecision = FiddlerApplication.UI.GetUpdateDecision(oUpdatePrompt); if (DialogResult.Yes == updateDecision) { Utilities.LaunchHyperlink(CONFIG.GetUrl("InstallLatest")); } else if (DialogResult.Retry == updateDecision) { try { RegistryKey oReg = Registry.CurrentUser.OpenSubKey(CONFIG.GetRegPath("Root"), true); if (oReg != null) { Utilities.SetRegistryString(oReg, "UpdatePending", "True"); oReg.Close(); } } catch { } } } else if (bVerbose) { FiddlerApplication.DoNotifyUser("Your version of Fiddler is up-to-date.\n\nThanks for checking!", "FiddlerUpdate"); } } catch (Exception exception) { if (bVerbose) { MessageBox.Show("There was an error retrieving version information. You can check for updates manually by visiting https://www.fiddler2.com/\n\n" + exception.ToString(), "Error retrieving version information"); } } }
private void _CreateSyntaxViewAd() { Label label = new Label(); TabPage oAdPage = new TabPage("Get SyntaxView"); label = new Label { Font = new Font(label.Font.FontFamily, 11f), Height = 50, Text = "The SyntaxView Inspector displays syntax-highlighted html, script, css, and xml. If you're a web developer, you'll want this add-on. ", Padding = new Padding(8) }; oAdPage.Controls.Add(label); label.Dock = DockStyle.Top; LinkLabel label2 = new LinkLabel { AutoSize = true, Location = new Point(20, 60), Text = "Download and Install SyntaxView now...", LinkBehavior = LinkBehavior.HoverUnderline }; label2.LinkClicked += delegate(object sender, LinkLabelLinkClickedEventArgs e) { Utilities.LaunchHyperlink(CONFIG.GetUrl("REDIR") + "SYNTAXVIEWINSTALL"); }; oAdPage.Controls.Add(label2); LinkLabel label3 = new LinkLabel { AutoSize = true, Text = "Learn more about SyntaxView and other Inspector add-ons...", Location = new Point(20, 80), LinkBehavior = LinkBehavior.HoverUnderline }; label3.LinkClicked += delegate(object sender, LinkLabelLinkClickedEventArgs e) { Utilities.LaunchHyperlink(CONFIG.GetUrl("REDIR") + "SYNTAXVIEWLEARN"); }; oAdPage.Controls.Add(label3); LinkLabel label4 = new LinkLabel { AutoSize = true, Text = "Remove this page", Location = new Point(20, 100), LinkBehavior = LinkBehavior.HoverUnderline }; label4.LinkClicked += delegate(object sender, LinkLabelLinkClickedEventArgs e) { FiddlerApplication.Prefs.SetBoolPref("fiddler.inspectors.response.AdvertiseSyntaxView", false); oAdPage.Dispose(); }; oAdPage.Controls.Add(label4); this.m_tabsResponse.TabPages.Add(oAdPage); }
public bool ImportSAZ(string sFilename) { Session[] oSessions = Utilities.ReadSessionArchive(sFilename, true); if (oSessions == null) { return(false); } if (sFilename.StartsWith(CONFIG.GetPath("Captures"), StringComparison.OrdinalIgnoreCase)) { sFilename = sFilename.Substring(CONFIG.GetPath("Captures").Length); } else { sFilename = Utilities.CollapsePath(sFilename); } return(this.ImportSessions(oSessions, sFilename)); }
private static X509Certificate _GetDefaultCertificate() { if (FiddlerApplication.oDefaultClientCertificate != null) { return(FiddlerApplication.oDefaultClientCertificate); } X509Certificate x509Certificate = null; if (File.Exists(CONFIG.GetPath("DefaultClientCertificate"))) { x509Certificate = X509Certificate.CreateFromCertFile(CONFIG.GetPath("DefaultClientCertificate")); if (x509Certificate != null && FiddlerApplication.Prefs.GetBoolPref("fiddler.network.https.cacheclientcert", true)) { FiddlerApplication.oDefaultClientCertificate = x509Certificate; } } return(x509Certificate); }
private static void _setDynamicRegistryKey(bool bAttached) { if (!CONFIG.bIsViewOnly) { try { RegistryKey key = Registry.CurrentUser.CreateSubKey(CONFIG.GetRegPath("Dynamic")); if (key != null) { key.SetValue("Attached", bAttached ? 1 : 0, RegistryValueKind.DWord); key.Close(); } } catch (Exception exception) { FiddlerApplication.Log.LogFormat("fiddler.network.FiddlerHook> Unable to set Dynamic registry key; registry permissions likely corrupt. Exception: {0}", new object[] { exception.Message }); } } }
private static void HandleItemClick(object sender, EventArgs e) { RegistryKey key = Registry.CurrentUser.OpenSubKey(CONFIG.GetRegPath("MenuExt") + (sender as MenuItem).Text); if (key != null) { string sExecute = (string)key.GetValue("Command"); string sParams = (string)key.GetValue("Parameters"); string sMethodName = (string)key.GetValue("ScriptMethod"); key.Close(); if ((sMethodName != null) && ((FiddlerApplication.scriptRules == null) || !FiddlerApplication.scriptRules.DoMethod(sMethodName))) { FiddlerApplication.DoNotifyUser(string.Format("Failed to execute script method: {0}\n(Case sensitive. Ensure your script includes a function of that name.)", sMethodName), "Scripting Error"); } if (sExecute != null) { Utilities.RunExecutable(sExecute, sParams); } } }
public FiddlerScript() { this.objVSASite = new ScriptEngineSite(this); this.scriptsFolderWatcher = new FileSystemWatcher(); this.scriptsFolderWatcher.Filter = "CustomRules.js"; this.scriptsFolderWatcher.NotifyFilter = NotifyFilters.LastWrite; this.scriptsFolderWatcher.SynchronizingObject = FiddlerApplication.UI; this.scriptsFolderWatcher.Deleted += new FileSystemEventHandler(this.scriptsFolderWatcher_Notify); this.scriptsFolderWatcher.Created += new FileSystemEventHandler(this.scriptsFolderWatcher_Notify); this.scriptsFolderWatcher.Changed += new FileSystemEventHandler(this.scriptsFolderWatcher_Notify); try { this.scriptsFolderWatcher.Path = CONFIG.GetPath("Scripts"); this.scriptsFolderWatcher.EnableRaisingEvents = true; } catch (Exception exception) { FiddlerApplication.ReportException(exception, "ScriptWatcher Failure"); } }
public bool LoadRulesScript() { bool flag = false; try { string path = CONFIG.GetPath("CustomRules"); if (FiddlerApplication.Prefs.GetBoolPref("fiddler.script.delaycreate", true) && !File.Exists(path)) { path = CONFIG.GetPath("SampleRules"); } flag = this._LoadScript(path); } catch (Exception exception) { FiddlerApplication.DoNotifyUser(string.Concat(new object[] { "Failed to load script.\n ", exception.Message, "\n", exception.InnerException, exception.StackTrace }), "Script Failure", MessageBoxIcon.Hand); this.ClearScript(); } return(flag); }
private void scriptsFolderWatcher_Notify(object sender, FileSystemEventArgs e) { if ((CONFIG.bAutoLoadScript && CONFIG.bLoadScript) && string.Equals(e.Name, "CustomRules.js", StringComparison.OrdinalIgnoreCase)) { if ((Environment.TickCount - lastScriptLoadTickCount) < CONFIG.iScriptReloadInterval) { lastScriptLoadTickCount = Environment.TickCount; } else { if (CONFIG.IsMicrosoftMachine) { FiddlerApplication.logSelfHost(50); } lastScriptLoadTickCount = Environment.TickCount; Utilities.PlaySound(CONFIG.GetPath("App") + "LoadScript.wav", IntPtr.Zero, Utilities.SoundFlags.SND_FILENAME | Utilities.SoundFlags.SND_NOWAIT | Utilities.SoundFlags.SND_NODEFAULT | Utilities.SoundFlags.SND_ASYNC); Thread.Sleep(250); this.LoadRulesScript(); } } }
private static X509CertificateCollection GetCertificateCollectionFromFile(string sClientCertificateFilename) { X509CertificateCollection x509CertificateCollection = null; if (!string.IsNullOrEmpty(sClientCertificateFilename)) { sClientCertificateFilename = Utilities.EnsurePathIsAbsolute(CONFIG.GetPath("Root"), sClientCertificateFilename); if (File.Exists(sClientCertificateFilename)) { x509CertificateCollection = new X509CertificateCollection(); x509CertificateCollection.Add(X509Certificate.CreateFromCertFile(sClientCertificateFilename)); } else { FiddlerApplication.Log.LogFormat("!! ERROR: Specified client certificate file '{0}' does not exist.", new object[] { sClientCertificateFilename }); } } return(x509CertificateCollection); }
private VersionStruct GetLatestVersion(bool isBeta) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(CONFIG.GetUrl("VerCheck") + isBeta.ToString()); if ((CONFIG.sGatewayUsername != null) && (CONFIG.sGatewayPassword != null)) { request.Proxy.Credentials = new NetworkCredential(CONFIG.sGatewayUsername, CONFIG.sGatewayPassword); } else { request.Proxy.Credentials = CredentialCache.DefaultCredentials; } request.UserAgent = string.Format("Fiddler/{0}{1} (.NET {2}; {3})", new object[] { Application.ProductVersion, CONFIG.bIsBeta ? " beta" : string.Empty, Environment.Version.ToString(), Environment.OSVersion.VersionString }); request.Headers.Add("Pragma: no-cache"); request.Referer = string.Format("http://fiddler2.com/client/{0}{1}", CONFIG.IsMicrosoftMachine ? "MSFT/" : string.Empty, CONFIG.FiddlerVersionInfo.ToString()); request.AllowAutoRedirect = true; request.KeepAlive = false; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); VersionStruct struct2 = new VersionStruct(); if (response.StatusCode == HttpStatusCode.OK) { StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); struct2.Major = int.Parse(reader.ReadLine()); struct2.Minor = int.Parse(reader.ReadLine()); struct2.Build = int.Parse(reader.ReadLine()); struct2.Private = int.Parse(reader.ReadLine()); struct2.sWhatIsNew = reader.ReadToEnd().Trim(); struct2.bMustCleanInstall = struct2.sWhatIsNew.Contains("CleanInstall"); int index = struct2.sWhatIsNew.IndexOf("@WELCOME@"); if (index > 0) { struct2.sWelcomeMsg = struct2.sWhatIsNew.Substring(index + 9).Trim(); struct2.sWhatIsNew = struct2.sWhatIsNew.Substring(0, index).Trim(); } } response.Close(); return(struct2); }
private void onNetworkPrefsChange(object sender, PrefChangeEventArgs oPCE) { if (oPCE.PrefName == "fiddler.network.sockets.ClientReadBufferSize") { ClientChatter._cbClientReadBuffer = FiddlerApplication.Prefs.GetInt32Pref("fiddler.network.sockets.ClientReadBufferSize", 0x2000); } if (oPCE.PrefName == "fiddler.network.sockets.ServerReadBufferSize") { ServerChatter._cbServerReadBuffer = FiddlerApplication.Prefs.GetInt32Pref("fiddler.network.sockets.ServerReadBufferSize", 0x8000); } if (oPCE.PrefName == "fiddler.network.egress.ip") { this.SetDefaultEgressEndPoint(oPCE.ValueString); } else if (oPCE.PrefName == "fiddler.network.https.NoDecryptionHosts") { CONFIG.SetNoDecryptList(oPCE.ValueString); } else if (oPCE.PrefName == "fiddler.network.proxy.RegistrationHostName") { CONFIG.sFiddlerListenHostPort = FiddlerApplication.Prefs.GetStringPref("fiddler.network.proxy.RegistrationHostName", "127.0.0.1") + ":" + CONFIG.ListenPort.ToString(); } }
internal static void EnsureFoldersExist() { try { if (!Directory.Exists(CONFIG.GetPath("Captures"))) { Directory.CreateDirectory(CONFIG.GetPath("Captures")); } if (!Directory.Exists(CONFIG.GetPath("Requests"))) { Directory.CreateDirectory(CONFIG.GetPath("Requests")); } if (!Directory.Exists(CONFIG.GetPath("Responses"))) { Directory.CreateDirectory(CONFIG.GetPath("Responses")); } if (!Directory.Exists(CONFIG.GetPath("Scripts"))) { Directory.CreateDirectory(CONFIG.GetPath("Scripts")); } } catch (Exception ex) { FiddlerApplication.DoNotifyUser(ex.ToString(), "Folder Creation Failed"); } try { if (!FiddlerApplication.Prefs.GetBoolPref("fiddler.script.delaycreate", true) && !File.Exists(CONFIG.GetPath("CustomRules")) && File.Exists(CONFIG.GetPath("SampleRules"))) { File.Copy(CONFIG.GetPath("SampleRules"), CONFIG.GetPath("CustomRules")); } } catch (Exception ex2) { FiddlerApplication.DoNotifyUser(ex2.ToString(), "Initial file copies failed"); } }
internal X509CertificateCollection GetCertificateCollectionFromFile(string sClientCertificateFilename) { X509CertificateCollection certificates = null; if (!string.IsNullOrEmpty(sClientCertificateFilename)) { try { if (!Path.IsPathRooted(sClientCertificateFilename)) { sClientCertificateFilename = CONFIG.GetPath("Root") + sClientCertificateFilename; } } catch (Exception) { } if (System.IO.File.Exists(sClientCertificateFilename)) { certificates = new X509CertificateCollection(); certificates.Add(X509Certificate.CreateFromCertFile(sClientCertificateFilename)); } } return(certificates); }
private void lnkBuilderHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Utilities.LaunchHyperlink(CONFIG.GetUrl("REDIR") + "REQUESTBUILDER"); }
private void lnkHelpOnPrefs_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Utilities.LaunchHyperlink(CONFIG.GetUrl("REDIR") + "FIDDLERPREFLIST"); }
// The OnExecAction function is called by either the QuickExec box in the Fiddler window, // or by the ExecAction.exe command line utility. public static bool OnExecAction(string[] sParams) { FiddlerApplication.UI.SetStatusText("ExecAction: " + sParams[0]); string sAction = sParams[0].ToLower(); switch (sAction) { case "bold": if (sParams.Length < 2) { uiBoldURI = null; FiddlerApplication.UI.SetStatusText("Bolding cleared"); return(false); } uiBoldURI = sParams[1]; FiddlerApplication.UI.SetStatusText("Bolding requests for " + uiBoldURI); return(true); case "bp": MessageBox.Show("bpu = breakpoint request for uri\nbpm = breakpoint request method\nbps=breakpoint response status\nbpafter = breakpoint response for URI"); return(true); case "bps": if (sParams.Length < 2) { bpStatus = -1; FiddlerApplication.UI.SetStatusText("Response Status breakpoint cleared"); return(false); } bpStatus = Int32.Parse(sParams[1]); FiddlerApplication.UI.SetStatusText("Response status breakpoint for " + sParams[1]); return(true); case "bpv": case "bpm": if (sParams.Length < 2) { bpMethod = null; FiddlerApplication.UI.SetStatusText("Request Method breakpoint cleared"); return(false); } bpMethod = sParams[1].ToUpper(); FiddlerApplication.UI.SetStatusText("Request Method breakpoint for " + bpMethod); return(true); case "bpu": if (sParams.Length < 2) { bpRequestURI = null; FiddlerApplication.UI.SetStatusText("RequestURI breakpoint cleared"); return(false); } bpRequestURI = sParams[1]; FiddlerApplication.UI.SetStatusText("RequestURI breakpoint for " + sParams[1]); return(true); case "bpa": case "bpafter": if (sParams.Length < 2) { bpResponseURI = null; FiddlerApplication.UI.SetStatusText("ResponseURI breakpoint cleared"); return(false); } bpResponseURI = sParams[1]; FiddlerApplication.UI.SetStatusText("ResponseURI breakpoint for " + sParams[1]); return(true); case "overridehost": if (sParams.Length < 3) { gs_OverridenHost = null; FiddlerApplication.UI.SetStatusText("Host Override cleared"); return(false); } gs_OverridenHost = sParams[1].ToLower(); gs_OverrideHostWith = sParams[2]; FiddlerApplication.UI.SetStatusText("Connecting to [" + gs_OverrideHostWith + "] for requests to [" + gs_OverridenHost + "]"); return(true); case "urlreplace": if (sParams.Length < 3) { gs_ReplaceToken = null; FiddlerApplication.UI.SetStatusText("URL Replacement cleared"); return(false); } gs_ReplaceToken = sParams[1]; gs_ReplaceTokenWith = sParams[2].Replace(" ", "%20"); // Simple helper FiddlerApplication.UI.SetStatusText("Replacing [" + gs_ReplaceToken + "] in URIs with [" + gs_ReplaceTokenWith + "]"); return(true); case "allbut": case "keeponly": if (sParams.Length < 2) { FiddlerApplication.UI.SetStatusText("Please specify Content-Type to retain during wipe."); return(false); } FiddlerApplication.UI.actSelectSessionsWithResponseHeaderValue("Content-Type", sParams[1]); FiddlerApplication.UI.actRemoveUnselectedSessions(); FiddlerApplication.UI.lvSessions.SelectedItems.Clear(); FiddlerApplication.UI.SetStatusText("Removed all but Content-Type: " + sParams[1]); return(true); case "stop": FiddlerApplication.UI.actDetachProxy(); return(true); case "start": FiddlerApplication.UI.actAttachProxy(); return(true); case "cls": case "clear": FiddlerApplication.UI.actRemoveAllSessions(); return(true); case "g": case "go": FiddlerApplication.UI.actResumeAllSessions(); return(true); case "goto": if (sParams.Length != 2) { return(false); } Utilities.LaunchHyperlink("http://www.google.com/search?hl=en&btnI=I%27m+Feeling+Lucky&q=" + Utilities.UrlEncode(sParams[1])); return(true); case "help": Utilities.LaunchHyperlink("http://fiddler2.com/r/?quickexec"); return(true); case "hide": FiddlerApplication.UI.actMinimizeToTray(); return(true); case "log": FiddlerApplication.Log.LogString((sParams.Length < 2) ? "User couldn't think of anything to say..." : sParams[1]); return(true); case "nuke": FiddlerApplication.UI.actClearWinINETCache(); FiddlerApplication.UI.actClearWinINETCookies(); return(true); case "screenshot": FiddlerApplication.UI.actCaptureScreenshot(false); return(true); case "show": FiddlerApplication.UI.actRestoreWindow(); return(true); case "tail": if (sParams.Length < 2) { FiddlerApplication.UI.SetStatusText("Please specify # of sessions to trim the session list to."); return(false); } FiddlerApplication.UI.TrimSessionList(int.Parse(sParams[1])); return(true); case "quit": FiddlerApplication.UI.actExit(); return(true); case "dump": FiddlerApplication.UI.actSelectAll(); FiddlerApplication.UI.actSaveSessionsToZip(CONFIG.GetPath("Captures") + "dump.saz"); FiddlerApplication.UI.actRemoveAllSessions(); FiddlerApplication.UI.SetStatusText("Dumped all sessions to " + CONFIG.GetPath("Captures") + "dump.saz"); return(true); default: if (sAction.StartsWith("http") || sAction.StartsWith("www")) { System.Diagnostics.Process.Start(sParams[0]); return(true); } else { FiddlerApplication.UI.SetStatusText("Requested ExecAction: '" + sAction + "' not found. Type HELP to learn more."); return(false); } } }
private void FiddlerApplication_CalculateReport(Session[] _arrSessions) { if (FiddlerApplication._frmMain.tabsViews.SelectedTab == FiddlerApplication._frmMain.pageStatistics) { try { if (_arrSessions.Length < 1) { this.Clear(); } else { Dictionary <string, long> dictionary; long num; string str = BasicAnalysis.ComputeBasicStatistics(_arrSessions, true, out dictionary, out num); this.txtReport.Text = string.Format("{0}\r\n================\r\nLearn more about HTTP performance at " + CONFIG.GetUrl("REDIR") + "HTTPPERF", str); if (this.pbPie.Height > 100) { this.pbPie.Image = this.DrawContentTypePie(dictionary, num); } } } catch (Exception) { } } }
public static void ReportException(Exception eX, string sTitle) { if (eX is ConfigurationErrorsException) { DoNotifyUser(string.Concat(new object[] { "Your Microsoft .NET Configuration file is corrupt and contains invalid data. You can often correct this error by installing updates from WindowsUpdate and/or reinstalling the .NET Framework.\r\n", eX.Message, "\n\nType: ", eX.GetType().ToString(), "\nSource: ", eX.Source, "\n", eX.StackTrace, "\n\n", eX.InnerException, "\nFiddler v", Application.ProductVersion, (8 == IntPtr.Size) ? " (x64) " : " (x86) ", " [.NET ", Environment.Version, " on ", Environment.OSVersion.VersionString, "] " }), sTitle, MessageBoxIcon.Hand); } else { string str; if (eX is OutOfMemoryException) { sTitle = "Out of Memory Error"; str = "An out-of-memory exception was encountered. To help avoid out-of-memory conditions, please see: " + CONFIG.GetUrl("REDIR") + "FIDDLEROOM\n\n"; } else { str = "Fiddler has encountered an unexpected problem. If you believe this is a bug in Fiddler, please copy this message by hitting CTRL+C, and submit a bug report using the Help | Send Feedback menu.\n\n"; } DoNotifyUser(string.Concat(new object[] { str, eX.Message, "\n\nType: ", eX.GetType().ToString(), "\nSource: ", eX.Source, "\n", eX.StackTrace, "\n\n", eX.InnerException, "\nFiddler v", Application.ProductVersion, (8 == IntPtr.Size) ? " (x64) " : " (x86) ", " [.NET ", Environment.Version, " on ", Environment.OSVersion.VersionString, "] " }), sTitle, MessageBoxIcon.Hand); } if (CONFIG.IsMicrosoftMachine) { logSelfHost(100); } Trace.Write(string.Concat(new object[] { eX.Message, "\n", eX.StackTrace, "\n", eX.InnerException })); }
private static ICertificateProvider LoadOverrideCertProvider() { string stringPref = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.assembly", CONFIG.GetPath("App") + "CertMaker.dll"); if (File.Exists(stringPref)) { Assembly assembly; try { assembly = Assembly.LoadFrom(stringPref); if (!Utilities.FiddlerMeetsVersionRequirement(assembly, "Certificate Maker")) { FiddlerApplication.Log.LogFormat("Assembly {0} did not specify a RequiredVersionAttribute. Aborting load of Certificate Generation module.", new object[] { assembly.CodeBase }); return(null); } } catch (Exception exception) { FiddlerApplication.LogAddonException(exception, "Failed to load CertMaker" + stringPref); return(null); } foreach (Type type in assembly.GetExportedTypes()) { if ((!type.IsAbstract && type.IsPublic) && (type.IsClass && typeof(ICertificateProvider).IsAssignableFrom(type))) { try { return((ICertificateProvider)Activator.CreateInstance(type)); } catch (Exception exception2) { FiddlerApplication.DoNotifyUser(string.Format("[Fiddler] Failure loading {0} CertMaker from {1}: {2}\n\n{3}\n\n{4}", new object[] { type.Name, assembly.CodeBase, exception2.Message, exception2.StackTrace, exception2.InnerException }), "Load Error"); } } } } return(null); }