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

相关推荐
zzq779721 分钟前
别把大模型 API Key 写进 APK:移动 AI 应用接口防盗刷实践
android·人工智能·安全·app加固·御盾安全·安卓加固
xiaopang2 小时前
RK3568 AOSP 编译与快速部署实战
android
码农coding3 小时前
android12 SystemUI之通知
android
summerkissyou19874 小时前
android - 性能 - Perfetto - cpu 分析教程及例子
android·性能
Shell运维手记4 小时前
ARP 协议超详细讲解(适合网工考试 / 运维理解)
运维·网络·网络协议·智能路由器
AFinalStone5 小时前
Android 7系统休眠唤醒(七)内核层—wakelock与autosleep机制
android·休眠唤醒
starvapour6 小时前
在关机键损坏的情况下让手机关机
android·adb·手机
ShineWinsu6 小时前
对于Linux:HTTP中cookie、session的解析
linux·网络·c++·网络协议·http·cookie·session
AFinalStone6 小时前
Android 7系统休眠唤醒(八)内核层—Alarm定时唤醒与硬件唤醒源
android·电源管理·休眠唤醒