Esempio n. 1
0
 protected void OnRemoteReceive(IAsyncResult ar)
 {
     try
     {
         int cBytes = this.socketRemote.EndReceive(ar);
         if (cBytes > 0)
         {
             this._lngIngressByteCount += cBytes;
             FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, cBytes);
             if ((this._mySession.responseBodyBytes == null) || (this._mySession.responseBodyBytes.LongLength == 0L))
             {
                 try
                 {
                     HTTPSServerHello hello = new HTTPSServerHello();
                     if (hello.LoadFromStream(new MemoryStream(this.arrResponseBytes, 0, cBytes, false)))
                     {
                         string s = string.Format("This is a CONNECT tunnel, through which encrypted HTTPS traffic flows.\n{0}\n\n{1}\n", CONFIG.bMITM_HTTPS ? "Fiddler's HTTPS Decryption feature is enabled, but this specific tunnel was configured not to be decrypted. Settings can be found inside Tools > Fiddler Options > HTTPS." : "To view the encrypted sessions inside this tunnel, enable the Tools > Fiddler Options > HTTPS > Decrypt HTTPS traffic option.", hello.ToString());
                         this._mySession.responseBodyBytes = Encoding.UTF8.GetBytes(s);
                         this._mySession["https-Server-SessionID"] = hello.SessionID;
                         this._mySession["https-Server-Cipher"] = hello.CipherSuite;
                     }
                 }
                 catch (Exception exception)
                 {
                     this._mySession.requestBodyBytes = Encoding.UTF8.GetBytes("Response HTTPSParse failed: " + exception.Message);
                 }
             }
             this.socketClient.BeginSend(this.arrResponseBytes, 0, cBytes, SocketFlags.None, new AsyncCallback(this.OnClientSent), this.socketClient);
         }
         else
         {
             FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, 0);
             this.CloseTunnel();
         }
     }
     catch (Exception)
     {
         this.CloseTunnel();
     }
 }
Esempio n. 2
0
        protected void OnRemoteReceive(IAsyncResult iasyncResult_0)
        {
            try
            {
                int num = this.socketRemote.EndReceive(iasyncResult_0);
                if (num > 0)
                {
                    this._lngIngressByteCount += (long)num;
                    FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, num);
                    if (this._mySession.responseBodyBytes != null)
                    {
                        if (this._mySession.responseBodyBytes.LongLength != 0L)
                        {
                            goto IL_107;
                        }
                    }
                    try
                    {
                        HTTPSServerHello hTTPSServerHello = new HTTPSServerHello();
                        if (hTTPSServerHello.LoadFromStream(new MemoryStream(this.arrResponseBytes, 0, num, false)))
                        {
                            string s = string.Format("This is a CONNECT tunnel, through which encrypted HTTPS traffic flows.\n{0}\n\n{1}\n", CONFIG.bMITM_HTTPS ? "Fiddler's HTTPS Decryption feature is enabled, but this specific tunnel was configured not to be decrypted. Settings can be found inside Tools > Fiddler Options > HTTPS." : "To view the encrypted sessions inside this tunnel, enable the Tools > Fiddler Options > HTTPS > Decrypt HTTPS traffic option.", hTTPSServerHello.ToString());
                            this._mySession.responseBodyBytes         = Encoding.UTF8.GetBytes(s);
                            this._mySession["https-Server-SessionID"] = hTTPSServerHello.SessionID;
                            this._mySession["https-Server-Cipher"]    = hTTPSServerHello.CipherSuite;
                        }
                    }
                    catch (Exception ex)
                    {
                        this._mySession.requestBodyBytes = Encoding.UTF8.GetBytes("Response HTTPSParse failed: " + ex.Message);
                    }
IL_107:
                    this.socketClient.BeginSend(this.arrResponseBytes, 0, num, SocketFlags.None, new AsyncCallback(this.OnClientSent), this.socketClient);
                }
                else
                {
                    FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, 0);
                    this.CloseTunnel();
                }
            }
            catch (Exception)
            {
                this.CloseTunnel();
            }
        }
Esempio n. 3
0
 protected void OnRemoteReceive(IAsyncResult ar)
 {
     try
     {
         int count = this.socketRemote.EndReceive(ar);
         if (count > 0)
         {
             if ((this._mySession.responseBodyBytes == null) || (this._mySession.responseBodyBytes.LongLength == 0L))
             {
                 try
                 {
                     HTTPSServerHello hello = new HTTPSServerHello();
                     if (hello.LoadFromStream(new MemoryStream(this.arrResponseBytes, 0, count, false)))
                     {
                         this._mySession.responseBodyBytes         = Encoding.UTF8.GetBytes("This is a CONNECT tunnel, through which encrypted HTTPS traffic flows. To view the encrypted sessions inside this tunnel, ensure that the Tools > Fiddler Options > HTTPS > Decrypt HTTPS traffic option is checked.\n\n" + hello.ToString() + "\n");
                         this._mySession["https-Server-SessionID"] = hello.SessionID;
                     }
                 }
                 catch (Exception exception)
                 {
                     this._mySession.requestBodyBytes = Encoding.UTF8.GetBytes("HTTPSParse Failed: " + exception.Message);
                 }
             }
             this.socketClient.BeginSend(this.arrResponseBytes, 0, count, SocketFlags.None, new AsyncCallback(this.OnClientSent), this.socketClient);
         }
         else
         {
             this.CloseTunnel();
         }
     }
     catch (Exception)
     {
         this.CloseTunnel();
     }
 }