lundi 25 décembre 2017

c# FiddlerCore AutoResponder Tunnel Connection Failed

So im trying to get basically the same functionality as the "AutoResponder" inside the Fiddler app.

also i need this to work offline.

the website im trying to autorespond for it HTTP(S) i put in code to ask the user to Trust the Root Certificate which i have included below incase its somehow relevant.

            if (Fiddler.CertMaker.rootCertExists())
        {
            if (!Fiddler.CertMaker.rootCertIsTrusted())
            {
                MessageBox.Show(this, "You need to approve the Fiddler Root CA.", "First Time?");
                Fiddler.CertMaker.trustRootCert();
            }

        }
        else
        {
            Fiddler.CertMaker.createRootCert();
            if (!Fiddler.CertMaker.rootCertIsTrusted())
            {
                MessageBox.Show(this, "You need to approve the Fiddler Root CA.", "First Time?");
                Fiddler.CertMaker.trustRootCert();

            }
        }

        if (!Fiddler.CertMaker.rootCertIsTrusted())
        {
            MessageBox.Show(this, "Fiddler Root CA not Trusted.", "Error");
            this.Close();
        }

As for the autoresponder (and what im pretty sure is causing the problem)

 FiddlerApplication.Startup(8080, true, true, true);



        FiddlerApplication.BeforeRequest += delegate (Session session)
        {
            if (session.HTTPMethodIs("CONNECT")) { session.oFlags["X-ReplyWithTunnel"] = "Fake for HTTPS Tunnel"; return; }
            if (session.uriContains("https://google.com"))
            {
                session.bBufferResponse = true;
            }
        };

        FiddlerApplication.BeforeResponse += delegate (Session session)
        {
            session.utilDecodeResponse();
            session.LoadResponseFromFile("Google.txt");
        };

However after running this code i cannot access any HTTPS websites and receive the error "ERR_TUNNEL_CONNECTION_FAILED" even on the website im trying to AutoRespond to.




Aucun commentaire:

Enregistrer un commentaire