This is a migrated thread and some comments may be shown as answers.

Capture Https Traffic

7 Answers 465 Views
FiddlerCore
This is a migrated thread and some comments may be shown as answers.
Avinash
Top achievements
Rank 1
Avinash asked on 20 Feb 2015, 08:03 AM
Hi Eric,
I was a newbie to FiddlerCore.I want to capture https traffic when requested to website using Selenium and FiddlerCore in .net.Coded as below 

CODE:

CONFIG.bCaptureCONNECT = true;
 CONFIG.IgnoreServerCertErrors = true;
var cert = InstallCertificate();// getting true
FiddlerCoreStartupFlags flags = FiddlerCoreStartupFlags.DecryptSSL & FiddlerCoreStartupFlags.AllowRemoteClients & FiddlerCoreStartupFlags.CaptureFTP & FiddlerCoreStartupFlags.ChainToUpstreamGateway & FiddlerCoreStartupFlags.MonitorAllConnections & FiddlerCoreStartupFlags.CaptureLocalhostTraffic;
FiddlerApplication.Startup(desiredPort, flags);
FiddlerApplication.BeforeRequest += RequestDetails;

private static void RequestDetails(Session oSession)
        {
            Console.WriteLine("Request URL {0}", oSession.fullUrl);// getting only http traffic details
            
        }

public static bool InstallCertificate()
        {
           
            if (!CertMaker.rootCertExists())
            {
                if (!CertMaker.createRootCert())
                    return false;

                if (!CertMaker.trustRootCert())
                    return false;
            }

            return true;
        }

Could you suggest me the way to capture https traffic


Thank you

Regards,
Avinash

7 Answers, 1 is accepted

Sort by
0
Eric Lawrence
Telerik team
answered on 24 Feb 2015, 09:55 PM
Hi,

Decryption requires that makecert.exe or the certificate provider be located in the appropriate folder.
It also requires that the client trust the root certificate.

CertMaker.TrustRootCert modifies the Windows Certificate Store.

Unlike Chrome, IE, Safari, etc, Firefox does not use the Windows Certificate Store.
 

Regards,
Eric Lawrence
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Avinash
Top achievements
Rank 1
answered on 26 Feb 2015, 07:30 AM
Hi Eric,

Getting following Exception at OnLogString Event:
     
FiddlerApplication.Log.OnLogString+= delegate(object sender, LogEventArgs e)
            {
Console.WriteLine("Log {0}", e.LogString);
//getting following text
Process-determination failed. fiddler.config.path.lsof=/usr/sbin/lsof
Call returned 2.
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Fiddler.Winsock.GetPIDFromLSOF(Int32 iPort)
};

Thank you,
Avinash
0
Eric Lawrence
Telerik team
answered on 26 Feb 2015, 02:46 PM
Hi, Avinash-- Please open a new ticket for new issues. This will help ensure that your issues aren't overlooked.

You didn't say what platform you're using, but the error message here suggests that you're using FiddlerCore on Mono on either Mac or Linux. The error message means exactly as it says-- it can't find the lsof executable because the value of the fiddler.config.path.lsof preference is set incorrectly.

The most likely explanation is that you could fix this by:

FiddlerApplication.Prefs.SetStringPref("fiddler.config.path.lsof", "/usr/bin/lsof");


But if that doesn't work, you'll need to find where lsof is on your system.

Only the Mono builds of Fiddler use lsof because IPHelper.dll does not exist on Mac or Linux, and hence the code described in this blog post does not run on those platforms.

0
Avinash
Top achievements
Rank 1
answered on 27 Feb 2015, 07:09 AM
thanks for reply Eric,i'm using windows 8.1.
0
Eric Lawrence
Telerik team
answered on 27 Feb 2015, 04:26 PM
The error message below indicates that you're using the Mono build of FiddlerCore. You should use the regular builds, which run only on Windows.

http://www.telerik.com/fiddler/fiddlercore

Regards,
Eric Lawrence
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Munna
Top achievements
Rank 1
answered on 28 Jun 2018, 12:20 PM

Hi Eric,

your the best problem solver please help me.

I am usinfg fiddler to capture https traffic . I used the following code please look at this
 Fiddler.FiddlerApplication.Startup(iSecureEndpointPort,
            FiddlerCoreStartupFlags.Default |
            FiddlerCoreStartupFlags.AllowRemoteClients |
            FiddlerCoreStartupFlags.DecryptSSL |
            FiddlerCoreStartupFlags.MonitorAllConnections |
            FiddlerCoreStartupFlags.RegisterAsSystemProxy |
            FiddlerCoreStartupFlags.ChainToUpstreamGateway |
            FiddlerCoreStartupFlags.CaptureLocalhostTraffic);


            Fiddler.FiddlerApplication.OnNotification += delegate (object snder, NotificationEventArgs oNEA) { MessageBox.Show("** NotifyUser: " + oNEA.NotifyString); };
            Fiddler.FiddlerApplication.Log.OnLogString += delegate (object snder, LogEventArgs oLEA) { MessageBox.Show("** LogString: " + oLEA.LogString); };

            Fiddler.FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest;
            //FiddlerApplication.AfterSessionComplete += new SessionStateHandler(FiddlerApplication_AfterSessionComplete);
            Fiddler.FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;

 void FiddlerApplication_BeforeRequest(Fiddler.Session oSession)
        {
            try
            {
                oSession.bBufferResponse = false;
                oSession["X-AutoAuth"] = "(default)";
            }

     }

public static bool InstallCertificate()
            {

                try
                {
                    if (!CertMaker.rootCertExists())    // check root cert existing or not
                    {
                        if (!CertMaker.createRootCert())  //Generate root cert 
                        {
                            return false;
                        }
                       
                        if (!CertMaker.trustRootCert())
                        { 
                            return false; 
                        }
                       

                    }
                    return true;
                }

when I am running the browser from code  then it's capturing session for http but not for https .
its telling "your connection is not private" . please help me. 

 

 

0
Simeon
Telerik team
answered on 02 Jul 2018, 08:08 PM
Hi Munna,

Rick Strahl has a great blog post about using FiddlerCore to capture HTTP/S traffic. He has explained all the steps in detail and I recommend it.

Regards,
Simeon
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
FiddlerCore
Asked by
Avinash
Top achievements
Rank 1
Answers by
Eric Lawrence
Telerik team
Avinash
Top achievements
Rank 1
Munna
Top achievements
Rank 1
Simeon
Telerik team
Share this question
or