1.用Charles導出證書,隨便命名 charles.pem
2.安裝open ssl(http://slproweb.com/products/Win32OpenSSL.html),然后配置環境變量,把openssl安裝路徑bin的路徑(例如 C:\OpenSSL-Win64\bin)加入到操作系統的系統環境變量Path中
3.將導出的的證書(charles.pem)導入電腦中
4.在cmd中輸入
openssl x509 -subject_hash_old -in <Certificate_File>
<Certificate_File>為剛才下載的證書(charles.pem),這個路徑為絕對路徑
然后將 charles.pem 這個文件改為 生成的數字加.0,例如
5.然后在用前端根證書導入的方法導入證書
adb root
adb remount
adb push 0505096d.0 /etc/security/cacerts/
adb shell chmod 644 /etc/security/cacerts/0505096d.0
如果remount或push失敗,需要執行以下命令
adb disable-verity
adb reboot
6.以上方法一般可以抓到了,如果還是不行,需要配置 Proxy——SSL Proxying Settings——SSL Proxying,勾選Enable ——SSL Proxying,點擊“add”,將Host和Port配置為*,如下圖所示: