Overall Steps#
- Find the mini program that needs to be unpacked.
- Decrypt the found mini program.
- Unpack.
Find the desired mini program#
Take Windows WeChat as an example and find the storage location of WeChat.
When using the command line, please note that "WeChat Files" contains spaces. If you directly copy and paste it into the command line, it will be truncated. Therefore, you need to wrap "WeChat Files" in double quotation marks.
The "Applet" in it is the directory of the mini program used under the current WeChat storage, and the file name represents the wxid. Here, you can reopen the mini program that needs to be unpacked, then refresh the directory, and filter the desired mini program directory by sorting by date. Remember the wxid, which is the folder name.
Go to the leaf node in the folder, and there will be a folder named with a number in the middle:
You can see the wxapkg file in it. If it is __APP__.wxapkg
, skip the decryption step.
In addition, after finding the corresponding wxid, you can also find some resources in the folder "WeChat Files > xxxx > Applet > [wxid]". However, I have no knowledge of WeChat mini program development and do not know the relationship between these resources.
Decrypt#
The tool used is wechatMiniAppReverse:
git clone https://github.com/superBiuBiuMan/wechatMiniAppReverse --depth 1```
![image-1709005811333](ipfs://Qmchb7kD32mVCPbpbCsdjWXjswN7q4jVxMMAwMocHvuj42)
cd to 1.first, and then use the following command to decrypt:
```shell
.\pc_wxapkg_decrypt.exe -wxid [wxid] -in [PathTo*.wxapkg] -out [PathToOutFile]
Unpack#
cd to 2.second, and then use the following command:
npm install
node [PathTo2.second\nodejs\wuWxapkg.js] [PathToOutFile]
After testing, using the node in 2.second will cause an error. Obviously, you need to install node yourself here.
- Install node yourself
- Install dependencies
npm install esprima --save
npm install css-tree --save
npm install cssbeautify --save
npm install vm2 --save
npm install uglify-es --save
npm install js-beautify --save
npm install escodegen --save
npm install cheerio --save
Unpacking successful:
From the directory structure, it seems to be developed with cocos. However, there are not many resources that can be directly obtained. It is estimated that further digging is required from the JSON. I'll pass here.