Reprint: Wechat applet source code extraction and decompilation

Reprint source: www.51xuediannao.com/xiaochengxu/019c08cc.html

I. Introduction

Extracting and decompiling the source code of WeChat applets sounds like a fool, but it is actually simple and basically a fool's operation. If you want to get the source code of the WeChat applet, you just need to find the location where the source file is stored on your phone. Once you get the source file, run it with a decompiled script, and all the files and resources in the WeChat applet code package will come out (except project. config.json applet configuration file). After getting the source code, you can run it, but you can’t use the functions related to appid, such as login and authorization, because the appid on the server side of the decompiled applet is different from the appid you added locally, which is why it was pulled down The source code does not have a project.config.json file. The appid in the project is configured in this file, which protects the original applet to a certain extent.

2. Required tools

1. Night Simulator

Address: Night God Simulator

It is used to find the source files of WeChat applets. Of course, the real machine can also be used, but it is troublesome, and it has root permissions and is jailbroken. The Yeshen simulator is convenient. You can set super user permissions directly in the settings, and get super permissions. You can do whatever you want, and see the WeChat applet source files through the following RE file manager.

2. RE file manager (drag into the simulator to install automatically)

Address: RE

It is used to find the source files of WeChat applets. If the official has not changed, it should be in such a path, /data/data/com.tencent.mm/MicroMsg/.../appbrand/pkg/, there is a section in the path.. ., here means not sure about the specific one, anyway, it is one of the folders under this MicroMsg, and then you will see the appbrand folder, if so, find the location.

3. nodejs operating environment

Address: nodejs

The runtime environment required for decompiling scripts

4. Decompile the script

Address: wxappUnpacker

 It is used to decompile the source file of the WeChat applet and compile the source code. This is the masterpiece of a great master on GitHub. I found this one that is more useful, and I can find other versions by myself.

3. Start doing things

1. After installing the Yeshen emulator, drag the RE file manager downloaded on the computer to the emulator to install it.

2. Open the mobile phone settings -> find the super user -> click on the three small dots in the upper right corner, settings -> click 'super user access rights', select 'app only', so that the super user rights will be obtained.

01.png

3. Open WeChat. If you don’t have it, just download it from the app market. Open the WeChat applet you want to decompile. After the applet is opened, you can switch to the RE file manager to find the source file.

  • There is a mechanism here. When you click to open a WeChat applet, if you find an upcoming applet in this local folder, it will be downloaded from the WeChat server to the local, and this applet will be run again at some point in the future. When running, WeChat The server will notify if there is a new version of the applet. If there is a new version, it will be downloaded silently in the background, and the applet will continue to run. The new version will not be enabled until the next run. This is the update mechanism of the WeChat applet.

4. Open the RE file manager, start from changing the directory, /data/data/com.tencent.mm/MicroMsg/.../appbrand/pkg/, after finding the source file, press and hold -> click the three small Click, open the menu, select 'compress selected files' -> after completion, click View -> long press, or the upper right corner, to send the compressed package from the emulator to the computer, in a variety of ways, at will.

02.png

4. Find the source file above and pull out the source file. After downloading the decompiled file from GitHub, there will be such a folder structure on the desktop

The source files of WeChat applets are placed here under the nimi-yuan folder.

03.png

The lib folder contains decompiled scripts

04.png

5. Go to the lib folder, right click, open the command line window here, and run these commands

  • npm install esprima

  • npm install css-tree

  • npm install cssbeautify

  • npm install vm2

  • npm install uglify-es

  • npm install js-beautify

  • npm install escodegen

05.png

  • Finally, use this command to decompile the source file: node wuWxapkg.js filepath, for example, mine is: node wuWxapkg.js C:UserszwDesktopfanbianyimini-yuan\_1034625975_4.wxapkg, if the decompilation process is over, if you encounter a prompt that a certain file is missing , Just run it again with npm install filename (filename throws a missing file name).

6. After the decompilation is completed, execute successfully with node wuWxapkg.js filepath

06.png

Check the folder after successful decompilation, except for the configuration file project.config.json in the source code, there are others.

07.png

Supongo que te gusta

Origin blog.csdn.net/weixin_42551921/article/details/105237409#comments_25349070
Recomendado
Clasificación