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

相关推荐
Lsetea3 小时前
Certbot 续期报 HTTP-01 401?Nginx Basic Auth 和挑战路径排查
nginx·https·ssl证书·acme·certbot
好的佩奇3 小时前
Dart 之测试
android·flutter·dart
好的佩奇4 小时前
蓝牙之 GATT 数据操作
android·flutter·蓝牙
三少爷的鞋5 小时前
Android 面试系列之-lifecycleScope 和 CoroutineScope(Dispatchers.Main)
android
Mars-xq6 小时前
Android studio下载很慢download fail
android·ide·android studio
2501_915909067 小时前
iOS 上架 App Store 后推送收不到,APNs 证书和生产沙盒环境排查
android·小程序·https·uni-app·iphone·webview
吃不胖爹7 小时前
安卓原生开发的app如何打包成应用
android
Lsetea8 小时前
Chrome 计划限制 P-256 CA 证书链,怎么查网站是否受影响?
chrome·https·ssl证书·openssl·pki
XLYcmy9 小时前
传输层安全(TLS)实验报告
http·https·课程设计·ip·tls·icmp·实验报告
ZHOUPUYU10 小时前
PHP 现代工程实践:从语言特性到高性能 Web 应用构建
android·前端·php