如何添加网络安全配置以在 Nougat 中启用 Charles 代理 SSL? [英] How to add network security configuration to enable Charles proxy SSL in Nougat?

查看:37
本文介绍了如何添加网络安全配置以在 Nougat 中启用 Charles 代理 SSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Android Nougat 上运行的 Samsung s8 上启用 Charles Proxy SSL,但不知道如何操作.>

Nougat 能够在我的设备上成功记录多个应用程序的查尔斯会话之前.

已关注thisthis 用于设置所有内容,但这是在 Android 中启用 Charles 时要遵循的第一步.我的用例与其他问题中的用例不同,因为我正在监控第三方应用程序并且我没有任何 AndroidManifest.xmlres 目录来创建 network_configuration文件.

还了解了网络安全配置以及要做什么做但不知道怎么做.

有什么方法可以为我设备中的所有第三方应用启用代理?有什么方法可以将此网络配置添加到设备本身而不是单个应用?

感谢您的帮助.

解决方案

步骤

1) 在 res 文件夹中创建 xml 文件夹

2) 创建名为network_security_config.xml"的文件.添加代码

3) 在 AndroidManifest.xml 中的 Application 标签下引用此文件

android:networkSecurityConfig="@xml/network_security_config"

I am trying to enable Charles Proxy SSL on my Samsung s8 running on Android Nougat but don't know how to.

Before Nougat am able to successfully record the charles sessions for multiple apps on my device.

Have followed this and this to set up everything but it's the first step to follow while enabling Charles in Android. My use case is different than those in other questions because am monitoring third party apps and I do not have any AndroidManifest.xml or res directory to create network_configuration files.

Have also gone through the Network Security Configuration and what to do but don't know how.

Is there a way I can enable the proxy for all the third party apps in my device? Any ways to add this network configuration to the device itself and not individual apps?

Appreciate the help.

解决方案

Steps

1) Create xml folder inside your res folder

2) Create file called "network_security_config.xml". Add code

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system"/>
        </trust-anchors>
    </base-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="user"/>
        </trust-anchors>
    </debug-overrides>
</network-security-config>

3) Reference this file in your AndroidManifest.xml, under the Application tag

android:networkSecurityConfig="@xml/network_security_config"

这篇关于如何添加网络安全配置以在 Nougat 中启用 Charles 代理 SSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆