Coder Social home page Coder Social logo

wedecode's Introduction

Wedecode


npm package license license


微信 wxapkg 反编译工具,已经支持大多数小程序完美还原

Windows MacOS Linux 跨平台支持

支持功能

SUPPORT

  • 支持 小程序 还原
  • 支持 小游戏 还原
  • 支持分包代码和插件代码还原
  • 完美还原目录结构和源代码
    • JS 代码还原
    • WXML 代码还原
    • WXSS 代码还原
    • WXS 代码还原
    • JSON 文件还原
  • 其他类型文件还原 ( 媒体资源,wasm, workers...等 )
  • 所有代码美化输出
  • 小程序包扫描

TODO

  • 小程序自动解密( 最近几年的电脑端包都不需要解密,以后看情况跟进 )

准备

该工具只能在有 nodejs 环境设备上运行, 如果您还没有 nodejs 环境,点这里 去准备环境

安装工具

全局安装, 安装完成后在任意终端都可使用

# window
  npm i wedecode -g
# mac
  sudo npm i wedecode -g

运行

命令行直接输入 wedecode 即可运行, 全程自动引导

  wedecode

命令行直接指定参数

# 手动指定一个包
  wedecode ./name.wxapkg
# 或者  编译当前命令行所在文件夹内的所有包
  wedecode ./
# 或者  编译当前命令行所在文件夹下名为 dirname 文件夹的所有包
  wedecode ./dirname
# 或者: 将编译结果输出到指定目录 --out 为输出目录
  wedecode ./  --out ./output_path
# 你也可以预设任意命令行参数, 在交互时将不会向您提问, 例如
  wedecode --out output_path --clear --open-dir

使用源码运行

  git clone https://github.com/biggerstar/wedecode
  npm install  # 如果 npm 安装很慢, 可以使用右侧命令换国内的淘宝源  npm config set registry https://registry.npmmirror.com
  npm run start

命令参数

参数 作用
<packages...> 包所在路径,可以是文件或者目录
-o, --out <path> 产物及输出路径, 未指定默认放到同级目录下的 OUTPUT
--open-dir 结束编译后打开查看产物目录
--clear 是否清空旧产物
--px 是否使用 px 像素单位解析 css, 默认使用的是 rpx 单位
--unpack-only 是否只进行解包,不进行反编译

polyfill

在编译过程中, 在包所在文件夹在创建一个 polyfill 目录,如果发现里面的模块和输出到产物中的模块路径名称一致, 将会使用自定义的js模块,忽略原本js模块的编译

小程序包所在位置目录结构
  
├── target_dir  
│   ├── xxx.wxapkg    
│   ├── xxx-sub.wxapkg    
│   └── polyfill/  
│       └── @babel/    
│           └── array.js    

输出产物目录结构   

├── OUTPUT  
│   ├─ app.json  
│   ├─ pages/  
│   ├─ components/  
│   ├─ @babel/  
│      └── array.js

QA

  1. Q: 为何编译出来好多文件只有默认模板?
    A: 这可能是缺失分包,你需要把分包放在一起编译, 你可以在 app.config.json 或者 app.json 文件中查看你依赖的分包信息,
    在编译产物中出现默认模板是因为小程序会检查依赖,为了保证在缺失某些分包的情况下正常运行而生成的默认模板

免责声明

该工具仅限用于: 线上代码安全审计以便快速发现漏洞, 学习反编译原理,
请遵守国家法律, 严禁任何非法用途,
若你使用的范围不在国家法律允许的范围内, 造成的一切法律后果与作者无关。

wedecode's People

Contributors

biggerstar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wedecode's Issues

反编译小游戏提示「 未能找到 app.json 文件」

                       _                    _      
     __      _____  __| | ___  ___ ___   __| | ___ 
     \ \ /\ / / _ \/ _` |/ _ \/ __/ _ \ / _` |/ _ \
      \ V  V /  __/ (_| |  __/ (_| (_) | (_| |  __/
       \_/\_/ \___|\__,_|\___|\___\___/ \__,_|\___|
                                                   

 ▶ 解小程序压缩包成功! 文件总数: 450
 ▶ 反编译 game.json 文件成功. 

 ▶ 反编译所有 game.js 文件成功. 


 ▶ 解小程序压缩包成功! 文件总数: 2
 ▶ 反编译所有 game.js 文件成功. 


 ▶ 解小程序压缩包成功! 文件总数: 4
 ▶ 反编译所有 game.js 文件成功. 
 Completed  (423)   unity-sdk/module-helper.js
 Completed  (1695)  unity-sdk/open-data.js
 Completed  (3492)  unity-sdk/recorder.js
 Completed  (23005)     unity-sdk/resType.js
 Completed  (239)   unity-sdk/resTypeOther.js
 Completed  (2349)  unity-sdk/response.js
 Completed  (162111)    unity-sdk/sdk.js
 Completed  (884)   unity-sdk/share.js
 Completed  (3345)  unity-sdk/storage.js
 Completed  (6421)  unity-sdk/texture.js
 Completed  (2137)  unity-sdk/upload-file.js
 Completed  (2375)  unity-sdk/userinfo.js
 Completed  (4608)  unity-sdk/util.js
 Completed  (4336)  unity-sdk/utils.js
 Completed  (1876)  unity-sdk/video.js
 Completed  (6960)  unity-sdk/video/index.js
 Completed  (14731)     wasm-split.js
 Completed  (33768)     weapp-adapter.js
 Completed  (747415)    webgl.wasm.framework.unityweb.js
 Completed  (4293)  game.js
 ▶ 当前反编译目标[ 小游戏 ] (分包) : /Users/⬛️/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/⬛️/135/_wasmcode1_.wxapkg
 ▶ 当前反编译目标[ 小游戏 ] (分包) : /Users/⬛️/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/⬛️/135/_wasmcode_.wxapkg ▶ 当前输出目录:  /Users/⬛️/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/⬛️/135/__OUTPUT__

 ❌  未能找到 app.json 文件
 ✅  主包反编译结束!
 ▶ 当前输出目录:  /Users/⬛️/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/⬛️/135/__OUTPUT__

 ✅  分包反编译结束!
 ▶ 当前输出目录:  /Users/⬛️/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/⬛️/135/__OUTPUT__

 ✅  分包反编译结束!
 ✅  编译流程结束!%                                                                                                    

附小游戏压缩包:
https://pan.baidu.com/s/1cEkIeqSOa701lh9JI7AKPQ?pwd=6dti 提取码: 6dti

npm i wedecode -g 报错

npm warn deprecated [email protected]: This package is now part of the npm CLI.
npm warn deprecated [email protected]: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.

你遇到的这两个警告信息分别指向了两个不同的问题:

npx 被弃用并集成到 npm CLI:

警告信息 npm warn deprecated [email protected]: This package is now part of the npm CLI. 表示 npx 这个包已经不再作为一个独立的包存在,而是被集成到了 npm 的命令行界面(CLI)中。npx 最初是一个独立的包,用于运行项目中的包或者安装的全局包,现在你可以直接使用 npm exec 或 npm run 命令来达到相同的效果。
vm2 库存在严重安全问题并已停止维护:

警告信息 npm warn deprecated [email protected]: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm. 指出 vm2 这个库包含了关键的安全问题,不应该在生产环境中使用,并且该项目的维护已经停止。这意味着任何使用 vm2 的项目都面临着潜在的安全风险,并且可能在未来遇到兼容性问题,因为没有新的更新来修复bug或添加新特性。

该警告建议迁移到 isolated-vm,这是一个替代库,提供了与 vm2 类似的功能,但更加安全,并且仍在维护中。

如果你的项目依赖了这些包,你应该采取以下步骤:

对于 npx,检查你的项目中是否有使用 npx 的地方,如果有,考虑替换为 npm exec 或 npm run。
对于 vm2,你应该立即评估你的项目,寻找替代方案,比如 isolated-vm,并计划迁移你的代码库以避免安全风险。
在处理这些警告时,确保你理解了依赖的包在你的项目中的作用,并评估替代方案的可行性和兼容性。如果你不确定如何进行,可以寻求社区的帮助或咨询专业的开发人员。

反编译后app.json出错

反编译app.json当中的"tabBar"中的
""会被替换成"//",不知道是我自己的问题还是什么
58b0f2c6-0f16-4749-99b2-f0d3cf5c108a

请问运行报错resolveAlias is illegal ReferenceError [Error]: __wxConfig is not defined

                   _                    _
 __      _____  __| | ___  ___ ___   __| | ___
 \ \ /\ / / _ \/ _` |/ _ \/ __/ _ \ / _` |/ _ \
  \ V  V /  __/ (_| |  __/ (_| (_) | (_| |  __/
   \_/\_/ \___|\__,_|\___|\___\___/ \__,_|\___|

▶ 解小程序压缩包成功! 文件总数: 148
▶ 反编译 app.json 文件成功.

🎄 当前使用版本: v0.3.1

▶ 当前反编译目标[ 小程序 ] (主包) : C:\Users\yin\Desktop\wxpack\app.wxapkg
Completed (14589) C:\Users\yin\Desktop\wxpack_OUTPUT_\app.json ▶ 当前操作类型: 分包模式
▶ 当前输出目录: C:\Users\yin\Desktop\wxpack_OUTPUT_
resolveAlias is illegal ReferenceError [Error]: __wxConfig is not defined
at vm.js:38:22
at Script.runInContext (node:vm:133:12)
at VM.runScript (C:\Users\yin\AppData\Roaming\npm\node_modules\wedecode\node_modules\vm2\lib\vm.js:288:18)
at VM.run (C:\Users\yin\AppData\Roaming\npm\node_modules\wedecode\node_modules\vm2\lib\vm.js:508:16)
at DecompilationMicroApp.decompileAppPageJSON (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:1543:8)
at DecompilationMicroApp.decompileAll (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:1955:18)
at async singlePackMode (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:2030:3)
at async Command. (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:2089:7)

node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
ReferenceError [Error]: __wxConfig is not defined
at vm.js:39:3313
at vm.js:39:6124
at Script.runInContext (node:vm:133:12)
at VM.runScript (C:\Users\yin\AppData\Roaming\npm\node_modules\wedecode\node_modules\vm2\lib\vm.js:288:18)
at VM.run (C:\Users\yin\AppData\Roaming\npm\node_modules\wedecode\node_modules\vm2\lib\vm.js:508:16)
at DecompilationMicroApp.decompileAppPageJSON (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:1543:8)
at DecompilationMicroApp.decompileAll (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:1955:18)
at async singlePackMode (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:2030:3)
at async Command. (file:///C:/Users/yin/AppData/Roaming/npm/node_modules/wedecode/dist/wedecode.js:2089:7)

Node.js v18.20.4

C:\Users\yin\Desktop\wxpack>

报错:没有找到包特征文件

     🔶       wxapkg 反编译工具 | wedecode (0.2.7)        🔶     

? [自动判断单包或分包]  - 粘贴反编译的 '文件''目录'  路径:  
/Users/<xxx>/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/<xxx>/17
? 请输入输出目录, 默认和输入目录同级:  
 ▶ 当前操作类型: 分包模式

 ▶ 解小程序压缩包成功! 文件总数: 535
 ▶ 当前反编译目标 (主包) : /Users/<xxx>/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/<xxx>/17/__APP__.wxapkg
 ▶ 当前输出目录:  /Users/<xxx>/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet/packages/<xxx>/17/__OUTPUT__

{
  appConfigJson: 1019,
  appWxss: 0,
  appService: 0,
  pageFrame: 0,
  workers: 0,
  pageFrameHtml: 0
}
❌  没有找到包特征文件
file:///usr/local/lib/node_modules/wedecode/dist/wedecode.js:1417
    const entrys = this.DecompilationModules.entrys || {};
                                             ^

TypeError: Cannot read properties of undefined (reading 'entrys')
    at DecompilationMicroApp.decompileAppJSON (file:///usr/local/lib/node_modules/wedecode/dist/wedecode.js:1417:46)
    at async DecompilationMicroApp.decompileAll (file:///usr/local/lib/node_modules/wedecode/dist/wedecode.js:1821:5)
    at async singlePackMode (file:///usr/local/lib/node_modules/wedecode/dist/wedecode.js:1898:3)
    at async Command.<anonymous> (file:///usr/local/lib/node_modules/wedecode/dist/wedecode.js:1952:7)

Node.js v21.6.1

你好,使用 0.2.7 版本的工具对某个小游戏解包提示「没有找到包特征文件」,能帮忙分析一下原因吗?

编译报错

您好,请问在编译完成后,会出现这样的报错,但是也编译完成了,这样的话是什么原因导致的,会不会产生编译不完整的情况。
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.