executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
re-harmonyos鸿蒙(HarmonyOS)应用逆向:hap/hsp/har 包结构、ArkTS 字节码(.abc、ArkCompiler)分析。 触发词:鸿蒙、HarmonyOS、hap、ArkTS、abc 字节码、方舟编译器
Independent GitHub snapshot · Automated classification · Original documentation governs
参考 [[re-analyze/platform-tips]]——静态分析(解包、字符串、反汇编)免沙箱;动态步骤按最高原则进沙箱。
unzip -l)→ 再解包 → 验证完整性(CRC/文件数对照)apt install python3 / dnf install python3 / pacman -S python;macOS: 自带;Windows: 官方安装器python3 -m zipfile -l app.hap 列清单、python3 -m zipfile -e app.hap out/ 解包python3 --versionstrings(binutils 自带)与 grep:捞 .abc 与资源中的 URL、密钥、提示语file 判断类型再提取按顺序执行;每步产物(解包目录、反汇编输出 + sha256)存档(见 [[re-triage]])。
包结构识别与解包:
file app.hap
unzip -l app.hap | head -30
unzip -o app.hap -d out/
module.json(模块配置,等价 manifest:入口/权限/组件声明)、resources/(资源,等价 res/)、ets/(ArkTS 编译产物所在,.abc 字节码)、libs/(native .so)、assets/(rawfile 等原始资源)字节码识别(.abc):
find out/ -name "*.abc" | head
xxd out/ets/modules.abc | head -10 # 看文件头
.abc 是 ArkCompiler(方舟编译器)字节码文件,业务逻辑主体;文件头含固定魔数与版本字段,其后为段结构(字符串段/字面量段/指令段等,具体布局随编译版本演进)file 识别不出时用 xxd/python3 读头部,先识别编译版本再定工具(见坑 2)业务逻辑还原(字符串 + 反汇编):
strings -n 8 out/ets/*.abc | grep -iE 'https?://|key|secret|token|sign' | head
grep -rnE 'https?://|key|secret' out/resources/ | head # 资源内字符串也是线索
与 Android 异同:
file 识别、native so 分析([[re-format-elf]] + [[re-ghidra]])全复用;dex 相关工具(jadx/apktool)不适用,由 ArkCompiler 反汇编器替代;动态 hook 思路([[re-frida]])在鸿蒙模拟器/真机仍可用,挂载方式随环境差异调整动态侧(沙箱):