React Native Hermes 反编译

发布时间:2024-01-19 18:52:57

Hermes 是专门针对 React Native 应用而优化的全新开源 JavaScript 引擎。对于很多应用来说,启用 Hermes 引擎可以优化启动时间,减少内存占用以及空间占用。从 React Native 0.70 版本开始 Hermes 已经默认启用,无需开发者再做任何配置。

也就说在0.70 后基本上 index.android.bundle是Hermes的bytecode,没办法直接查看源码,需要借助其他工具进行反编译。

Hermes官方提供了hbcdump工具,可以进行反编译,但使用起来比较麻烦,有另一个开源工具hbctool可以对hermesbytecode进行反编译与回编译

https://github.com/bongtrop/hbctool 提供了59, 62, 74, 76版本的反编译

https://github.com/niosega/hbctool/tree/draft/hbc-v84 对84版本的Hermes进行补充

安装可以反编译84版本的hbctool

pip install https://github.com/niosega/hbctool/archive/ac6fabb69a7229ed9764997d153d4f703d1381aa.zip

反编译

hbctool disasm index.android.bundle bundle

回编译

hbctool asm bundle index.android.bundle.re

这里我安装的时候出现了一个问题 :

-bash: hbctool: command not found

并没有自动配置全局命令

这时候可以去看下 pip install 完成后的日志

在这里插入图片描述

这个就是安装路径,进入到该文件夹:
执行 python3 __init__.py 等同于执行 hbctool

文章来源:https://blog.csdn.net/u011213403/article/details/135702921
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。