本文整理汇总了C#中Fiddler.Session.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Execute方法的具体用法?C# Session.Execute怎么用?C# Session.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fiddler.Session
的用法示例。
在下文中一共展示了Session.Execute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _ReturnSelfGeneratedCONNECTTunnel
private void _ReturnSelfGeneratedCONNECTTunnel(string sHostname)
{
this.SetBitFlag(SessionFlags.IsDecryptingTunnel | SessionFlags.ResponseGeneratedByFiddler, true);
this.oResponse.headers = new HTTPResponseHeaders();
this.oResponse.headers.HTTPResponseCode = 200;
this.oResponse.headers.HTTPResponseStatus = "200 DecryptEndpoint Created";
this.oResponse.headers.Add("Timestamp", DateTime.Now.ToString("HH:mm:ss.fff"));
this.oResponse.headers.Add("FiddlerGateway", "AutoResponder");
this.oResponse.headers.Add("Connection", "close");
this.responseBodyBytes = Encoding.UTF8.GetBytes("This is a Fiddler-generated response to the client's request for a CONNECT tunnel.\n\n");
this.oFlags["ui-backcolor"] = "Lavender";
FiddlerApplication.DoBeforeResponse(this);
this.state = SessionStates.Done;
FiddlerApplication.DoAfterSessionComplete(this);
if (CONFIG.bUseSNIForCN && !this.oFlags.ContainsKey("x-OverrideCertCN"))
{
string str = this.oFlags["https-Client-SNIHostname"];
if (!string.IsNullOrEmpty(str) && (str != sHostname))
{
this.oFlags["x-OverrideCertCN"] = this.oFlags["https-Client-SNIHostname"];
}
}
string str2 = this.oFlags["x-OverrideCertCN"] ?? sHostname;
if ((this.oRequest.pipeClient == null) || !this.oRequest.pipeClient.SecureClientPipe(str2, this.oResponse.headers))
{
this.CloseSessionPipes(false);
}
else
{
Session session = new Session(this.oRequest.pipeClient, null);
this.oRequest.pipeClient = null;
session.oFlags["x-serversocket"] = "AUTO-RESPONDER-GENERATED";
session.Execute(null);
}
}
示例2: DoTunnel
//.........这里部分代码省略.........
}
else if (!string.IsNullOrEmpty(str))
{
bool flag = Utilities.IsBrowserProcessName(str);
if (((CONFIG.DecryptWhichProcesses == ProcessFilterCategories.Browsers) && !flag) || ((CONFIG.DecryptWhichProcesses == ProcessFilterCategories.NonBrowsers) && flag))
{
this.bIsBlind = true;
}
}
}
Label_00BC:
this._mySession.SetBitFlag(SessionFlags.IsDecryptingTunnel, !this.bIsBlind);
this._mySession.SetBitFlag(SessionFlags.IsBlindTunnel, this.bIsBlind);
if (this.bIsBlind)
{
this.DoBlindTunnel();
}
else
{
X509Certificate2 certificate;
bool flag2 = false;
if (!this._mySession.oFlags.ContainsKey("x-OverrideCertCN"))
{
if (CONFIG.bUseSNIForCN)
{
string str2 = this._mySession.oFlags["https-Client-SNIHostname"];
if (!string.IsNullOrEmpty(str2) && (str2 != this._mySession.hostname))
{
this._mySession.oFlags["x-OverrideCertCN"] = this._mySession.oFlags["https-Client-SNIHostname"];
}
}
if ((this._mySession.oFlags["x-OverrideCertCN"] == null) && this._mySession.oFlags.ContainsKey("x-UseCertCNFromServer"))
{
if (!this.pipeTunnelRemote.SecureExistingConnection(this._mySession, this._mySession.hostname, this._mySession.oFlags["https-Client-Certificate"], ref this._mySession.Timers.HTTPSHandshakeTime))
{
throw new Exception("HTTPS Early-Handshaking to server did not succeed.");
}
flag2 = true;
string serverCertCN = this.pipeTunnelRemote.GetServerCertCN();
if (!string.IsNullOrEmpty(serverCertCN))
{
this._mySession.oFlags["x-OverrideCertCN"] = serverCertCN;
}
}
}
string sHostname = this._mySession.oFlags["x-OverrideCertCN"] ?? this._mySession.hostname;
try
{
certificate = CertMaker.FindCert(sHostname);
if (certificate == null)
{
throw new Exception("Certificate Maker returned null when asked for a certificate for " + sHostname);
}
}
catch (Exception exception)
{
certificate = null;
FiddlerApplication.Log.LogFormat("fiddler.https> Failed to obtain certificate for {0} due to {1}", new object[] { sHostname, exception.Message });
this._mySession.oFlags["x-HTTPS-Decryption-Error"] = "Could not find or generate interception certificate.";
if (!flag2 && FiddlerApplication.Prefs.GetBoolPref("fiddler.network.https.blindtunnelifcertunobtainable", true))
{
this.bIsBlind = true;
goto Label_00BC;
}
}
if (!this.pipeTunnelClient.SecureClientPipeDirect(certificate))
{
throw new Exception("HTTPS Handshaking to client did not succeed.");
}
this._mySession["https-Client-Version"] = this.pipeTunnelClient.SecureProtocol.ToString();
if (!flag2 && !this.pipeTunnelRemote.SecureExistingConnection(this._mySession, sHostname, this._mySession.oFlags["https-Client-Certificate"], ref this._mySession.Timers.HTTPSHandshakeTime))
{
throw new Exception("HTTPS Handshaking to server did not succeed.");
}
this._mySession.responseBodyBytes = Encoding.UTF8.GetBytes("Encrypted HTTPS traffic flows through this CONNECT tunnel. HTTPS Decryption is enabled in Fiddler, so decrypted sessions running in this tunnel will be shown in the Web Sessions list.\n\n" + this.pipeTunnelRemote.DescribeConnectionSecurity());
this._mySession["https-Server-Cipher"] = this.pipeTunnelRemote.GetConnectionCipherInfo();
this._mySession["https-Server-Version"] = this.pipeTunnelRemote.SecureProtocol.ToString();
Session session = new Session(this.pipeTunnelClient, this.pipeTunnelRemote);
session.oFlags["x-serversocket"] = this._mySession.oFlags["x-securepipe"];
if ((this.pipeTunnelRemote != null) && (this.pipeTunnelRemote.Address != null))
{
session.m_hostIP = this.pipeTunnelRemote.Address.ToString();
session.oFlags["x-hostIP"] = session.m_hostIP;
session.oFlags["x-EgressPort"] = this.pipeTunnelRemote.LocalPort.ToString();
}
session.Execute(null);
}
}
catch (Exception)
{
try
{
this.pipeTunnelClient.End();
this.pipeTunnelRemote.End();
}
catch (Exception)
{
}
}
}
示例3: CreateAndExecute
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);
}
}