Charles抓Https
在mac下面,居然沒(méi)有好的抓包工具,這讓我十分糾結(jié),畢竟不可能為了抓一個(gè)http包就跑到win下折騰。或許有人說(shuō)tcpdump這么好的工具,你怎么不用。說(shuō)實(shí)話(huà),tcpdump太復(fù)雜了,我還沒(méi)有細(xì)看,再加上不是所見(jiàn)所得,所以,用起來(lái)不是那么習(xí)慣
又有人說(shuō),wireshark怎么不用?好吧,其實(shí)我是有裝wireshark,只是啟動(dòng)的時(shí)候會(huì)啟動(dòng)XQuartz,有點(diǎn)慢,當(dāng)然這不是主要的,而是wireshark功能太強(qiáng)大了,以至于都不會(huì)寫(xiě)過(guò)濾器。
也有人說(shuō),圖方便的話(huà),完全可以用chrome自帶的抓包工具啊?在沒(méi)有找到這個(gè)工具之前,你可以嘗試在地址欄輸入:chrome://chrome-urls/,你會(huì)發(fā)現(xiàn)chrome原來(lái)有這么多的隱藏工具,嗯。我要說(shuō)的就是其中的一個(gè):chrome://net-internals/ ,在Events中,你可以進(jìn)行過(guò)濾,不過(guò),針對(duì)https的包,內(nèi)容沒(méi)法顯示
越來(lái)越懷念windows下面,smartsniff完全就是wireshark的簡(jiǎn)化版,抓起包來(lái)刷刷的,過(guò)濾數(shù)據(jù)也很方便。
當(dāng)然,mac下面的charles就真心不錯(cuò)了,試用了一下,果然對(duì)于https的包也能夠抓取。
這里有一個(gè)簡(jiǎn)單的教程(實(shí)際操作略有出入):
在Mac下做開(kāi)發(fā),用Fiddler抓包由于離不開(kāi)Windows比較痛苦,還好有Charles,到官網(wǎng)http://www.charlesproxy.com/可下載到最新版本(若不支持rMBP可拖到Retinizer中把文字變清晰)
HTTP抓包
HTTPS抓包
接下來(lái)就跟HTTP抓包一樣了
---EOF---
上文中的一些操作,其實(shí)是有點(diǎn)出入的(HTTPS)抓包
1、如果沒(méi)有設(shè)置ssl的話(huà),那么你看到的ssl的接口中,會(huì)有一個(gè)報(bào)錯(cuò):SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations,這個(gè)時(shí)候,在左側(cè)的域名上點(diǎn)右鍵:enable ssl,就OK了。(其實(shí)就是上面的第4部,不過(guò)這個(gè)操作是簡(jiǎn)化操作,上面的第4步太麻煩了)
2、如果這樣還是不能抓包,那么官方會(huì)有一個(gè)說(shuō)明(http://www.charlesproxy.com/documentation/using-charles/ssl-certificates/):
MAC OS X
Download and unzip the?Charles CA Certificate bundle. The bundle contains the Charles CA Certificate file.
Run the Keychain Access utility from the Applications/Utilities folder. This tool enables you to manage your certificates.
Choose the "login" keychain then go to the File menu and choose Import. Choose the .crt file you downloaded above, and ensure that the login keychain is chosen in the dropdown menu.
Complete the import and the Charles CA SSL Certificate will now be trusted for your login account.
Move the Charles Proxy SSL Proxying certificate from your login keychain to the System keychain by drag-and-drop if you want all users on the machine to trust it.
You will need to quit and reopen Safari to see the change.
GOOGLE CHROME
On Mac OS X, please follow the instructions for Mac OS X above. These instructions only apply on Windows.
Open the Options dialog, go to the "Under the Hood" tab, then click the "Manage certificates" button.
Go to the Trusted Root Certification Authorities tab and click Import.
Find the charles-proxy-ssl-proxying-certificate.crt file. On Windows and Linux it is in the docs directory in your Charles installation directory. On Mac OS X (or if you can’t find it) you can download and unzip?ssl.zip.
Choose the charles-proxy-ssl-proxying-certificate.crt file, then click Next and Finish, leaving the default options, until you complete the import. Chrome will now always trust certificates signed by Charles.
After importing you can delete the charles-proxy-ssl-proxying-certificate.crt file if you downloaded it.
---如果用chrome,那就直接可以使用/如果firefox,會(huì)有插件提示你安裝/如果是safari,則需要打開(kāi)證書(shū)管理器,將剛才導(dǎo)入的證書(shū)把login改為system(這樣所有用戶(hù)就都能使用了,不過(guò)都是自己的電腦,無(wú)所謂了),safari可能需要重啟下瀏覽器
經(jīng)此,我終于可以抓包了。而且https包也不再只是一堆 亂碼。黑黑
總結(jié)
以上是生活随笔為你收集整理的Charles抓Https的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java超市管理系统后台_Javaweb
- 下一篇: Android高德地图计算驾车距离及时间