Https://www.cnblogs.com/programmer-kaima/p/5847429.html
Recently in the study of how to encrypt the unity game, so that others can not easily hack your APK package, but the online encryption method is a corresponding crack method ~_~!! Results The encryption method did not find good, reverse engineering will pour a lot. Here's how to extract resources and code from an APK package that doesn't have any protection.
(1) Open APK package
First, rename your apk package to a zip or rar file, and then unzip it as follows:
Rename it, and then unzip it to get the following directory contents:
The sections are described in the following table:
Assets |
Resources and code in Unity games |
Lib |
So files required by arm and x86 |
Meta-inf |
Information Package |
Res |
storing icons and other resources |
Androidmanifest.xml |
Manifest file |
Classes.dex |
Android Dalvik byte code |
Resources.arsc |
Compiled binary resource file |
Our main concern is the assets directory, which has the resources and code we want.
(2) Extracting code
Unity has put most of our code in this DLL file (and of course, other code like First-pass, but not the main one), and we can find all the required DLL files under the assets\bin\data\managed path. To parse the DLL file, I used this software (self-Baidu download), with the software opened to get the following interface:
By right click to export, select the export directory, wait for a while, you can get the following source code:
My test project just wrote a Test.cs, you can see the above has been successfully exported, open a look:
My darling, exactly the same as I wrote, a little bit of the same export. (This shows the importance of code obfuscation and encryption)
(3) Extract resources
To extract resources, we need to use Unity Studio, which can be downloaded on his github.
Open Unity Studio, click File/load folder, select Assets\bin\data the directory, and you will get the following interface:
Scene hierarchy can see the distribution of the scenes in the game, and asset list can view the resources.
For example, in my test project, only in the empty scene put a car model, you can analyze from this file my scene structure is as follows:
and open the asset List, you can find a blue button map I put in:
Of course, in addition to stickers, such as audio files, XML files, shaders can be seen, but the model can not be extracted from the visual (this will be used disunity)
Summary: Unity game is too easy to analyze, if the project is very important, the code confusion, encryption and other work is very important.
UNITY-APK Package code and resource extraction