微信小程序反编译(逆向),仅用于学习请勿商用

时间:2024-03-07 11:58:37

1. 找到wxapk

夜神模拟器 + ES文件浏览器

反编译小程序,这一篇就够了!!!

最新反编译任何微信小程序,以及独立分包、插件的处理方式

 

2. 逆向wxapk

https://github.com/Ryan-Miao/wxappUnpacker

GitHub - wanliofficial/wxappUnpacker: 微信小程序本地应用包逆向工具

https://github.com/Cherrison/CrackMinApp

https://github.com/leo9960/wechat-app-unpack

微信小程序反编译(逆向)

https://github.com/xuedingmiaojun/mp-unpack

 

3. 反编译过程中遇到问题

1)解包原理

从一次失败的微信小程序抓包、反编译经历中学习反思

2019-10-15解决微信小程序反编译的所有问题:分包、插件等等

                throw this._internal.Decontextify.value(e);
                ^
ReferenceError [Error]: __vd_version_info__ is not defined

解决方案:

最新解决小程序反编译$gwx is not defined和__vd_version_info__ is not defined

function runOnce() {

for (let name in runList) {

// console.log(name, runList[name]);

var start = `var window = window || {}; var __pageFrameStartTime__ = Date.now(); var __webviewId__; var __wxAppCode__={}; var __mainPageFrameReady__ = function(){}; var __WXML_GLOBAL__={entrys:{},defines:{},modules:{},ops:[],wxs_nf_init:undefined,total_ops:0}; var __vd_version_info__=__vd_version_info__||{};

$gwx=function(path,global){

if(typeof global === \'undefined\') global={};if(typeof __WXML_GLOBAL__ === \'undefined\') {__WXML_GLOBAL__={};

}__WXML_GLOBAL__.modules = __WXML_GLOBAL__.modules || {};

}`;

runVM(name, start + " \r\n" + runList[name]);

}

}

解决$gwx is not defined

functionrunVM(name,code){

    let wxAppCode={},handle={cssFile:name};

    let gg = new GwxCfg();

    let tsandbox ={$gwx:GwxCfg.prototype["$gwx"],__mainPageFrameReady__:GwxCfg.prototype["$gwx"],__wxAppCode__:wxAppCode,setCssToHead:cssRebuild.bind(handle)};

    let vm = new VM({sandbox:tsandbox});

    vm.run(code);

    for(let name in wxAppCode)if(name.endsWith(".wxss")){

        handle.cssFile=path.resolve(frameName,"..",name);

        wxAppCode[name]();

    }

}