Capture Https Traffic

8 posts, 0 answers
  1. Avinash
    Avinash avatar
    10 posts
    Member since:
    Jan 2015

    Posted 20 Feb 2015 Link to this post

    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
  2. Eric Lawrence
    Admin
    Eric Lawrence avatar
    832 posts

    Posted 24 Feb 2015 Link to this post

    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.

     
  3. Avinash
    Avinash avatar
    10 posts
    Member since:
    Jan 2015

    Posted 26 Feb 2015 in reply to Eric Lawrence Link to this post

    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
  4. Eric Lawrence
    Admin
    Eric Lawrence avatar
    832 posts

    Posted 26 Feb 2015 Link to this post

    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.

  5. Avinash
    Avinash avatar
    10 posts
    Member since:
    Jan 2015

    Posted 27 Feb 2015 in reply to Eric Lawrence Link to this post

    thanks for reply Eric,i'm using windows 8.1.
  6. Eric Lawrence
    Admin
    Eric Lawrence avatar
    832 posts

    Posted 27 Feb 2015 Link to this post

    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.

     
  7. Munna
    Munna avatar
    1 posts
    Member since:
    Jun 2018

    Posted 28 Jun 2018 in reply to Eric Lawrence Link to this post

    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. 

     

     

  8. Simeon
    Admin
    Simeon avatar
    191 posts

    Posted 02 Jul 2018 Link to this post

    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
Back to Top