Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 /// <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);
 }
Esempio n. 4
0
        public void Shutdown()
        {
            this.compositeDisposable.Dispose();

            FiddlerApplication.BeforeRequest -= this.SetUpstreamProxyHandler;
            FiddlerApplication.Shutdown();
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
 public void StopVisit()
 {
     FiddlerApplication.AfterSessionComplete -= FiddlerApplicationAfterSessionComplete;
     FiddlerApplication.Shutdown();
     IsRunning = FiddlerApplication.IsStarted();
     OnPropertyChanged("IsRunning");
 }
Esempio n. 7
0
 protected void DoExit()
 {
     //disable proxy
     this.AddMessage("Shutting down proxy...");
     FiddlerApplication.Shutdown();
     Thread.Sleep(1000);
 }
Esempio n. 8
0
        public void Start()
        {
            CaptureConfiguration.IgnoreResources = true;

            FiddlerApplication.AfterSessionComplete += AfterSession;
            FiddlerApplication.Startup(8888, true, true, true);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
            };
        }
Esempio n. 11
0
        private void SetProxy(int iPort = 8877)
        {
            //设置别名
            Fiddler.FiddlerApplication.SetAppDisplayName("FiddlerCoreHw");

            //启动方式
            //FiddlerCoreStartupFlags oFCSF = FiddlerCoreStartupFlags.Default;
            Fiddler.CONFIG.IgnoreServerCertErrors = false;
            FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true);


            //启动代理程序,开始监听http请求
            //端口,是否使用windows系统代理(如果为true,系统所有的http访问都会使用该代理)
            Fiddler.FiddlerApplication.Startup(iPort, false, true, true);

            int    iSecureEndpointPort     = 8888;
            string sSecureEndpointHostname = "127.0.0.1";
            Proxy  oSecureEndpoint         = null;

            // 我们还将创建一个HTTPS监听器,当FiddlerCore被伪装成HTTPS服务器有用
            // 而不是作为一个正常的CERN样式代理服务器。
            oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(iSecureEndpointPort, true, sSecureEndpointHostname);

            AddTXT("请将手机和电脑连接在同一网段");
            AddTXT("再设置手机WIFI的代理服务器为电脑IP");
            AddTXT("再设置手机WIFI的代理端口为8877");
            AddTXT("");
            AddTXT("开始监控 下面需要出现 成功链接代理 才能正常获取版本");


            Go();
        }
Esempio n. 12
0
        private void ShutdownFiddler()
        {
            FiddlerApplication.oProxy.Detach();
            Console.WriteLine("** Detached proxy");

            FiddlerApplication.Shutdown();
            Console.WriteLine("** Fiddler closed");

            logsPage.ExportToFile();
            MessageBoxResult result = MessageBox.Show("Do you want to uninstall certificate?", "SecureNet", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            switch (result)
            {
            case MessageBoxResult.Yes:
            {
                UninstallCertificate();
            }
            break;

            case MessageBoxResult.No:
            {
                break;
            }
            }
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
        public void SaveSessionsToFile()
        {
            bool   bSuccess  = false;
            string sFilename = GetSazFilePath();

            try
            {
                try
                {
                    Monitor.Enter(oAllSessions);
                    TranscoderTuple oExporter = FiddlerApplication.oTranscoders.GetExporter("SAZ");

                    if (null != oExporter)
                    {
                        var dictOptions = new Dictionary <string, object>();
                        dictOptions.Add("Filename", sFilename);
                        bSuccess = FiddlerApplication.DoExport("SAZ", oAllSessions.ToArray(), dictOptions, null);
                    }
                    else
                    {
                        WriteCommandResponse("Save failed because the SAZ Format Exporter was not available.");
                    }
                }
                finally
                {
                    Monitor.Exit(oAllSessions);
                }

                WriteCommandResponse(bSuccess ? ("Wrote: " + sFilename) : ("Failed to save: " + sFilename));
            }
            catch (Exception eX)
            {
                WriteCommandResponse("Save failed: " + eX.Message);
            }
        }
Esempio n. 15
0
        /// <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);
        }
Esempio n. 16
0
        /// <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;
        }
Esempio n. 17
0
        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);
            };
        }
Esempio n. 18
0
        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("启动代理成功");
        }
Esempio n. 19
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, "请在关闭软件前关闭嗅探服务。【否则可能无法正常上网】,尝试启动服务");
        }
Esempio n. 20
0
        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"));
        }
Esempio n. 21
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);
 }
Esempio n. 22
0
 private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (FiddlerApplication.IsStarted())
     {
         FiddlerApplication.Shutdown();
     }
 }
Esempio n. 23
0
        public void StartVisit()
        {
            if (IsRunning)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(SelectText))
            {
                MessageBox.Show(GlobalHelper.Get("remind_10"));
                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, GlobalHelper.Get("key_661"));
        }
Esempio n. 24
0
        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);
        }
Esempio n. 25
0
        private static void OnExportSessions(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog
            {
                Filter       = "HTTPArchive (*.har)|*.har",
                DefaultExt   = "har",
                AddExtension = true
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                logger.WriteLine("Exporting Sessions...");

                Session[] sessions = proxy.GetSessions();
                FiddlerApplication.oTranscoders.ImportTranscoders(Assembly.Load("BasicFormatsForCore"));

                var options = new Dictionary <string, object>
                {
                    { "Filename", dialog.FileName },
                    { "MaxTextBodyLength", 10 * 1024 * 1024 },
                    { "MaxBinaryBodyLength", 10 * 1024 * 1024 }
                };
                FiddlerApplication.DoExport("HTTPArchive v1.2", sessions, options, null);

                MessageBox.Show("Session export successful.", "Session export", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 26
0
 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);
 }
Esempio n. 27
0
 public void Dispose()
 {
     FiddlerApplication.Shutdown();
     FiddlerApplication.BeforeRequest -= this.sessionsPersister.AddSession;
     this.sessionsPersister.Cancel();
     this.sessionsPersister.PersistSessionsAsync(false).GetAwaiter().GetResult();
 }
 public void Start(int port)
 {
     //try
     //{
     FiddlerApplication.Startup(port, false, false);
     //}
 }
Esempio n. 29
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, "尝试启动服务");
        }
Esempio n. 30
0
 public Session[] ImportSessions(string sFormat, Dictionary <string, object> dictOptions, EventHandler <ProgressCallbackEventArgs> evtProgressNotifications)
 {
     if (sFormat == "HTTPArchive")
     {
         string str = null;
         if ((dictOptions != null) && dictOptions.ContainsKey("Filename"))
         {
             str = dictOptions["Filename"] as string;
         }
         if (string.IsNullOrEmpty(str))
         {
             str = Utilities.ObtainOpenFilename("Import " + sFormat, "HTTPArchive JSON (*.har)|*.har");
         }
         if (!string.IsNullOrEmpty(str))
         {
             try
             {
                 List <Session> listSessions = new List <Session>();
                 StreamReader   oSR          = new StreamReader(str, Encoding.UTF8);
                 HTTPArchiveJSONImport.LoadStream(oSR, listSessions, evtProgressNotifications);
                 oSR.Close();
                 return(listSessions.ToArray());
             }
             catch (Exception exception)
             {
                 FiddlerApplication.ReportException(exception, "Failed to import HTTPArchive");
                 return(null);
             }
         }
     }
     return(null);
 }