WeChat Minigame Decompiling (微信小游戏反编译)

I really hope this blog can do a few favor for your work! ^ _ ^

How to Get .wxapkg files?

Start mini program which we want to grab.

Open File Explorer (Find) and go to Path like one followed

  • On Mac
/Users/<User>/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/wx7564fd5313d24844
  • On Windows
C:\Users\yourname\Documents\WeChat Files\Applet\wx7564fd5313d24844

Copy these .wxapkg files

Copy them to a new folder and Rename, such as game/.

**Important things: **for Minigame, there may be 2 game folder sometime. Ones for plugins (file name always like __plugin.wxapkg, which we don’t need to decomplie, and others for game packages, which we need to decomplie).

image-20241010225442514

How to Decomplie these files?

We need to use a decomplie tool, and you can find it in here: https://github.com/Matt23-star/minigameDecomplie

Decrypt .wxapkg files

use pc_wxapkg_decrypt.exe in decrypt/to decrypt .wxapkg files.

pc_wxapkg_decrypt.exe -wxid <minigameId> -in path/to/minigameId -out <targetPath>

Decomplie .wxapkg files

Install the required dependencies in Decomplie/

  • Open terminal in this folder

  • Install the required dependencies by running the following command or commands

npm install	

or

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

If you don’t have node.js. Install it firstly. Find more info in

Decomplie unpacking .wxapkg files after decryption

  • Method 1: We can run the following command
node .\wuWxapkg.js ..\<file path>\<file name>.wxapkg

​ Then move subpackages into main folder.

  • Method 2: Run unpacker.py script
python unpack.py -s <source_path> -t <target_path> 

And we will get game folders, one full main folder

How to Complile the project? Use Wechat devtools

微信开发者工具:https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html

Import main folder which is our mini-game package into WeChat Devtools