欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

fiddler https 抓包

程序员文章站 2022-04-19 20:26:03
...

原理

fiddler抓包原理

fiddler 调试器注册到操作系统因特网服务中,系统所有的网络请求都会走fiddler的代理,所以fiddler才能抓包。

Debug traffic from any client and browser 
Fiddler helps you debug traffic from any browser: Internet Explorer, Chrome, Firefox, Safari, Opera, and more. Once you start Fiddler, the web debugger registers itself as the system proxy for Microsoft Windows Internet Services (WinINet), the HTTP layer used by Internet Explorer, Microsoft Office, and many other products. As the system proxy, all HTTP requests from WinINet flow through Fiddler before reaching the target web servers. Similarly, all HTTP responses flow through Fiddler before being returned to the client application. 
Additionally, most devices that support Wi-Fi or Ethernet can be configured to send their traffic to Fiddler; this includes iOSAndroid, Windows Phone and Windows RT devices.

fiddler解密https原理

其实fiddler就是中间人攻击,依次经过如下过程

  • fiddler接到客户端的https请求,fiddler将请求转发给服务器
  • 服务器生成公钥证书,返回给fiddler;fiddler拦截下真的公钥证书,并生成伪造的公钥证书给客户端;
  • 客户端使用伪造的公钥证书加密共享**发送给fiddler,fiddler使用伪造的私钥解密获取共享**
  • fiddler将解密后的共享**,使用真正的公钥加密发送给服务器端,服务器使用共享**与fiddler通信
  • fiddler使用共享**与客户端通信

以上是fiddler抓包解密的原理,这个原理是建立在https建立连接的基础上的,请参考https建立连接过程


下面开始抓包设置教程

设置fiddler抓包

File—–>capture traffic

设置抓https和解密https

Tools—–>fiddler options—–>https—–>capture https traffic—->decrypt https traffic—>Ignore server certificate errors—->Actions—–>Trust root certificate—->之后都是确定

fiddler https 抓包

fiddler https 抓包

安装根证书后,可以点击Actions—–>open windows certificate manager查看安装到系统的根证书 
fiddler https 抓包

根证书的作用:fiddler对每个域名都会生成公钥证书,浏览器会用根证书验证公钥证书的合法性,所以,根证书是https 抓包必不可少的部分

效果

我们那支付宝登陆界面做测试支付宝登陆页面 
fiddler https 抓包

常见问题

http tunnel、http connect

有一种情况,host都是tunnel to, url 后边都带着443,这是什么意思呢? 
查看,请求头会发现使用了Connect方法,Connect方法通常会建议代理(fiddler)与目标服务器建立http tunnel;尽管Connect也可以用于http,但是一般是用于SSL通信;

CONNECT www.google.com:443 
  • 1
  • 1

这句话表示,代理与服务器的443端口建立了http tunnel,在此之后,所有由客户端发送的内容,都会经由http 代理,转发给www.google.com:443端口;更多http tunnel&http connect资料可以参考http tunnel&connect

解密失败

有的时候,发现解密失败,这是可以查看connect的log。如图

fiddler https 抓包

通过查看响应,我们看到,是由于没有设置解密导致的,

This is a CONNECT tunnel, through which encrypted HTTPS traffic flows. 
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. 
A SSLv3-compatible ServerHello handshake was found. Fiddler extracted the parameters below.

Tools > Fiddler Options > HTTPS,选中解密https,选择正确的来源,解密成功。 
fiddler https 抓包

当然,如果不想显示Connect,你也可以设置rules----->hide connects 隐藏connect;

如果还是解密失败,可以查看Log标签页,错误信息都会在这里边显示。 
fiddler https 抓包

抓不到手机微信

有网友跟我说,抓不到手机微信的数据,这是因为,微信走的http2协议,fiddler不支持http2协议,所以用wireshark抓,但http2也是加密的,所以抓到的数据看不懂。 
fiddler https 抓包





参考资料: http://blog.csdn.net/wangjun5159/article/details/52198842