Exemplo n.º 1
0
 static CONFIG()
 {
     CONFIG.sDefaultBrowserExe                        = "iexplore.exe";
     CONFIG.sDefaultBrowserParams                     = string.Empty;
     CONFIG.bRunningOnCLRv4                           = (Environment.Version.Major > 3);
     CONFIG.bQuietMode                                = !Environment.UserInteractive;
     CONFIG._pfcDecyptFilter                          = ProcessFilterCategories.All;
     CONFIG.sLVColInfo                                = null;
     CONFIG.bIsViewOnly                               = false;
     CONFIG.bUseXceedDecompressForGZIP                = false;
     CONFIG.bUseXceedDecompressForDeflate             = false;
     CONFIG.bMapSocketToProcess                       = true;
     CONFIG.bMITM_HTTPS                               = false;
     CONFIG.bUseSNIForCN                              = false;
     CONFIG.bIgnoreServerCertErrors                   = false;
     CONFIG.bStreamAudioVideo                         = false;
     CONFIG.bCheckCompressionIntegrity                = false;
     CONFIG.bShowDefaultClientCertificateNeededPrompt = true;
     CONFIG.sFiddlerListenHostPort                    = "127.0.0.1:8888";
     CONFIG.sMakeCertParamsRoot                       = "-r -ss my -n \"CN={0}{1}\" -sky signature -eku 1.3.6.1.5.5.7.3.1 -h 1 -cy authority -a sha1 -m 132 -b {3}{4}";
     CONFIG.sMakeCertParamsEE                         = "-pe -ss my -n \"CN={0}{1}\" -sky exchange -in {2} -is my -eku 1.3.6.1.5.5.7.3.1 -cy end -a sha1 -m 132 -b {3}{4}";
     CONFIG.sMakeCertRootCN                           = "DO_NOT_TRUST_FiddlerRoot";
     CONFIG.sMakeCertSubjectO                         = ", O=DO_NOT_TRUST, OU=Created by http://www.fiddler2.com";
     CONFIG.sRootUrl       = "http://fiddler2.com/fiddlercore/";
     CONFIG.sSecureRootUrl = "https://fiddler2.com/";
     CONFIG.sRootKey       = "SOFTWARE\\Microsoft\\FiddlerCore\\";
     CONFIG.sUserPath      = string.Concat(new object[]
     {
         CONFIG.GetPath("MyDocs"),
         Path.DirectorySeparatorChar,
         "FiddlerCore",
         Path.DirectorySeparatorChar
     });
     CONFIG.sScriptPath = string.Concat(new object[]
     {
         CONFIG.sUserPath,
         "Scripts",
         Path.DirectorySeparatorChar,
         "CustomRules.js"
     });
     CONFIG.bUseAESForSAZ = true;
     CONFIG.oAcceptedClientHTTPSProtocols = (SslProtocols)4092;
     CONFIG.oAcceptedServerHTTPSProtocols = SslProtocols.Default;
     CONFIG.FiddlerVersionInfo            = Assembly.GetExecutingAssembly().GetName().Version;
     CONFIG.bIsBeta                     = false;
     CONFIG.bForwardToGateway           = true;
     CONFIG._UpstreamGateway            = GatewayType.System;
     CONFIG.bDebugSpew                  = false;
     CONFIG.oHeaderEncoding             = Encoding.UTF8;
     CONFIG.oBodyEncoding               = Encoding.UTF8;
     CONFIG.bReuseServerSockets         = true;
     CONFIG.bReuseClientSockets         = true;
     CONFIG.bCaptureCONNECT             = true;
     CONFIG.bCaptureFTP                 = false;
     CONFIG.bUseEventLogForExceptions   = false;
     CONFIG.bAutoProxyLogon             = false;
     CONFIG.bEnableIPv6                 = (Environment.OSVersion.Version.Major > 5);
     CONFIG.sHookConnectionNamed        = "DefaultLAN";
     CONFIG.bHookAllConnections         = true;
     CONFIG.bHookWithPAC                = false;
     CONFIG.m_bCheckForISA              = true;
     CONFIG.m_ListenPort                = 8888;
     CONFIG.bUsingPortOverride          = false;
     CONFIG.bDebugCertificateGeneration = true;
     CONFIG.sAlternateHostname          = "?";
     CONFIG.sReverseProxyHostname       = "localhost";
     CONFIG.sMachineName                = string.Empty;
     CONFIG.sMachineDomain              = string.Empty;
     CONFIG.oHLSkipDecryption           = null;
     try
     {
         IPGlobalProperties iPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
         CONFIG.sMachineDomain = iPGlobalProperties.DomainName.ToLowerInvariant();
         CONFIG.sMachineName   = iPGlobalProperties.HostName.ToLowerInvariant();
     }
     catch (Exception)
     {
     }
     CONFIG.bQuietMode   = true;
     CONFIG.bDebugSpew   = false;
     CONFIG.m_ListenPort = 8866;
     if (Environment.OSVersion.Version.Major < 6 && Environment.OSVersion.Version.Minor < 1)
     {
         CONFIG.bMapSocketToProcess = false;
     }
 }
Exemplo n.º 2
0
        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;
            }
        }