如何使用FiddlerCore捕获目标进程

时间:2015-03-26 09:49:24

标签: c# fiddler fiddlercore

我的代码目前捕获所有浏览器流量,但我想捕获目标进程(浏览器)

我使用Process.Start启动浏览器,然后我只需要此浏览器流量。

private void InitializeFiddler()
{
    FiddlerApplication.Shutdown();
    FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
    FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default);

    WebProxy myProxy = new WebProxy();
    Uri newUri = new Uri("http://localhost:8888");
    myProxy.Address = newUri;

    Process.Start("http://stackoverflow.com/");
}

private void FiddlerApplication_AfterSessionComplete(Session oSession)
{
    if (oSession.fullUrl.Contains(".mp3"))
    {    
        _streamUrl = oSession.fullUrl.Substring(0, oSession.fullUrl.Length - 5); ;          
    }
}

1 个答案:

答案 0 :(得分:3)

我找到了答案:

private void FiddlerApplication_AfterSessionComplete(Session oSession)
{
    if (oSession.LocalProcessID == 1234)
    {
        //
    }
}