Process Filtering with Fiddler

Jordan picture Jordan · Dec 15, 2010 · Viewed 11.7k times · Source

Is there a way to filter out certain processes in Fiddler? Its very noisy currently, and I don't want it to show just one process.

Answer

Ben Hutchison picture Ben Hutchison · Jan 22, 2015

The built-in Show only traffic from option is useful if your process never exits and always has the same PID. In my case, my HTTP client was starting and exiting frequently, so I added this custom FiddlerScript.

Go to Rules > Customize Rules... to start editing CustomRules.js.

Add this inside the Handlers class

class Handlers
{
    RulesString("&Process filter", true)
    RulesStringValue(0, "&Chrome", "chrome")
    RulesStringValue(1, "&Firefox", "firefox")
    RulesStringValue(2, "&Internet Explorer", "iexplore")
    RulesStringValue(3, "&Opera", "opera")
    RulesStringValue(4, "&PhantomJS", "phantomjs")
    RulesStringValue(5, "&Custom...", "%CUSTOM%")
    public static var sProcessName: String = null;

    // leave the rest of the Handlers class as-is
}

Add this inside the OnBeforeRequest function

static function OnBeforeRequest(oSession: Session) {
    if (null != sProcessName) {
        var processInfo = oSession["X-PROCESSINFO"];
        if(!processInfo || !processInfo.StartsWith(sProcessName + ":")){
            oSession["ui-hide"] = "true";
            FiddlerObject.StatusText = " Process filter: " + sProcessName;
        }
    }

    // leave the rest of the OnBeforeRequest function as-is
}

Fiddler will apply your changes as soon as you save the CustomRules.js file.

To use, go to Rules > Process Filter and choose a browser, or use Custom and type in your executable's basename (e.g. iexplore).

Filtering applies to requests that start after you choose a process. Previous requests and Fiddler Composer requests are not affected.