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 即为修改后的最终文件。

相关推荐
好的佩奇10 小时前
Dart 之可迭代对象与生成器
android·flutter·dart
_祝你今天愉快11 小时前
Paint Cavans高级绘制:[三] Canvas高阶使用技巧-变换,状态保存,离屏缓冲,粒子特效
android
小乖写代码11 小时前
提交注册验证 · WhatsApp /v2/register
android·网络·账号注册
二流小码农15 小时前
鸿蒙开发:router组件升级,彻底告别手动配置
android·ios·harmonyos
Digitally16 小时前
如何在安卓设备上使用 4 种简单方法将应用移动到 SD 卡
android
booboosui17 小时前
录一遍就会:8 种步骤、6 类失败,卡住时只修那一步
android
阿杰m17 小时前
Android源码第十五章:Camera2 与 CameraService——一帧图像怎样回到应用
android
恋猫de小郭1 天前
Flutter Analyzer 系列坑推进,必看,AI 时代这玩意最吃你内存
android·前端·flutter
VIP_CQCRE1 天前
AI 子站域名能打开就算上线?一份 DNS、登录与计费验收清单
https·dns·ai应用·网站运维·acedatacloud
LinXunFeng1 天前
拿竞品 App 一扫,技术栈全暴露了
android·flutter·开源