Decompile the WeChat applet to obtain the front-end source code wxapkg of the applet


Research purposes

The reason for studying decompilation is that I wrote a small program that I worked so hard for half a month. I forgot to backup it on the desktop. I was anxious to experience the Win11 system. Reinstall the system. I forgot to back up the source code. Later, I found a tutorial on decompilation on the Internet. I tried to decompile the small program that was already online. It really works. The source code can be considered retrieved! So I posted to share the process of decompilation.

Ready to work

1. WeChat computer version (recommended the latest version)
2. Node.js environment
3. Mini Program Package Decryption Tool
4. Decompile the script

Mini program package decryption tool and decompilation script:


1. Install the Node.js environment
Node.js download:

2. Log in to the computer version of WeChat, run the small program you want to decompile, and click on each page to ensure that all pages are loaded. After finishing, find your WeChat file storage directory.

Find the Applet directory, the appid of the applet you just opened is the corresponding encrypted package

3. Decrypt. Open the decryption tool, select the encrypted package directory you just found, import the decryption tool to decrypt, and get the wxapkg package after decryption.

4. Copy the wxapkg package to the wxappUnpacker-master directory of the decompilation script, use the cmd tool to cd to the wxappUnpacker-master directory, and install the following dependencies in sequence.

npm install esprima
npm install css-tree
npm install cssbeautify
npm install vm2
npm install uglify-es
npm install js-beautify

After all dependencies are installed, you can start decompiling.

5. Decompile. Run the decompilation command, and node wuWxapkg.js decrypts the package.

node wuWxapkg.js wxe1577ebe280af504.wxapkg

6. If the decompilation is successful, the appid directory of the current decompiled applet will be generated in the same directory.

The decompiled wxml, wxss, json are basically the same as what you wrote before, but there will be a few places where js is replaced by other strings, such as true with !1, false with !0, etc. You can basically use it manually It can be changed, and it won't be affected if it is not changed.

阅读 5.6k


4.1k 声望
226 粉丝
0 条评论


4.1k 声望
226 粉丝