Android 第三方app https 抓包

工具选择

Charles 或 Fiddler 都可以

在PC上安装工具并进行设置

Charles
Fiddler

设置按官网说明设置一下好。
Charles设置
Fiddler设置

Android Api Level >= 24 SSL特殊设置

当Android 的 Api Level > 24时需要修改一下app的一起配置

1.在项目中添加 Android/src/main/res/xml/network_security_config.xml

xml 复制代码
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
        <trust-anchors>
        <!-- Trust preinstalled CAs -->
        <certificates src="system" />
        <!-- HERE: Additionally trus user-added CAs -->
        <certificates src="user"/>
    </trust-anchors>
    </base-config>
</network-security-config>

2.在AndroidManifest.xml中的application中添加networkSecurityConfig属性

xml 复制代码
android:networkSecurityConfig="@xml/network_security_config"

结果如下:

xml 复制代码
<application
    android:name="com.tns.NativeScriptApplication"
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:networkSecurityConfig="@xml/network_security_config">
    ...

问题

我是想要查看别人的apk包,要怎么添加上面提到的配置呢?

方案

1. apktool 解包
shell 复制代码
apktool d xxx.apk -o xxx_folder
2. 修改及添加相关xml配置
3. apktool 打包
shell 复制代码
apktool b xxx_folder -o xxx_tmp.apk
4. 使用zipalign将apk包4字节对齐
shell 复制代码
zipalign -p -f -v 4 xxx_tmp.apk xxx_final.apk
5. 签名

不签名的apk是无法安装的, 使用自己的key签名

shell 复制代码
apksigner sign --ks <your_keystore> --ks-key-alias <your_key_alias> --out xxx_final_sign.apk xxx_final.apk

xxx_final_sign.apk 即为修改后的最终文件。

相关推荐
玩转4G物联网5 分钟前
FS800DTU 新品上线|免费使用 DMP 设备管理平台,支持远程批量配置 & OTA 升级
物联网·网络协议·tcp/ip·云平台·核心板·fs800dtu·iot管理平台
码农coding11 分钟前
android 12 SurfaceFlinger开机启动分析
android
hunterandroid14 分钟前
Paging 3 RemoteMediator 实战:构建离线优先的分页列表
android·前端
码农coding27 分钟前
android12 开机启动PMS
android
Chloeis Syntax43 分钟前
JAVAEE初阶 --- 构造HTTP请求
网络·网络协议·http·postman
Days20501 小时前
GPT-Image-2 国风美学人设生成提示词分享
android·gpt
浮江雾1 小时前
Flutter第十节-----Flutter布局与组件全解析
android·开发语言·前端·学习·flutter·入门
Jomurphys2 小时前
Compose 适配 - 自适应布局(窗口大小类 WindowSizeClasses、列表详情、辅助窗格)
android·compose
wuqingshun3141592 小时前
说说TCP的3次握手?为什么需要三次握手?
服务器·网络协议·tcp/ip
plainGeekDev2 小时前
synchronized → Coroutines
android·java·kotlin