Search code examples
c#proxy-serverfiddlercore

How to capture an SSL GET request with FiddleCore


I'm trying to get the full HTTPS url for each request. So far I'm getting only a CONNECT request with the domain url

How can I get the full URL request?

This is my code so far

Fiddler.FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest;
Fiddler.FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse;


if (!Fiddler.CertMaker.rootCertExists())
{
   if (!Fiddler.CertMaker.createRootCert())
   {
       throw new Exception("Unable to create cert for FiddlerCore.");
   }
}

if (!Fiddler.CertMaker.rootCertIsTrusted())
{
   if (!Fiddler.CertMaker.trustRootCert())
   {
      throw new Exception("Unable to install FiddlerCore's cert.");
   }
}

Fiddler.FiddlerApplication.Startup(0,
            FiddlerCoreStartupFlags.Default |
            FiddlerCoreStartupFlags.AllowRemoteClients |
            FiddlerCoreStartupFlags.DecryptSSL |
            FiddlerCoreStartupFlags.MonitorAllConnections |
            FiddlerCoreStartupFlags.RegisterAsSystemProxy |
            FiddlerCoreStartupFlags.ChainToUpstreamGateway |
            FiddlerCoreStartupFlags.CaptureLocalhostTraffic);



void FiddlerApplication_BeforeResponse(Session oSession)
{
        if (oSession.uriContains("youtube"))
        {
            Console.WriteLine(Osession.fullUrl());
        }
}

void FiddlerApplication_BeforeRequest(Session oSession)
{
        if (oSession.uriContains("youtube"))
        {
            Console.WriteLine(Osession.fullUrl());
            oSession.bBufferResponse = true;
        }
}

With the browser help I'm trying to reach https://www.youtube.com/watch?v=v-gzrWQO7VI URL. Can the fiddler catch it?

Thanks a million. Ran


Solution

  • Sure, Fiddler can capture this. If you're only seeing the CONNECT that implies that the client isn't trusting Fiddler's certificate. You should put back the lines that log notifications and errors; my guess is that you'll see one noting that makecert.exe isn't where it belongs.

    Your code above will not compile since OSession isn't the same as oSession.