Exemple #1
0
 public void StopVisit()
 {
     FiddlerApplication.AfterSessionComplete -= FiddlerApplicationAfterSessionComplete;
     FiddlerApplication.Shutdown();
     IsRunning = FiddlerApplication.IsStarted();
     OnPropertyChanged("IsRunning");
 }
 public static void StopAutoResponding()
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
 }
Exemple #3
0
        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, "请在关闭软件前关闭嗅探服务。【否则可能无法正常上网】,尝试启动服务");
        }
Exemple #4
0
 /// <summary>关闭fiddlercore设置的代理</summary>
 private static void UninstallFiddler()
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
 }
Exemple #5
0
      public void UpdateButtonStatus()
      {
          tbCapture.Enabled = !FiddlerApplication.IsStarted();
          tbStop.Enabled    = !tbCapture.Enabled;
          tbSave.Enabled    = txtCapture.Text.Length > 0;
          tbClear.Enabled   = tbSave.Enabled;

          if (CertMaker.rootCertExists())
          {
              la_certState.Text = "Installed";
          }
          else
          {
              la_certState.Text = "Don't Installed";
          }

          if (!tbCapture.Enabled)
          {
              la_State.Text = "Started";
          }
          else
          {
              la_State.Text = "Stopped";
          }

          CaptureConfiguration.IgnoreResources = tbIgnoreResources.Checked;
      }
Exemple #6
0
        //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);
        }
Exemple #7
0
 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);
 }
Exemple #8
0
        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);
        }
        void timer_Tick(object sender, EventArgs e)
        {
            //Check if any Capture is working
            //End the existing

            DoPrep();


            if (vc.GetRecorderState().Equals(Screna.RecorderState.Recording))
            {
                vc.StopRecording();
            }

            if (FiddlerApplication.IsStarted())
            {
                FinishFiddlerCapturing();
            }


            //Start all the capture function.

            vc.StartRecording(textBox1.Text.Trim());
            StartFiddlerCapturing();

            RunPsPing(textBox1.Text.Trim());
        }
 public void Stop()
 {
     Console.WriteLine("Shut down Fiddler Application.");
     #region Unsubscribe Event handlers
     FiddlerApplication.AfterSessionComplete -= FiddlerApplication_AfterSessionComplete;
     // explicitly unsubscribe dangling events
     FiddlerApplication.OnNotification  -= FiddlerApplication_OnNotification;
     FiddlerApplication.Log.OnLogString -= FiddlerApplication_OnLogString;
     FiddlerApplication.BeforeRequest   -= FiddlerApplication_BeforeRequest;
     FiddlerApplication.BeforeResponse  -= FiddlerApplication_BeforeResponse;
     // alternative cleanup ?
     // http://stackoverflow.com/questions/91778/how-to-remove-all-event-handlers-from-a-control
     FiddlerApplication.OnNotification  += delegate(object sender, NotificationEventArgs e) {
     };
     FiddlerApplication.Log.OnLogString += delegate(object sender, Fiddler.LogEventArgs e) {
     };
     FiddlerApplication.BeforeRequest   += delegate {
     };
     FiddlerApplication.BeforeResponse  += delegate {
     };
     // https://bytes.com/topic/c-sharp/answers/274921-removing-all-event-handlers
     #endregion
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
     System.Threading.Thread.Sleep(1);
 }
 private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
 }
Exemple #12
0
        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);
            };
        }
Exemple #13
0
        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 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;
        }
 /// <summary>
 /// 动态开启系统代理
 /// </summary>
 public static void OpenSystemProxy()
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.oProxy.Attach();
     }
 }
 /// <summary>
 /// 动态关闭系统代理
 /// </summary>
 public static void CloseSystemProxy()
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.oProxy.Detach();
     }
 }
Exemple #17
0
        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);
        }
Exemple #18
0
 public void Stop()
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.oProxy.Detach();
         System.Threading.Thread.Sleep(200);
     }
 }
Exemple #19
0
 private void ShutDown()
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
         System.Threading.Thread.Sleep(200);
     }
 }
Exemple #20
0
 public void Stop()
 {
     FiddlerApplication.AfterSessionComplete -= HandleFiddlerSessionComplete;
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
 }
Exemple #21
0
 public void Stop()
 {
     FiddlerApplication.AfterSessionComplete -= FiddlerApplication_AfterSessionComplete;
     if (!FiddlerApplication.IsStarted())
     {
         return;
     }
     FiddlerApplication.Shutdown();
 }
Exemple #22
0
        private static void Stop()
        {
            FiddlerApplication.BeforeRequest        -= FiddlerApplication_BeforeRequest;
            FiddlerApplication.AfterSessionComplete -= FiddlerApplication_AfterSessionComplete;

            if (FiddlerApplication.IsStarted())
            {
                FiddlerApplication.Shutdown();
            }
        }
Exemple #23
0
      void Stop()
      {
          FiddlerApplication.AfterSessionComplete -= FiddlerApplication_AfterSessionComplete;

          if (FiddlerApplication.IsStarted())
          {
              FiddlerApplication.Shutdown();
          }
          UninstallCertificate();
      }
Exemple #24
0
 public void StartCapture()
 {
     if (!FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Startup(port, true, false, true);
         log("startup");
         mainForm.CapturePLinkToolStripMenuItem.Checked = true;
         mainForm.CapturePLinkToolStripMenuItem.Text    = "Capture Start!";
     }
 }
Exemple #25
0
 public void StopCapture()
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
         log("shutdown");
         mainForm.CapturePLinkToolStripMenuItem.Checked = false;
         mainForm.CapturePLinkToolStripMenuItem.Text    = "Capture Stop!";
     }
 }
Exemple #26
0
 void Stop()
 {
     FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
     FiddlerApplication.BeforeResponse       -= FiddlerApplication_BeforeResponse;
     //FiddlerApplication.BeforeReturningError -= FiddlerApplication_BeforeReturningError;
     FiddlerApplication.BeforeRequest -= FiddlerApplication_BeforeRequest;
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
 }
Exemple #27
0
 public void StopVisit()
 {
     FiddlerApplication.AfterSessionComplete -= FiddlerApplicationAfterSessionComplete;
     FiddlerApplication.Shutdown();
     if (CanSave && Documents.Count > 0)
     {
         SysDataManager.AddDataCollection(Documents.Select(d => d.DictSerialize(Scenario.Other)), "爬虫记录");
     }
     IsRunning = FiddlerApplication.IsStarted();
     OnPropertyChanged("IsRunning");
 }
Exemple #28
0
 public void UpdateButtonStatus()
 {
     if (FiddlerApplication.IsStarted())
     {
         button1.Text = "停止抓取";
     }
     else
     {
         button1.Text = "开始抓取";
     }
 }
Exemple #29
0
 public static void Stop()
 {
     if (FiddlerApplication.oProxy != null)
     {
         FiddlerApplication.oProxy.DetachedUnexpectedly -= NotifyProxyChanged;
     }
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
     Thread.Sleep(500);
 }
Exemple #30
0
        public void UpdateButtonStatus()
        {
            tbCapture.Enabled = !FiddlerApplication.IsStarted();
            tbStop.Enabled    = !tbCapture.Enabled;
            tbSave.Enabled    = txtCapture.Text.Length > 0;
            tbClear.Enabled   = tbSave.Enabled;

            btnInstallSslCert.Enabled   = !CertMaker.rootCertExists();
            btnUninstallSslCert.Enabled = !btnInstallSslCert.Enabled;

            CaptureConfiguration.IgnoreResources = tbIgnoreResources.Checked;
        }