其他分享
首页 > 其他分享> > Fiddler 抓取Https时 显示 Tunnel to 443 的解决方案2

Fiddler 抓取Https时 显示 Tunnel to 443 的解决方案2

作者:互联网

------------恢复内容开始------------

设置好Fiddler,部分https抓包时,显示 Tunnel to 443,注意不是全部,如果是全部显示Tunnel to 443,那需要把证书推送到系统证书里面。

 

 

1.打开 Fiddler ,找到 FiddlerScript标签,Go to: 这里选 OnBeforeRequest

.

 

 

 

 

 

 

在这个方法的末尾加上如下代码:

var hosts = 'zkd.me develop.dog';
         FiddlerApplication.Log.LogFormat("Logger session {0}, Url: {1}, isHttps: {2}, port: {3}", oSession.id, oSession.fullUrl, oSession.isHTTPS, oSession.port);
        if(hosts.indexOf(oSession.host) > -1){
            FiddlerApplication.Log.LogFormat("Capture session {0}, Url: {1}, isHttps: {2}, port: {3}", oSession.id, oSession.fullUrl, oSession.isHTTPS, oSession.port);
            if(oSession.HTTPMethodIs('CONNECT')){
                FiddlerApplication.Log.LogString('create fake tunnel response');
                oSession['x-replywithtunnel'] = 'FakeTunnel';
                return;
            }
 
            if (oSession.isHTTPS){
                FiddlerApplication.Log.LogString('switch https to http request');
                oSession.fullUrl = oSession.fullUrl.Replace("https://","http://");
                oSession.port = 80;
            }   
 
            FiddlerApplication.Log.LogFormat("Processed session {0}, Url: {1}, isHttps: {2}, port: {3}", oSession.id, oSession.fullUrl, oSession.isHTTPS, oSession.port);
        }
        FiddlerApplication.Log.LogFormat("Logger session {0}, Url: {1}, isHttps: {2}, port: {3}", oSession.id, oSession.fullUrl, oSession.isHTTPS, oSession.port);
 
var hosts = 'zkd.me develop.dog'; 
这里需要改成我们自己的要抓包的域名

2.修改好后,一定要点 Save Script 这个按钮,要不然改了没用


 

 

//如何让HTTP请求和HTTPS请求显示不一样的颜色?

if(oSession.isHTTPS && oSession.url.indexOf(oSession.host)> -1){
oSession["ui-color"] = "blue";
}
if(!oSession.isHTTPS && oSession.url.indexOf(oSession.host)> -1){
oSession["ui-color"] = "green";
}

 

 

 

 

 

参考自:https://blog.csdn.net/amrenyu/article/details/80745674

------------恢复内容结束------------

标签:Fiddler,Log,Tunnel,port,443,fullUrl,FiddlerApplication,isHTTPS,oSession
来源: https://www.cnblogs.com/gfwei/p/15249757.html