简体   繁体   English

使用C#和FiddlerCore收听特定的应用程序

[英]Listen to a specific application using C# and FiddlerCore

I'am trying to integrate C# Web Browser control and Fiddler Core. 我正在尝试集成C#Web Browser控件和Fiddler Core。 I wan't to do this by letting Fiddler Core to listen to the Web Browser control without affecting any internet explorer or other internet browsers. 我不想通过让Fiddler Core听取Web浏览器控件而不影响任何Internet Explorer或其他Internet浏览器来做到这一点。

The diagram below should show what I want to achieve: 下图应该显示我想要实现的目标:

Internet Explorer -> Internet
Chrome -> Internet
Other Browsers -> Internet
Web Browser Control (Custom C# App) -> Fiddler Core -> Internet

The four instance below should run parallel without fiddler core interfering with other browsers. 下面的四个实例应该并行运行而没有fiddler核心干扰其他浏览器。 So if I wan't to change the response HTML in my Custom App, this will not affect the other browsers. 因此,如果我不想在自定义应用程序中更改响应HTML,则不会影响其他浏览器。

I've been searching on Google for a while now but I cannot see any concrete example to get me started. 我已经在Google上搜索了一段时间,但我看不到任何具体的例子让我开始。

Thank you in advance guys, any help would be greatly appreciated. 提前谢谢你们,任何帮助将不胜感激。

FiddlerCore exposes the calling process information in each session's X-ProcessInfo flag. FiddlerCore在每个会话的X-ProcessInfo标志中公开调用进程信息。

By default, FiddlerCore will register as the system proxy and most applications will automatically route their traffic through it. 默认情况下,FiddlerCore将注册为系统代理,大多数应用程序将自动通过它进行路由。

If you want to capture traffic from only a single application, the steps are: 如果要仅从单个应用程序捕获流量,则步骤为:

  1. Don't register as the system proxy when calling .Startup . 调用.Startup时不要注册为系统代理。
  2. The target application's proxy settings must be pointed at FiddlerCore's port. 目标应用程序的代理设置必须指向FiddlerCore的端口。

Now #1 is trivial, but #2 is harder, and depends entirely on what networking code the target application uses. 现在#1是微不足道的,但#2更难,完全取决于目标应用程序使用的网络代码。 You mentioned that the target application is a custom C# application hosting the .NET Web Browser control (which is just IE). 您提到目标应用程序是托管.NET Web浏览器控件的自定义C#应用程序(它只是IE)。 If that's the case, and if the application is also hosting FiddlerCore, then you need only call 如果是这种情况,并且如果应用程序也托管FiddlerCore,那么您只需要调用

Fiddler.URLMonInterop.SetProxyInProcess("127.0.0.1:8889", String.Empty);

...inside of your application. ...在您的应用程序内部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM