Sali Hoo
Sali Hoo

Reputation: 753

MITM proxy using FiddlerCore

We want to implement a MITM proxy.

It should receive https requests from client, decrypt them and return pre-recorded responses.

It means that the proxy is not connected to remote server directly. I know that FiddlerCore supports MITM, but how can I possibly use it in my scenario?

Thanks

Upvotes: 0

Views: 647

Answers (1)

EricLaw
EricLaw

Reputation: 57085

https://groups.google.com/forum/#!topic/httpfiddler/E0JZrRRGhVg

This is a pretty straightforward task. If you look at the demo project included in FiddlerCore, you can get most of the way there.

Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
  {
    if (oSession.HTTPMethodIs("CONNECT")) { oSession.oFlags["X-ReplyWithTunnel"] = "Fake for HTTPS Tunnel"; return; }
    if (oS.uriContains("replaceme.txt"))
    {
        oS.utilCreateResponseAndBypassServer();
        oS.responseBodyBytes = SessionIWantToReturn.responseBodyBytes;
        oS.oResponse.headers = (HTTPResponseHeaders) SessionIWantToReturn.oResponse.headers.Clone();
    }
  };

Upvotes: 1

Related Questions