65.9K
CodeProject is changing. Read more.
Home

Fiddler Extension - Fiddler Tap

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Aug 1, 2011

CPOL

2 min read

viewsIcon

19551

downloadIcon

534

Fiddler extension to tap all traffic to other host

Introduction

Fiddler is a good web debugging proxy. It is easy to use since it uses WinINET layer to capture all web traffic. However, as times goes on, it is not easy to find the session so we need to transform the data to another format and store in database. This article is to illustrate how to use the IFiddlerExtension and IAutoTamper interface to write our own plugin.

Background

The idea to tap the traffic to other host is to use HTTP post to send all related information stored in sessions to remote server. Host url is configured in the textbox of tap of fiddlertap. However, each post takes time since there is network latency. To avoid the performance deduction of Fiddler due to fiddlertap, use event to call another subroutine indirectly to avoid blocking.

Using the Code

I have attached the compiled extension and source code with zipped format separately.

You can simply put the compiled DLL in the Scripts folder of Fiddler. There will be a new tap in Fiddler.

fiddlertap.png

Each callback from FiddlerApplication will block the process of next session. Otherwise it will affect the performance of Fiddler itself. However, the idea of this plugin is to tap the session to remote host. There will be network latency when sending session's information. So we use non-block event handling to release the callback and use our own callback to process. As a result, you will see some new coming session finished their transaction before older session's transaction.

First, we have to define an event. We have to define an event object, event handler and event argument.

public static event TapPacketHandler EventTapPacket;
public delegate void TapPacketHandler(object o, TapPacketEventArgs e);
public class TapPacketEventArgs : EventArgs
{
    public readonly Session theSession;

    public TapPacketEventArgs(Session s)
    {
        theSession = s;
    }
}

Second, we trigger an event inside AutoTamperResponseAfter.

public void AutoTamperResponseAfter(Session oSess) {
   if (EventTapPacket != null && !bSwitch)
   {
       EventTapPacket(new object(), new TapPacketEventArgs(oSess));
   }
}

History

  • July 30, 2011 - This is the first version of the Fiddler extension, FiddlerTap