且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

反编译 React Native index.android.bundle

更新时间:2021-08-28 08:24:29

For Macbook

brew install apktool

安装 apktool 后,通过在终端上运行此命令来解压缩 apk 文件,如下所示:

after install apktool, unzip apk file by run this command on terminal like this:

apktool  d /pathOfApkFile.apk

之后,您将在 pathOfApkFile/assets/index.android.bundle

你可以使用 react-native-decompiler 来反编译 index.android.bundle 文件

than you can use react-native-decompiler for decompile index.android.bundle file

你可以通过运行这个命令反编译index.android.bundle

you can decompile index.android.bundle by run this command

npx react-native-decompiler -i ./index.android.bundle -o ./output

之后,你会在./output目录下得到JS反编译文件

after that, you will get JS decompiled file in ./output directory

React Native 已经在做 uglify js 代码了.

React Native is already doing uglify js code.

react-native-obfuscating-transformer 也在制作复杂的丑化代码

and react-native-obfuscating-transformer is also make complex uglifying code

它类似于 MD5 和 SHA256 加密,并且没有可用的工具正确知道何时进行机器学习和蛮力为我们提供估计代码

It is something like MD5 and SHA256 encryption and there is no the tool available right know when make machine learning and bruteforce to give us estimated code

如果你想改变 react-native-obfuscating-transformer 是否实现,那么你可以编辑 index.android.bundle 并保存代码,然后实现 react-native-obfuscating-transformer 并编辑和比较两个文件

您可以通过在 build.gradle 中添加名为 bundleInRelease: true 的标志并添加 Hermes 将 js 包转换为字节码以提高效率

you can make more uglify code by adding flag in build.gradle called bundleInRelease: true and add Hermes which turns js bundle to bytecode for efficiency

REF

注意:没有办法反编译index.android.bundle,因为这个文件包含uglify代码,一行可能有很多反面

Note: There is no way to decompile index.android.bundle because this file contains uglify code which has many reverses possible of one line

您可以使用 DEX2JAR 将 apk 转换为 java 代码您可以从 JD-GUI

you can use DEX2JAR to convert apk to java code and you can view that code from JD-GUI

你可以看到这个视频