public static void Start(ushort listenPort, string hostname = "localhost") { if (FiddlerApplication.IsStarted()) { throw new Exception("Fiddler Proxy 已启动."); } CurrentPort = listenPort; _hostname = hostname; isStartDarkweb = false; FiddlerApplication.SetAppDisplayName("WFS6910"); FiddlerApplication.ResponseHeadersAvailable += ResponseHeadersAvailable; FiddlerApplication.Log.OnLogString += Log_OnLogString; FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); InstallCertificate(); var startupSettings = new FiddlerCoreStartupSettingsBuilder() .ListenOnPort(CurrentPort) .RegisterAsSystemProxy() .DecryptSSL() //.AllowRemoteClients() //.ChainToUpstreamGateway() .MonitorAllConnections() //.HookUsingPACFile() //.CaptureLocalhostTraffic() //.CaptureFTP() .OptimizeThreadPool() //.SetUpstreamGatewayTo("http=CorpProxy:80;https=SecureProxy:443;ftp=ftpGW:20") .Build(); FiddlerApplication.Startup(startupSettings); FiddlerApplication.oProxy.DetachedUnexpectedly += OProxy_DetachedUnexpectedly; }
public void StartVisit() { if (IsRunning) { return; } if (string.IsNullOrEmpty(URLFilter) && string.IsNullOrEmpty(this.ContentFilter)) { MessageBox.Show("请填写至少填写URL前缀或关键字中一项过滤规则"); return; } ControlExtended.SafeInvoke(() => { if (CanSave) { Documents.Clear(); } var url = URL; if (url.StartsWith("http") == false) { url = "http://" + url; } System.Diagnostics.Process.Start(url); FiddlerApplication.BeforeResponse += FiddlerApplicationAfterSessionComplete; FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default); IsRunning = FiddlerApplication.IsStarted(); OnPropertyChanged("IsRunning"); }, LogType.Important, "尝试启动服务"); }
public void StartVisit() { if (IsRunning) { return; } if (string.IsNullOrWhiteSpace(SelectText) && ConfigFile.Config.Get <bool>("AutoStartStopFiddler") == true) { MessageBox.Show(GlobalHelper.Get("remind_10")); return; } ControlExtended.SafeInvoke(() => { var url = URL; if (url.StartsWith("http") == false) { url = "http://" + url; } CONFIG.IgnoreServerCertErrors = true; CONFIG.bMITM_HTTPS = true; FiddlerApplication.AfterSessionComplete += FiddlerApplicationAfterSessionComplete; var port = ConfigFile.Config.Get <int>("FiddlerPort"); FiddlerApplication.Startup(port, true, true, true); System.Diagnostics.Process.Start(url); XLogSys.Print.Info(GlobalHelper.FormatArgs("fiddler_start", "localhost", port)); OnPropertyChanged("IsRunning"); }, LogType.Important, GlobalHelper.Get("key_661")); }
public void Start() { if (!FiddlerApplication.IsStarted()) { SubscribeToApplicationShuttingDown(); Fiddler.CONFIG.IgnoreServerCertErrors = false; Fiddler.CONFIG.bCaptureCONNECT = false; Fiddler.CONFIG.bCaptureFTP = false; Fiddler.CONFIG.bMITM_HTTPS = false; //FiddlerApplication.Prefs.SetInt32Pref("fiddler.network.timeouts.serverpipe.send.initial", -1); // Because we've chosen to decrypt HTTPS traffic, makecert.exe must // be present in the Application folder. var flags = FiddlerCoreStartupFlags.Default & (~FiddlerCoreStartupFlags.DecryptSSL) /*& (~FiddlerCoreStartupFlags.RegisterAsSystemProxy)*/; FiddlerApplication.Startup(FiddlerPort, flags); //URLMonInterop.SetProxyInProcess("127.0.0.1:" + FiddlerPort, ""); } else { FiddlerApplication.oProxy.Attach(); } System.Threading.Thread.Sleep(200); }
public void StartVisit() { if (IsRunning) { return; } if (string.IsNullOrWhiteSpace(SelectText)) { MessageBox.Show("请填写包含在页面中的关键字信息:【2.属性提取】->【搜索字符】"); return; } ControlExtended.SafeInvoke(() => { var url = URL; if (url.StartsWith("http") == false) { url = "http://" + url; } CONFIG.bMITM_HTTPS = true; FiddlerApplication.AfterSessionComplete += FiddlerApplicationAfterSessionComplete; FiddlerApplication.Startup(8888, true, true); System.Diagnostics.Process.Start(url); OnPropertyChanged("IsRunning"); }, LogType.Important, "启动嗅探服务"); }
/// <summary> /// Starts listening for HTTP/HTTPS requests/responses. /// </summary> public static void StartListening() { CertificateManager.CreateCertificate(); FiddlerApplication.OnWebSocketMessage += new EventHandler <WebSocketMessageEventArgs>(OnWebSocketMessage); FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); FiddlerApplication.Startup(0, FiddlerCoreStartupFlags.Default); }
public static void Start(int port, string[] urlTexts, Action <string, string> action) { _port = port; _urlRegexText = string.Join("|", urlTexts); _action = action; //创建证书 CONFIG.bCaptureCONNECT = true; CONFIG.IgnoreServerCertErrors = false; if (!CertMaker.rootCertExists()) { if (!CertMaker.createRootCert()) { throw new Exception("Unable to create cert for FiddlerCore."); } X509Store certStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine); certStore.Open(OpenFlags.ReadWrite); try { certStore.Add(CertMaker.GetRootCertificate()); } finally { certStore.Close(); } } FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse; FiddlerApplication.Startup(_port, true, true); Console.WriteLine("端口{0} 监听已启动...", _port); }
public void Start(int port) { if (FiddlerApplication.IsStarted()) { Shutdown(); FiddlerApplication.BeforeResponse -= FiddlerApplication_BeforeResponse; } if (!Fiddler.CertMaker.rootCertExists()) { if (!Fiddler.CertMaker.createRootCert()) { throw new Exception("Unable to create cert for FiddlerCore."); } } if (!Fiddler.CertMaker.rootCertIsTrusted()) { if (!Fiddler.CertMaker.trustRootCert()) { throw new Exception("Unable to install FiddlerCore's cert."); } } Fiddler.CONFIG.IgnoreServerCertErrors = isIgnoreCertError; Fiddler.CONFIG.bMITM_HTTPS = false; this.startPort = port; //FiddlerApplication.Startup(startPort, FiddlerCoreStartupFlags.DecryptSSL);//启动侦听 FiddlerApplication.Startup(startPort, FiddlerCoreStartupFlags.Default | FiddlerCoreStartupFlags.RegisterAsSystemProxy); //创建一个https侦听器,用于伪装成https服务器 FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); Fiddler.CertMaker.trustRootCert(); FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse;//注册事件,用于捕获网络流量 oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(iSecureEndpointPort, true, sSecureEndpointHostname); }
/// <summary> /// Engages Fiddler with HTTP header injection. /// </summary> /// <param name="headers"> /// The headers to inject, in key:value format. /// </param> /// <param name="port"> /// The proxy port to use. /// </param> public static void Initialize(string[] headers, int port) { // re-initialize the mandatory headers HeaderPairs.Clear(); foreach (var header in headers) { var tokens = header.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (tokens.Length == 2) { HeaderPairs.Add(new KeyValuePair <string, string>(tokens[0], tokens[1])); } } // don't start if already started if (hasStarted) { return; } FiddlerApplication.BeforeRequest += FiddlerApplicationOnBeforeRequest; FiddlerApplication.BeforeResponse += FiddlerApplicationOnBeforeResponse; FiddlerApplication.Startup(port, FiddlerCoreStartupFlags.Default); hasStarted = true; }
void StartFiddler() { if (FiddlerApplication.IsStarted()) { FiddlerApplication.Shutdown(); Console.WriteLine("** Closing previous instance of Fiddler"); } //Retrieval of cert if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["FiddlerCert"])) { Console.WriteLine("** Retrieving certificate"); FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.key", ConfigurationManager.AppSettings["FiddlerKey"]); FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.cert", ConfigurationManager.AppSettings["FiddlerCert"]); } //Creation of cert InstallCertificate(); FiddlerApplication.Startup(0, FiddlerCoreStartupFlags.Default); Console.WriteLine("** Fiddler Start"); FiddlerApplication.OnNotification += delegate(object sender, NotificationEventArgs oNEA) { Console.WriteLine("** NotifyUser: "******"** LogString: " + oLEA.LogString); }; }
public void Start() { CaptureConfiguration.IgnoreResources = true; FiddlerApplication.AfterSessionComplete += AfterSession; FiddlerApplication.Startup(8888, true, true, true); }
public void StartFiddler() { Common.Log("Starting Fiddler Proxy on port " + proxyPort); string sSAZInfo = "NoSAZ"; if (!FiddlerApplication.oTranscoders.ImportTranscoders(Assembly.GetExecutingAssembly())) { DiagnosticLog.WriteLine("This assembly was not compiled with a SAZ-exporter"); } else { sSAZInfo = SAZFormat.GetZipLibraryInfo(); } CONFIG.IgnoreServerCertErrors = true; FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); FiddlerCoreStartupFlags oFCSF = (FiddlerCoreStartupFlags.AllowRemoteClients | FiddlerCoreStartupFlags.DecryptSSL | FiddlerCoreStartupFlags.MonitorAllConnections | // FiddlerCoreStartupFlags.RegisterAsSystemProxy | FiddlerCoreStartupFlags.ChainToUpstreamGateway | FiddlerCoreStartupFlags.CaptureLocalhostTraffic); FiddlerApplication.Startup(proxyPort, false, true, true); oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(iSecureEndpointPort, true, sSecureEndpointHostname); }
void Start() { if (tbIgnoreResources.Checked) { CaptureConfiguration.IgnoreResources = true; } else { CaptureConfiguration.IgnoreResources = false; } string strProcId = txtProcessId.Text; if (strProcId.Contains('-')) { strProcId = strProcId.Substring(strProcId.IndexOf('-') + 1).Trim(); } strProcId = strProcId.Trim(); int procId = 0; if (!string.IsNullOrEmpty(strProcId)) { if (!int.TryParse(strProcId, out procId)) { procId = 0; } } CaptureConfiguration.ProcessId = procId; CaptureConfiguration.CaptureDomain = txtCaptureDomain.Text; FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete; FiddlerApplication.Startup(App.Configuration.UrlCapture.ProxyPort, true, true, true); }
/// <summary> /// 指定ポートで Listening を開始する。 /// Shutdown() を呼び出さずに2回目の Startup() を呼び出した場合、InvalidOperationException が発生する。 /// </summary> /// <param name="listeningPort">Listeningするポート。</param> /// <param name="useIpV6">falseの場合、127.0.0.1で待ち受ける。trueの場合、::1で待ち受ける。既定false。</param> /// <param name="isSetProxyInProcess">trueの場合、プロセス内IEプロキシの設定を実施し、HTTP通信をNekoxyに向ける。既定true。</param> public static void Startup(int listeningPort, bool useIpV6 = false, bool isSetProxyInProcess = true) { if (IsInListening) { throw new InvalidOperationException("Calling Startup() twice without calling Shutdown() is not permitted."); } FiddlerApplication.BeforeRequest += setUpstreamProxyHandler; FiddlerApplication.AfterSessionComplete += raiseAfterSessionComplete; FiddlerApplication.RequestHeadersAvailable += raiseRequestHeadersAvailable; FiddlerApplication.ResponseHeadersAvailable += raiseResponseHeadersAvailable; ListeningPort = listeningPort; try { if (isSetProxyInProcess) { WinInetUtil.SetProxyInProcessForNekoxy(listeningPort); } readGatewayConfig(); FiddlerApplication.Startup(listeningPort, FiddlerCoreStartupFlags.ChainToUpstreamGateway); } catch (Exception) { Shutdown(); throw; } }
public Core(int unsecurePort, int securePort) { FiddlerApplication.SetAppDisplayName("DaX.Core"); FiddlerApplication.OnNotification += FiddlerApplication_OnNotification; FiddlerApplication.Log.OnLogString += Log_OnLogString; FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest; FiddlerApplication.OnReadResponseBuffer += FiddlerApplication_OnReadResponseBuffer; FiddlerApplication.ResponseHeadersAvailable += FiddlerApplication_ResponseHeadersAvailable; FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse; FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete; Console.WriteLine(String.Format("Starting {0} ...", FiddlerApplication.GetVersionString())); CONFIG.IgnoreServerCertErrors = false; FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); FiddlerCoreStartupFlags oFCSF = FiddlerCoreStartupFlags.Default; oFCSF = FiddlerCoreStartupFlags.Default & ~FiddlerCoreStartupFlags.RegisterAsSystemProxy; FiddlerApplication.Startup(unsecurePort, oFCSF); FiddlerApplication.Log.LogFormat("Created endpoint listening on port {0}", unsecurePort); FiddlerApplication.Log.LogFormat("Starting with settings: [{0}]", oFCSF); FiddlerApplication.Log.LogFormat("Gateway: {0}", CONFIG.UpstreamGateway.ToString()); oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(securePort, true, sSecureEndpointHostname); if (null != oSecureEndpoint) { FiddlerApplication.Log.LogFormat("Created secure endpoint listening on port {0}, using a HTTPS certificate for '{1}'", securePort, sSecureEndpointHostname); } }
private void btnstart_Click(object sender, EventArgs e) { WriteCommandResponse("btnstart_Click"); btnout.Enabled = true; btnstart.Enabled = false; // 启动方式 FiddlerCoreStartupFlags oFCSF = FiddlerCoreStartupFlags.Default; // Uncomment the next line if you don't want to decrypt SSL traffic. // oFCSF = (oFCSF & ~FiddlerCoreStartupFlags.DecryptSSL); // 启动代理程序,开始监听http请求 // 参数: 端口,是否使用windows系统代理(如果为true,系统所有的http访问都会使用该代理) FiddlerApplication.Startup(iPort, true, true, true); // We'll also create a HTTPS listener, useful for when FiddlerCore is masquerading as a HTTPS server // instead of acting as a normal CERN-style proxy server. oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(iSecureEndpointPort, true, sSecureEndpointHostname); if (null != oSecureEndpoint) { FiddlerApplication.Log.LogFormat("Created secure endpoint listening on port {0}, using a HTTPS certificate for '{1}'", iSecureEndpointPort, sSecureEndpointHostname); } else { log("Start SecureEndpointPort failed!"); } log("启动代理成功"); }
public void Start() { var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); path = path.Replace("file:\\", ""); if (!path.EndsWith(@"\")) { path += @"\"; } path += "FiddlerRoot.cer"; FiddlerApplication.oDefaultClientCertificate = new X509Certificate(path); FiddlerApplication.BeforeRequest += ProcessBeginRequest; FiddlerApplication.AfterSessionComplete += ProcessEndResponse; CONFIG.IgnoreServerCertErrors = true; FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.ForgetStreamedData", false); FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); _oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(_sslPort, true, _hostName); if (null == _oSecureEndpoint) { throw new Exception("could not start up secure endpoint"); } FiddlerApplication.Startup(_port, false, true, true); }
void Start() { if (tbIgnoreResources) { CaptureConfiguration.IgnoreResources = true; } else { CaptureConfiguration.IgnoreResources = false; } string strProcId = ""; int procId = 0; if (!string.IsNullOrEmpty(strProcId)) { if (!int.TryParse(strProcId, out procId)) { procId = 0; } } CaptureConfiguration.ProcessId = procId; CaptureConfiguration.CaptureDomain = "";//domain FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete; FiddlerApplication.Startup(listenport, true, true, true); }
private void requestLogger() { // Fixes invalid certificate. CertOverrideService.GetService().ValidityOverride += geckoWebBrowser_ValidityOverride; FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest; FiddlerApplication.Startup(8764, false, true); }
public void Start(int port) { //try //{ FiddlerApplication.Startup(port, false, false); //} }
public void Start() { FiddlerApplication.Startup(3128, FiddlerCoreStartupFlags.Default); var proxy = FiddlerApplication.oProxy; FiddlerApplication.BeforeRequest += OnBeforeRequest; }
/// <summary> /// Starts the proxy /// </summary> public void Start() { //Stops everything before start Stop(); FiddlerApplication.BeforeRequest += delegate(Session session) { //Console.WriteLine(session.host); if (session.host == "v3.uberorbit.net") { session.bBufferResponse = true; } }; FiddlerApplication.BeforeResponse += delegate(Session session) { if (session.host == "v3.uberorbit.net" && session.PathAndQuery.Contains("main.swf")) { session.utilDecodeResponse(); session["x-replywithfile"] = Application.StartupPath + @"\main.swf"; OnMainReplaced(); Console.WriteLine("Successfuly replaced main.swf"); } }; FiddlerApplication.Startup(Port, true, DecryptSsl); }
public static void Start() { LogEntry("Starting proxy..."); FiddlerCoreStartupFlags fcsf = FiddlerCoreStartupFlags.None; FiddlerApplication.Startup((int)Config.Port, fcsf); FiddlerApplication.BeforeRequest += NeedBufferResponse; if (Config.UseProxy) { FiddlerApplication.BeforeRequest += NeedSetProxy; } if (Config.ForceIp) { FiddlerApplication.BeforeRequest += NeedSetIp; } FiddlerApplication.BeforeResponse += OnResponse; LogEntry($"Proxy started, listening at port {Config.Port}"); if (Config.UsePac) { LogEntry("Starting PAC Server..."); string pacUrl = $"http://localhost:{Config.PacPort}/pac/"; _ws = new WebServer(WebServer.SendResponse, pacUrl); _ws.Run(); LogEntry($"PAC Server started. Please set system proxy to {pacUrl}"); } }
public static void StartListening(int port) { FiddlerApplication.Startup(port, false, true, false); FiddlerApplication.OnNotification += (sender, oNEA) => Log("** NotifyUser: "******"** LogString: " + oLEA.LogString); FiddlerApplication.BeforeRequest += oS => { Log("BeforeRequest:" + oS.fullUrl); lock (sessions) { sessions.Add(new FiddlerSessionHolder(oS, SessionStackComplete)); } }; FiddlerApplication.BeforeResponse += oS => { Log(String.Format("BeforeResponse: {0}:HTTP {1} for {2}", oS.id, oS.responseCode, oS.fullUrl)); }; FiddlerApplication.AfterSessionComplete += oS => { Log("SessionComplete:" + oS.fullUrl); if (FiddlerWindow.Instance == null) { return; } App.CurrentApp.InRenderAction((_) => FiddlerWindow.Instance.AddSessionStep(new FiddlerSessionHolder(oS, SessionStackComplete)) , null, true); }; }
public void Initialize() { //FiddlerApplication.OnNotification += delegate(object sender, NotificationEventArgs oNEA) { Console.WriteLine("** NotifyUser: "******"** LogString: " + oLEA.LogString); }; FiddlerApplication.BeforeRequest += new SessionStateHandler(BeforeRequestCallback); FiddlerApplication.BeforeResponse += new SessionStateHandler(BeforeResponseCallback); FiddlerApplication.AfterSessionComplete += new SessionStateHandler(AfterSessionCompleteCallback); CONFIG.IgnoreServerCertErrors = false; FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); // For forward-compatibility with updated FiddlerCore libraries, it is strongly recommended that you // start with the DEFAULT options and manually disable specific unwanted options. FiddlerCoreStartupFlags oFCSF = FiddlerCoreStartupFlags.Default; // E.g. uncomment the next line if you don't want FiddlerCore to act as the system proxy // oFCSF = (oFCSF & ~FiddlerCoreStartupFlags.RegisterAsSystemProxy); // or uncomment the next line if you don't want to decrypt SSL traffic. // oFCSF = (oFCSF & ~FiddlerCoreStartupFlags.DecryptSSL); // // NOTE: Because we haven't disabled the option to decrypt HTTPS traffic, makecert.exe // must be present in this executable's folder. const int listenPort = 8877; FiddlerApplication.Startup(listenPort, oFCSF); oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(7777, true, sSecureEndpointHostname); }
public void StartVisit() { if (IsRunning) { return; } if (string.IsNullOrWhiteSpace(SelectText)) { MessageBox.Show("请填写包含在页面中的关键字信息:【2.属性提取】->【搜索字符】"); return; } ControlExtended.SafeInvoke(() => { IsJson2xml = true; var url = URL; if (url.StartsWith("http") == false) { url = "http://" + url; } System.Diagnostics.Process.Start(url); FiddlerApplication.BeforeResponse += FiddlerApplicationAfterSessionComplete; FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default); IsRunning = FiddlerApplication.IsStarted(); OnPropertyChanged("IsRunning"); }, LogType.Important, "请在关闭软件前关闭嗅探服务。【否则可能无法正常上网】,尝试启动服务"); }
public void startup() { FiddlerApplication.AfterSessionComplete += delegate(Session http) { if (http.fullUrl.Contains("banner") && http.fullUrl.Contains("habbo")) { // Download? string token = http.fullUrl.Split('=')[1]; string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\banner.png"; http.SaveResponseBody(dir); FiddlerApplication.Shutdown(); LemonEnvironment.proxiedBanner = true; } }; FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true); FiddlerCoreStartupFlags oFlags = FiddlerCoreStartupFlags.Default; oFlags = (oFlags & ~FiddlerCoreStartupFlags.DecryptSSL); FiddlerApplication.Startup(12345, oFlags); }
static void Main(string[] args) { if (args.Length < 1) { String exeName = System.Reflection.Assembly.GetExecutingAssembly().Location; Console.WriteLine($"Usage: {exeName} <process name or partial name>"); Console.WriteLine($"\t e.g. {exeName} microsoftedgecp"); Console.ReadLine(); } procName = args[0]; Console.WriteLine($"Process to watch: {procName}"); InstallCertificate(); FiddlerApplication.SetAppDisplayName("FiddlerCoreDemoApp"); FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest; FiddlerApplication.OnNotification += FiddlerApplication_OnNotification; //FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete; Console.CancelKeyPress += Console_CancelKeyPress; Fiddler.CONFIG.IgnoreServerCertErrors = true; FiddlerApplication.Startup(9093, true, true, false); Console.WriteLine($"Fiddler is started? {FiddlerApplication.IsStarted().ToString()}"); do { Console.ReadLine(); } while (!isDone); }
protected override void OnStartup(StartupEventArgs e) { DispatcherHelper.UIDispatcher = this.Dispatcher; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // 証明書インストール if (!CertMaker.rootCertExists()) { CertMaker.createRootCert(); CertMaker.trustRootCert(); } // プロキシサーバー開始 FiddlerApplication.Startup(24791, true, true); this.MainWindow = new MainWindow() { DataContext = new MainWindowViewModel() }; this.MainWindow.ShowDialog(); // プロキシサーバー終了 URLMonInterop.ResetProxyInProcessToDefault(); FiddlerApplication.Shutdown(); }
//Starting fiddler, Called by Webdriver during initialization, accepts any valid ports and returns //the port fiddler runs on. //The same port has to be passed for webdriver to use, so that fiddler can start sniffing the traffic. public static int StartFiddlerProxy(int desiredPort) { //Setting up flags for fiddler FiddlerCoreStartupFlags flags = FiddlerCoreStartupFlags.Default & ~FiddlerCoreStartupFlags.RegisterAsSystemProxy; //If the desiredPort is 0, fiddler will randomly choose any of the port and register it. FiddlerApplication.Startup(desiredPort, flags); //pick the proxyport used by fiddler proxyPort = FiddlerApplication.oProxy.ListenPort; // a simple debugger to see if the Fiddlerapplication is actually started bool fid = FiddlerApplication.IsStarted(); int iProcCount = Environment.ProcessorCount; int iMinWorkerThreads = Math.Max(16, 6 * iProcCount); int iMinIOThreads = iProcCount; if ((iMinWorkerThreads > 0) && (iMinIOThreads > 0)) { System.Threading.ThreadPool.SetMinThreads(iMinWorkerThreads, iMinIOThreads); } return(proxyPort); }