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抓包作了更有針對性的解釋。

相關文章
相關標籤/搜索