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(); } }
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(); } }
public override string ToString() { StringBuilder stringBuilder = new StringBuilder(512); if (this._HandshakeVersion == 2) { stringBuilder.Append("A SSLv2-compatible ServerHello handshake was found. In v2, the ~client~ selects the active cipher after the ServerHello, when sending the Client-Master-Key message. Fiddler only parses the handshake.\n\n"); } else { stringBuilder.Append("A SSLv3-compatible ServerHello handshake was found. Fiddler extracted the parameters below.\n\n"); } stringBuilder.AppendFormat("Version: {0}\n", HTTPSUtilities.HTTPSVersionToString(this._MajorVersion, this._MinorVersion)); stringBuilder.AppendFormat("SessionID:\t{0}\n", Utilities.ByteArrayToString(this._SessionID)); if (this._HandshakeVersion == 3) { stringBuilder.AppendFormat("Random:\t\t{0}\n", Utilities.ByteArrayToString(this._Random)); stringBuilder.AppendFormat("Cipher:\t\t{0} [0x{1:X4}]\n", this.CipherSuite, this._iCipherSuite); } stringBuilder.AppendFormat("CompressionSuite:\t{0} [0x{1:X2}]\n", this.CompressionSuite, this._iCompression); stringBuilder.AppendFormat("Extensions:\n\t{0}\n", HTTPSServerHello.ExtensionListToString(this._Extensions)); return(stringBuilder.ToString()); }
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(); } }