private CONNECTTunnel(Session oSess, ClientPipe oFrom, ServerPipe oTo) { this._mySession = oSess; this.pipeTunnelClient = oFrom; this.pipeTunnelRemote = oTo; this._mySession.SetBitFlag(SessionFlags.IsBlindTunnel, true); }
internal static void CreateTunnel(Session oSession, bool bStreamResponse) { if (oSession == null || oSession.oRequest == null || oSession.oRequest.headers == null || oSession.oRequest.pipeClient == null || oSession.oResponse == null) { return; } ClientPipe pipeClient = oSession.oRequest.pipeClient; if (pipeClient == null) { return; } if (bStreamResponse) { oSession.oRequest.pipeClient = null; } ServerPipe pipeServer = oSession.oResponse.pipeServer; if (pipeServer == null) { return; } if (bStreamResponse) { oSession.oResponse.pipeServer = null; } GenericTunnel genericTunnel = new GenericTunnel(oSession, pipeClient, pipeServer, bStreamResponse); oSession.__oTunnel = genericTunnel; new Thread(new ThreadStart(genericTunnel.RunTunnel)) { IsBackground = true }.Start(); }
internal static void CreateTunnel(Session oSession) { if (oSession == null || oSession.oRequest == null || oSession.oRequest.headers == null || oSession.oRequest.pipeClient == null || oSession.oResponse == null) { return; } ClientPipe pipeClient = oSession.oRequest.pipeClient; if (pipeClient == null) { return; } oSession.oRequest.pipeClient = null; ServerPipe pipeServer = oSession.oResponse.pipeServer; if (pipeServer == null) { return; } oSession.oResponse.pipeServer = null; CONNECTTunnel cONNECTTunnel = new CONNECTTunnel(oSession, pipeClient, pipeServer); oSession.__oTunnel = cONNECTTunnel; new Thread(new ThreadStart(cONNECTTunnel.RunTunnel)) { IsBackground = true }.Start(); }
private void _CleanupWebSocket() { this.bIsOpen = false; this.arrRequestBytes = (this.arrResponseBytes = null); this.strmServerBytes = null; this.strmClientBytes = null; if (this.oCP != null) { this.oCP.End(); } if (this.oSP != null) { this.oSP.End(); } this.oCP = null; this.oSP = null; if (this._mySession != null) { if (this._mySession.oResponse != null && this._mySession.oResponse.headers != null) { this._mySession.oResponse["EndTime"] = DateTime.Now.ToString("HH:mm:ss.fff"); this._mySession.oResponse["ReceivedBytes"] = this._lngIngressByteCount.ToString(); this._mySession.oResponse["SentBytes"] = this._lngEgressByteCount.ToString(); } this._mySession.Timers.ServerDoneResponse = (this._mySession.Timers.ClientBeginResponse = (this._mySession.Timers.ClientDoneResponse = DateTime.Now)); this._mySession = null; } }
private GenericTunnel(Session oSess, ClientPipe oFrom, ServerPipe oTo, bool bStreamResponse) { this._mySession = oSess; this.pipeToClient = oFrom; this.pipeToRemote = oTo; this.bResponseStreamStarted = bStreamResponse; this._mySession.SetBitFlag(SessionFlags.IsBlindTunnel, true); Trace.WriteLine("[GenericTunnel] For session #" + this._mySession.Int32_0.ToString() + " created..."); }
private GenericTunnel(Session oSess, ClientPipe oFrom, ServerPipe oTo, bool bStreamResponse) { this._mySession = oSess; this.pipeToClient = oFrom; this.pipeToRemote = oTo; this.bResponseStreamStarted = bStreamResponse; this._mySession.SetBitFlag(SessionFlags.IsBlindTunnel, true); Trace.WriteLine("[GenericTunnel] For session #" + this._mySession.id.ToString() + " created..."); }
private WebSocket(Session oSess, ClientPipe oFrom, ServerPipe oTo) { this.sName = "WebSocket #" + oSess.id.ToString(); this._mySession = oSess; this.oCP = oFrom; this.oSP = oTo; this._mySession.SetBitFlag(SessionFlags.IsWebSocketTunnel, true); if (oSess.oFlags.ContainsKey("x-no-parse")) { this.bParseMessages = false; } }
private WebSocket(Session oSess, ClientPipe oFrom, ServerPipe oTo) { this.sName = "WebSocket #" + oSess.Int32_0.ToString(); this._mySession = oSess; this.oCP = oFrom; this.oSP = oTo; this._mySession.SetBitFlag(SessionFlags.IsWebSocketTunnel, true); if (oSess.oFlags.ContainsKey("x-no-parse")) { this.bParseMessages = false; } }
private void WaitForCompletion() { this.oKeepTunnelAlive = new AutoResetEvent(false); this.oKeepTunnelAlive.WaitOne(); this.oKeepTunnelAlive.Close(); this.oKeepTunnelAlive = null; this.bIsOpen = false; this.arrRequestBytes = (this.arrResponseBytes = null); this.pipeTunnelClient = null; this.pipeTunnelRemote = null; this.socketClient = (this.socketRemote = null); if (this._mySession.oResponse != null && this._mySession.oResponse.headers != null) { this._mySession.oResponse.headers["EndTime"] = DateTime.Now.ToString("HH:mm:ss.fff"); this._mySession.oResponse.headers["ClientToServerBytes"] = this._lngEgressByteCount.ToString(); this._mySession.oResponse.headers["ServerToClientBytes"] = this._lngIngressByteCount.ToString(); } this._mySession.Timers.ServerDoneResponse = (this._mySession.Timers.ClientBeginResponse = (this._mySession.Timers.ClientDoneResponse = DateTime.Now)); this._mySession = null; }
internal static void CreateTunnel(Session oSession) { if (oSession == null || oSession.oRequest == null || oSession.oRequest.headers == null || oSession.oRequest.pipeClient == null) { return; } if (oSession.oResponse != null && oSession.oResponse.pipeServer != null) { ClientPipe pipeClient = oSession.oRequest.pipeClient; oSession.oRequest.pipeClient = null; ServerPipe pipeServer = oSession.oResponse.pipeServer; oSession.oResponse.pipeServer = null; WebSocket webSocket = new WebSocket(oSession, pipeClient, pipeServer); oSession.__oTunnel = webSocket; new Thread(new ThreadStart(webSocket.RunTunnel)) { IsBackground = true }.Start(); return; } }
private void WaitForCompletion() { this.oKeepTunnelAlive = new AutoResetEvent(false); Trace.WriteLine("[GenericTunnel] Blocking thread..."); this.oKeepTunnelAlive.WaitOne(); Trace.WriteLine("[GenericTunnel] Unblocking thread..."); this.oKeepTunnelAlive.Close(); this.oKeepTunnelAlive = null; this.bIsOpen = false; this.arrRequestBytes = (this.arrResponseBytes = null); this.pipeToClient = null; this.pipeToRemote = null; Trace.WriteLine("[GenericTunnel] Thread for session #" + this._mySession.Int32_0.ToString() + " has died..."); if (this._mySession.oResponse != null && this._mySession.oResponse.headers != null) { this._mySession.oResponse.headers["EndTime"] = DateTime.Now.ToString("HH:mm:ss.fff"); this._mySession.oResponse.headers["ClientToServerBytes"] = this._lngEgressByteCount.ToString(); this._mySession.oResponse.headers["ServerToClientBytes"] = this._lngIngressByteCount.ToString(); } this._mySession.Timers.ServerDoneResponse = (this._mySession.Timers.ClientBeginResponse = (this._mySession.Timers.ClientDoneResponse = DateTime.Now)); this._mySession.state = SessionStates.Done; this._mySession = null; }
internal static void CreateAndExecute(object oParams) { try { ProxyExecuteParams @params = (ProxyExecuteParams) oParams; Socket oSocket = @params.oSocket; ClientPipe clientPipe = new ClientPipe(oSocket, @params.dtConnectionAccepted); Session oSession = new Session(clientPipe, null); FiddlerApplication.DoAfterSocketAccept(oSession, oSocket); if ((@params.oServerCert == null) || oSession.AcceptHTTPSRequest(@params.oServerCert)) { oSession.Execute(null); } } catch (Exception exception) { FiddlerApplication.ReportException(exception); } }
private void _CleanupWebSocket() { this.bIsOpen = false; this.arrRequestBytes = (byte[]) (this.arrResponseBytes = null); this.strmServerBytes = null; this.strmClientBytes = null; if (this.oCP != null) { this.oCP.End(); } if (this.oSP != null) { this.oSP.End(); } this.oCP = null; this.oSP = null; if (this._mySession != null) { if ((this._mySession.oResponse != null) && (this._mySession.oResponse.headers != null)) { this._mySession.oResponse["EndTime"] = DateTime.Now.ToString("HH:mm:ss.fff"); this._mySession.oResponse["ReceivedBytes"] = this._lngIngressByteCount.ToString(); this._mySession.oResponse["SentBytes"] = this._lngEgressByteCount.ToString(); } this._mySession.Timers.ServerDoneResponse = this._mySession.Timers.ClientBeginResponse = this._mySession.Timers.ClientDoneResponse = DateTime.Now; this._mySession = null; } }
private void WaitForCompletion() { AutoResetEvent oKeepTunnelAlive = this.oKeepTunnelAlive; this.oKeepTunnelAlive = new AutoResetEvent(false); this.oKeepTunnelAlive.WaitOne(); this.oKeepTunnelAlive.Close(); this.oKeepTunnelAlive = null; this.bIsOpen = false; this.arrRequestBytes = (byte[]) (this.arrResponseBytes = null); this.pipeTunnelClient = null; this.pipeTunnelRemote = null; this.socketClient = (Socket) (this.socketRemote = null); if ((this._mySession.oResponse != null) && (this._mySession.oResponse.headers != null)) { this._mySession.oResponse.headers["EndTime"] = DateTime.Now.ToString("HH:mm:ss.fff"); this._mySession.oResponse.headers["ClientToServerBytes"] = this._lngEgressByteCount.ToString(); this._mySession.oResponse.headers["ServerToClientBytes"] = this._lngIngressByteCount.ToString(); } this._mySession.Timers.ServerDoneResponse = this._mySession.Timers.ClientBeginResponse = this._mySession.Timers.ClientDoneResponse = DateTime.Now; this._mySession = null; }
private void WaitForCompletion() { AutoResetEvent oKeepTunnelAlive = this.oKeepTunnelAlive; this.oKeepTunnelAlive = new AutoResetEvent(false); Trace.WriteLine("[GenericTunnel] Blocking thread..."); this.oKeepTunnelAlive.WaitOne(); Trace.WriteLine("[GenericTunnel] Unblocking thread..."); this.oKeepTunnelAlive.Close(); this.oKeepTunnelAlive = null; this.bIsOpen = false; this.arrRequestBytes = (byte[]) (this.arrResponseBytes = null); this.pipeToClient = null; this.pipeToRemote = null; Trace.WriteLine("[GenericTunnel] Thread for session #" + this._mySession.id.ToString() + " has died..."); if ((this._mySession.oResponse != null) && (this._mySession.oResponse.headers != null)) { this._mySession.oResponse.headers["EndTime"] = DateTime.Now.ToString("HH:mm:ss.fff"); this._mySession.oResponse.headers["ClientToServerBytes"] = this._lngEgressByteCount.ToString(); this._mySession.oResponse.headers["ServerToClientBytes"] = this._lngIngressByteCount.ToString(); } this._mySession.Timers.ServerDoneResponse = this._mySession.Timers.ClientBeginResponse = this._mySession.Timers.ClientDoneResponse = DateTime.Now; this._mySession.state = SessionStates.Done; this._mySession = null; }
internal Session(ClientPipe clientPipe, ServerPipe serverPipe) { EventHandler<StateChangeEventArgs> handler = null; this.bBufferResponse = FiddlerApplication.Prefs.GetBoolPref("fiddler.ui.rules.bufferresponses", false); this.Timers = new SessionTimers(); this._bAllowClientPipeReuse = true; this.oFlags = new StringDictionary(); if (CONFIG.bDebugSpew) { if (handler == null) { handler = (s, ea) => FiddlerApplication.DebugSpew(string.Format("onstatechange>#{0} moving from state '{1}' to '{2}' {3}", new object[] { this.id.ToString(), ea.oldState, ea.newState, Environment.StackTrace })); } this.OnStateChanged += handler; } if (clientPipe != null) { this.Timers.ClientConnected = clientPipe.dtAccepted; this.m_clientIP = (clientPipe.Address == null) ? null : clientPipe.Address.ToString(); this.m_clientPort = clientPipe.Port; this.oFlags["x-clientIP"] = this.m_clientIP; this.oFlags["x-clientport"] = this.m_clientPort.ToString(); if (clientPipe.LocalProcessID != 0) { this._LocalProcessID = clientPipe.LocalProcessID; this.oFlags["x-ProcessInfo"] = string.Format("{0}:{1}", clientPipe.LocalProcessName, this._LocalProcessID); } } else { this.Timers.ClientConnected = DateTime.Now; } this.oResponse = new ServerChatter(this); this.oRequest = new ClientChatter(this); this.oRequest.pipeClient = clientPipe; this.oResponse.pipeServer = serverPipe; }