所以我试图获得与Fiddler应用程序中的“AutoResponder”基本相同的功能。
我也需要这个离线工作。
网站即时尝试自动回复HTTP(S) 我输入代码要求用户信任根证书 我在下面列出的内容与其有些相关。
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();
}
至于自动回复(以及我非常肯定导致问题的原因)
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");
};
然而,在运行此代码后,我无法访问任何HTTPS网站,即使在尝试AutoRespond的网站上也会收到错误“ERR_TUNNEL_CONNECTION_FAILED”。
答案 0 :(得分:0)
我想要修理它
Fiddler.FiddlerApplication.BeforeRequest += new SessionStateHandler(FiddlerApplication_BeforeRequest);
FiddlerApplication.Startup(8080 , true,true);
-
private void FiddlerApplication_BeforeRequest(Session oSession)
{
FiddlerApplication.BeforeRequest += delegate (Session session)
{
Fiddler.FiddlerApplication.BeforeRequest += delegate (Fiddler.Session oS)
{
if (!oS.uriContains("google.com") && oSession.HTTPMethodIs("CONNECT")) { oSession.oFlags["X-ReplyWithTunnel"] = "Connect for real.."; }
if (oS.uriContains("google.com") && oS.HTTPMethodIs("CONNECT")) { oS["x-replywithtunnel"] = "Fake tunnel..."; }
if (oS.uriContains("https://google.com/"))
{
oS.oFlags["x-replywithfile"] = AppDomain.CurrentDomain.BaseDirectory + "google.txt";
}
}
};
};