fiddler抓web请求

原理

fiddler抓包原理

fiddler 调试器注册到操做系统因特网服务中,系统全部的网络请求都会走fiddler的代理,因此fiddler才能抓包。web

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 iOS, Android, Windows Phone and Windows RT devices.windows

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—->以后都是肯定app

这里写图片描述

这里写图片描述

安装根证书后,能够点击Actions—–>open windows certificate manager查看安装到系统的根证书 
这里写图片描述ide

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

效果

咱们那支付宝登录界面作测试,支付宝登录页面 
这里写图片描述this

常见问题

http tunnel、http connect

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

CONNECT www.google.com:443 
  • 1

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

解密失败

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

这里写图片描述

经过查看响应,咱们看到,是因为没有设置解密致使的,

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,选择正确的来源,解密成功。 
这里写图片描述

固然,若是不想显示Connect,你也能够设置rules----->hide connects 隐藏connect;

若是仍是解密失败,能够查看Log标签页,错误信息都会在这里边显示。 
这里写图片描述

抓不到手机微信

有网友跟我说,抓不到手机微信的数据,这是由于,微信走的http2协议,fiddler不支持http2协议,因此用wireshark抓,但http2也是加密的,因此抓到的数据看不懂。 
这里写图片描述

手机 https 抓包

若是是抓手机 https,请参考这篇文章fiddler 手机 https 抓包 ,对于手机 https抓包作了更有针对性的解释。

相关文章
相关标签/搜索