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

相关推荐
AFinalStone9 分钟前
Android 7系统休眠唤醒(六)唤醒全链路
android·电源管理·休眠唤醒
q5673152334 分钟前
企业级 HTTP 代理采购选型:技术评估清单 15 项
开发语言·网络·爬虫·网络协议·http·隧道ip·代理ip
白嫖一茶37 分钟前
HTTP 状态码详解:五大类与常见状态码解析
网络·网络协议·http
雨白1 小时前
深入理解 Kotlin 协程 (九):互通有无,解构 Channel 缓冲策略与底层无锁机制
android·kotlin
ai_xiaogui2 小时前
PanelAI没有域名也能装?IP安装+自签HTTPS+安全加固全攻略(私有化部署必备)
tcp/ip·安全·https·私有化部署·自签证书·panelai·自带https自动续证
灯塔@kuaidao3 小时前
平台交叉编译名词解释与基础流程
android
__Witheart__3 小时前
3568 Android otg模式下adb热拔插不识别
android·adb·rockchip
treesforest4 小时前
如何解决IP定位精度不足导致的投放偏差
网络·网络协议·tcp/ip·ip属地·查ip归属地
明天…ling5 小时前
Upload-Labs (Pass1-Pass21) 完整通关思路与源码分析
android·网络安全·渗透测试·burpsuite·upload-labs·文件上传绕过·靶场复现
__Witheart__5 小时前
3568 Android ntp校时使用
android·rockchip