簡體   English   中英

查爾斯代理 + 安卓 HTTPS

[英]Charles Proxy + Android HTTPS

所以這里有一些類似但過時的答案,它們可能在幾年/幾個月前對我有所幫助:

為什么我在 Charles Proxy 上看不到 Android 版 Chrome 瀏覽器的 http 或 https 流量?

如何讓查爾斯代理與 Android 7 牛軋糖一起工作?

我遵循了所有說明,我可以很好地讀取 http 請求,但不能讀取 https 請求。 仍然無法弄清楚我做錯了什么。 由於我剛剛遵循了上述指南,因此我沒有太多要發布的內容。

我認為主要問題是如何強制我嘗試調試的應用程序使用我的證書? 清單修改似乎不起作用。

請參閱此問題,其中更新了 Charles 4 和 Android 7 的答案。

  • 您必須從 Charles 幫助菜單安裝證書,並且必須使用 Settings -> Security -> Install from storage on device。

  • 您的應用需要 network_security_config.xml

  • 您必須使用可調試的應用程序

對於那些尋找更新的 Android 版本(8、9、10 或 ++)+ CharlesProxy 4.6 的人

可以參考本指南...

從 Android N+ 開始,它需要額外的步驟才能工作。

1.將 res/xml/network_security_config.xml 添加到您的項目中。

<network-security-config>
<debug-overrides>
    <trust-anchors>
        <!-- Trust user added CAs while debuggable only -->
        <certificates src="user" />
        <certificates src="system" />
    </trust-anchors>
</debug-overrides>

<base-config cleartextTrafficPermitted="true">
    <trust-anchors>
        <certificates src="system" />
    </trust-anchors>
</base-config>

<domain-config>
    <!-- Make sure your URL Server here -->
    <domain includeSubdomains="true">your_production_domain</domain>
    <trust-anchors>
        <certificates src="user"/>
        <certificates src="system"/>
    </trust-anchors>
</domain-config>

=> 確保將 your_production_domain 替換為要攔截的域

2.添加到AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
    <application android:networkSecurityConfig="@xml/network_security_config" ... >
    ...
    </application>
</manifest>

如果你不能讓它工作,你可以查看示例代碼,其中包含所有配置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM