private void btnBuilderExecute_Click(object sender, EventArgs e) { if (this.tabsBuilder.SelectedTab == this.pageRaw) { if (CONFIG.IsMicrosoftMachine) { FiddlerApplication.logSelfHost(40); } this.actSendRawRequest(); } else { if (CONFIG.IsMicrosoftMachine) { FiddlerApplication.logSelfHost(0x29); } this.actSendRequestFromWizard(Utilities.GetAsyncKeyState(0x10) < 0); } }
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(); } } }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Up: if (this.iCurrentCommand > 0) { this.iCurrentCommand--; base.Clear(); if (this.iCurrentCommand < this.slCommandHistory.Count) { this.SelectedText = this.slCommandHistory[this.iCurrentCommand]; } } return(true); case Keys.Down: if (this.iCurrentCommand < this.slCommandHistory.Count) { this.iCurrentCommand++; base.Clear(); if ((this.iCurrentCommand >= 0) && (this.iCurrentCommand < this.slCommandHistory.Count)) { this.SelectedText = this.slCommandHistory[this.iCurrentCommand]; } } return(true); case (Keys.Control | Keys.A): case (Keys.Alt | Keys.Q): base.SelectAll(); return(true); case Keys.Return: { string sCommand = this.Text.Trim(); if (sCommand.Length < 1) { base.Clear(); return(true); } if (this._OnExecute != null) { FiddlerApplication.logSelfHost(0x15); if (this._OnExecute(sCommand)) { base.AutoCompleteCustomSource.Add(sCommand); this.slCommandHistory.Add(sCommand); this.iCurrentCommand = this.slCommandHistory.Count; } } base.Clear(); return(true); } case Keys.Escape: if (this.SelectedText.Length > 0) { this.SelectedText = string.Empty; } else { base.Clear(); } return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }
static CONFIG() { try { IPGlobalProperties iPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); string domainName = iPGlobalProperties.DomainName; IsMicrosoftMachine = !string.IsNullOrEmpty(domainName) && domainName.EndsWith("microsoft.com", StringComparison.OrdinalIgnoreCase); sMachineNameLowerCase = iPGlobalProperties.HostName.ToLower(); iPGlobalProperties = null; } catch (Exception) { IsMicrosoftMachine = false; } RegistryKey oReg = Registry.LocalMachine.OpenSubKey(GetRegPath("LMIsBeta")); if (oReg != null) { bIsBeta = Utilities.GetRegistryBool(oReg, "IsBeta", bIsBeta); bVersionCheckBlocked = Utilities.GetRegistryBool(oReg, "BlockUpdateCheck", bVersionCheckBlocked); if (Utilities.GetRegistryBool(oReg, "ForceViewerMode", false)) { bIsViewOnly = true; } if (bVersionCheckBlocked) { bVersionCheck = false; } oReg.Close(); } oReg = Registry.CurrentUser.OpenSubKey(sRootKey); if (oReg != null) { m_bForceExclusivePort = Utilities.GetRegistryBool(oReg, "ExclusivePort", m_bForceExclusivePort); bUseEventLogForExceptions = Utilities.GetRegistryBool(oReg, "UseEventLogForExceptions", bUseEventLogForExceptions); m_bCheckForISA = Utilities.GetRegistryBool(oReg, "CheckForISA", m_bCheckForISA); m_TextEditor = (string)oReg.GetValue("TextEditor", m_TextEditor); m_CompareTool = (string)oReg.GetValue("CompareTool", m_CompareTool); bBreakOnImages = Utilities.GetRegistryBool(oReg, "BreakOnImages", bBreakOnImages); sHostsThatBypassFiddler = (string)oReg.GetValue("FiddlerBypass", string.Empty); sGatewayUsername = (string)oReg.GetValue("GatewayUsername", sGatewayUsername); sGatewayPassword = (string)oReg.GetValue("GatewayPassword", sGatewayPassword); sMakeCertParamsRoot = (string)oReg.GetValue("MakeCertParamsRoot", sMakeCertParamsRoot); sMakeCertParamsEE = (string)oReg.GetValue("MakeCertParamsEE", sMakeCertParamsEE); sMakeCertRootCN = (string)oReg.GetValue("MakeCertRootCN", sMakeCertRootCN); sMakeCertSubjectO = (string)oReg.GetValue("MakeCertSubjectO", sMakeCertSubjectO); m_JSEditor = (string)oReg.GetValue("JSEditor", m_JSEditor); ListenPort = Utilities.GetRegistryInt(oReg, "ListenPort", m_ListenPort); bLoadScript = Utilities.GetRegistryBool(oReg, "LoadScript", bLoadScript); bLoadInspectors = Utilities.GetRegistryBool(oReg, "LoadInspectors", bLoadInspectors); bLoadExtensions = Utilities.GetRegistryBool(oReg, "LoadExtensions", bLoadExtensions); foreach (string str2 in Environment.GetCommandLineArgs()) { if (str2.IndexOf("port:", StringComparison.OrdinalIgnoreCase) > -1) { int result = 0; if (int.TryParse(str2.Substring(str2.IndexOf("port:", StringComparison.OrdinalIgnoreCase) + 5), NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result)) { ListenPort = result; bUsingPortOverride = true; } } else if (str2.IndexOf("quiet", StringComparison.OrdinalIgnoreCase) == 1) { bQuietMode = true; if (IsMicrosoftMachine) { FiddlerApplication.logSelfHost(110); } } else if (str2.IndexOf("extoff", StringComparison.OrdinalIgnoreCase) == 1) { bLoadExtensions = bLoadInspectors = false; } else if (str2.IndexOf("noscript", StringComparison.OrdinalIgnoreCase) == 1) { bLoadScript = false; } else if (str2.IndexOf("viewer", StringComparison.OrdinalIgnoreCase) == 1) { bIsViewOnly = true; } } iHotkeyMod = Utilities.GetRegistryInt(oReg, "HotkeyMod", iHotkeyMod); iHotkey = Utilities.GetRegistryInt(oReg, "Hotkey", iHotkey); flFontSize = Utilities.GetRegistryFloat(oReg, "FontSize", flFontSize); flFontSize = Math.Min(flFontSize, 24f); flFontSize = Math.Max(flFontSize, 4f); int argb = Utilities.GetRegistryInt(oReg, "colorDisabledEdit", -1); if (argb != -1) { colorDisabledEdit = System.Drawing.Color.FromArgb(argb); } bAttachOnBoot = Utilities.GetRegistryBool(oReg, "AttachOnBoot", bAttachOnBoot); iStartupCount = (uint)(1 + Utilities.GetRegistryInt(oReg, "StartupCount", 0)); bAutoLoadScript = Utilities.GetRegistryBool(oReg, "AutoReloadScript", bAutoLoadScript); m_bAllowRemoteConnections = Utilities.GetRegistryBool(oReg, "AllowRemote", m_bAllowRemoteConnections); bReuseServerSockets = Utilities.GetRegistryBool(oReg, "ReuseServerSockets", bReuseServerSockets); bReuseClientSockets = Utilities.GetRegistryBool(oReg, "ReuseClientSockets", bReuseClientSockets); bAutoProxyLogon = Utilities.GetRegistryBool(oReg, "AutoProxyLogon", bAutoProxyLogon); bDebugSpew = Utilities.GetRegistryBool(oReg, "DebugSpew", bDebugSpew); bReportHTTPErrors = Utilities.GetRegistryBool(oReg, "ReportHTTPErrors", bReportHTTPErrors); if (bDebugSpew) { FiddlerApplication.Log.LogString("Fiddler DebugSpew is enabled."); Trace.WriteLine("Fiddler DebugSpew is enabled."); } bHideOnMinimize = Utilities.GetRegistryBool(oReg, "HideOnMinimize", bHideOnMinimize); bAlwaysShowTrayIcon = Utilities.GetRegistryBool(oReg, "AlwaysShowTrayIcon", bAlwaysShowTrayIcon); bForwardToGateway = Utilities.GetRegistryBool(oReg, "UseGateway", bForwardToGateway); bEnableIPv6 = Utilities.GetRegistryBool(oReg, "EnableIPv6", bEnableIPv6); bCaptureCONNECT = Utilities.GetRegistryBool(oReg, "CaptureCONNECT", bCaptureCONNECT); bCaptureFTP = Utilities.GetRegistryBool(oReg, "CaptureFTP", bCaptureFTP); bMapSocketToProcess = Utilities.GetRegistryBool(oReg, "MapSocketToProcess", bMapSocketToProcess); bUseXceedDecompressForGZIP = Utilities.GetRegistryBool(oReg, "UseXceedDecompressForGZIP", bUseXceedDecompressForGZIP); bUseXceedDecompressForDeflate = Utilities.GetRegistryBool(oReg, "UseXceedDecompressForDeflate", bUseXceedDecompressForDeflate); bUseAESForSAZ = Utilities.GetRegistryBool(oReg, "UseAESForSAZ", bUseAESForSAZ); bStreamAudioVideo = Utilities.GetRegistryBool(oReg, "AutoStreamAudioVideo", bStreamAudioVideo); bShowDefaultClientCertificateNeededPrompt = Utilities.GetRegistryBool(oReg, "ShowDefaultClientCertificateNeededPrompt", bShowDefaultClientCertificateNeededPrompt); bMITM_HTTPS = Utilities.GetRegistryBool(oReg, "CaptureHTTPS", bMITM_HTTPS); bIgnoreServerCertErrors = Utilities.GetRegistryBool(oReg, "IgnoreServerCertErrors", bIgnoreServerCertErrors); iReverseProxyForPort = Utilities.GetRegistryInt(oReg, "ReverseProxyForPort", iReverseProxyForPort); sReverseProxyHostname = (string)oReg.GetValue("ReverseProxyHostname", sReverseProxyHostname); bVersionCheck = Utilities.GetRegistryBool(oReg, "CheckForUpdates", bVersionCheck); iShowProcessFilter = (ProcessFilterCategories)Utilities.GetRegistryInt(oReg, "ShowProcessFilter", (int)iShowProcessFilter); m_sAdditionalScriptReferences = (string)oReg.GetValue("ScriptReferences", string.Empty); sHookConnectionNamed = (string)oReg.GetValue("HookConnectionNamed", sHookConnectionNamed); bHookAllConnections = Utilities.GetRegistryBool(oReg, "HookAllConnections", bHookAllConnections); bHookWithPAC = Utilities.GetRegistryBool(oReg, "HookWithPAC", bHookWithPAC); if (oReg.GetValue("HeaderEncoding") != null) { try { oHeaderEncoding = Encoding.GetEncoding((string)oReg.GetValue("HeaderEncoding")); } catch (Exception exception) { FiddlerApplication.DoNotifyUser(exception.Message, "Invalid HeaderEncoding specified in registry"); oHeaderEncoding = Encoding.UTF8; } } sUserPath = (string)oReg.GetValue("UserPath", sUserPath); if (!sUserPath.EndsWith(Path.DirectorySeparatorChar.ToString())) { sUserPath = sUserPath + Path.DirectorySeparatorChar; } sScriptPath = (string)oReg.GetValue("ScriptFullPath", sUserPath + @"Scripts\CustomRules.js"); oReg.Close(); } if ((Environment.OSVersion.Version.Major < 6) && (Environment.OSVersion.Version.Minor < 1)) { bMapSocketToProcess = false; } }