当前位置:首页 > IT技术 > 微信平台 > 正文

微信小程序分包反编译教程
2021-07-26 10:26:18

 

以EMS中国邮政速递物流小程序为例介绍下带分包小程序反编译操作流程

应部分同学的要求做了一个分包教程

实验环境

  • 操作系统:MacOS v10.15.7

  • node: v10.18.0

  • 微信开发者工具: Nightly v1.04.2011202

前置准备

  • 需要安装pc端模拟器工具可以选择网易MuMu,或者其它模拟器

  • 模拟器设置中配置共享文件夹

  • 下载反编译工具

    • wxappUnpacker:https://github.com/xuedingmiaojun/wxappUnpacker

模拟器内软件安装

需要安装以下两个软件

  • RE文件管理器(获取root权限,查看小程序压缩包)

  • 微信(使用微信打开小程序以下载小程序包)
    微信小程序分包反编译教程_微信小程序

获取小程序包

1.使用自己手机上的微信打开"EMS中国邮政速递物流"小程序,可以添加到"我的小程序"
2.打开模拟器的微信并登录
3.在模拟器微信的下拉小程序最近使用历史中打开"EMS中国邮政速递物流",如果历史记录中没有就在我的小程序中找一找
4.打开小程序等待加载之后点击相关页面就可以去找源码包了
5.打开RE文件管理器,进入到以下路径查找源码包(可以根据下载时间区分出你想要的源码包)

  1. /data/data/com.tencent.mm/MicroMsg/4c8188dbf07eec893d0ac90974657aeb/appbrand/pkg

6.拷贝小程序包至模拟器共享文件夹
微信小程序分包反编译教程_微信小程序_02获取完毕。

开始解包

这个小程序分包不多,只有一个。

解包流程

1.复制小程序包文件夹到工具根目录,cd 进入工具根目录
如果没有安装过依赖包就先执行安装

  1. npm install

2.解主包

  1. ./bingo.sh ems/_1968016507_142.wxapkg

可以看到命令行输出如下提示

  •  
node /Users/xg/project/wxappUnpacker/wuWxapkg.js Unpack file ems/_1968016507_142.wxapkg...
Header info: firstMark: 0xbe unknownInfo: 0 infoListLength: 7589 dataLength: 2424590 lastMark: 0xed
File list info: fileCount: 220Saving files...Unpack done.Split app-service.js and make up configs & wxss & wxml & wxs...deal config okdeal js okdeal wxss.js okdeal css ok=======================================================这个小程序采用了分包子包个数为: 1 =======================================================Decompile ./components/Dialog/dialog.wxml...Decompile success!Decompile ./components/address-card/address-card.wxml...Decompile success!Decompile ./components/address-view/address-view.wxml...Decompile success!Decompile ./components/agreeMent/agreeMent.wxml...Decompile success!Decompile ./components/appointment/appointment.wxml...Decompile success!Decompile ./components/childaddress-card/childaddress-card.wxml...Decompile success!Decompile ./components/cityView/cityView.wxml...Decompile success!Decompile ./components/cropper/cropper.wxml...Decompile success!Decompile ./components/pasteboard/pasteboard.wxml...Decompile success!Decompile ./components/realInfo-view/realInfo-view.wxml...Decompile success!Decompile ./components/show-model/show-model.wxml...Decompile success!Decompile ./components/show-protocol/show-protocol.wxml...Decompile success!Decompile ./components/tip/tip.wxml...Decompile success!Decompile ./pages/address/address.wxml...Decompile success!Decompile ./pages/batchGoodsType/batchGoodsType.wxml...Decompile success!Decompile ./pages/batchRecognition/batchRecognition.wxml...Decompile success!Decompile ./pages/batchRecognitionSuccess/batchRecognitionSuccess.wxml...Decompile success!Decompile ./pages/batchSend/batchSend.wxml...Decompile success!Decompile ./pages/batchSendList/batchSendList.wxml...Decompile success!Decompile ./pages/batchSendSuccess/batchSendSuccess.wxml...Decompile success!Decompile ./pages/dropin_order/order.wxml...Decompile success!Decompile ./pages/emsCropper/emsCropper.wxml...Decompile success!Decompile ./pages/estimatedCost/estimatedCost.wxml...Decompile success!Decompile ./pages/evaluate/evaluate.wxml...Decompile success!Decompile ./pages/follow/follow.wxml...Decompile success!Decompile ./pages/freightTime/freightTime.wxml...Decompile success!Decompile ./pages/home/home.wxml...Decompile success!Decompile ./pages/inviteFriends/inviteFriends.wxml...Decompile success!Decompile ./pages/inviteOrder/inviteOrder.wxml...Decompile success!Decompile ./pages/main/main.wxml...Decompile success!Decompile ./pages/message/message.wxml...Decompile success!Decompile ./pages/myMessage/myMessage.wxml...Decompile success!Decompile ./pages/newOrEditAddress/newOrEditAddress.wxml...Decompile success!Decompile ./pages/orderDetails/orderDetails.wxml...Decompile success!Decompile ./pages/orderDetailsByCancel/orderDetailsByCancel.wxml...Decompile success!Decompile ./pages/place_order/order.wxml...Decompile success!Decompile ./pages/printOrders/printOrders.wxml...Decompile success!Decompile ./pages/queryMail/queryMail.wxml...Decompile success!Decompile ./pages/queryResult/queryResult.wxml...Decompile success!Decompile ./pages/returnGoods/returnGoods.wxml...Decompile success!Decompile ./pages/wxLogin/wxLogin.wxml...Decompile success!Guess wxss(first turn)...splitJs: /Users/xg/project/wxappUnpacker/ems/_1968016507_142/app-service.js@babel/runtime/helpers/arrayWithoutHoles.js@babel/runtime/helpers/asyncToGenerator.js@babel/runtime/helpers/defineProperty.js@babel/runtime/helpers/interopRequireDefault.js@babel/runtime/helpers/iterableToArray.js@babel/runtime/helpers/nonIterableSpread.js@babel/runtime/helpers/toConsumableArray.js@babel/runtime/regenerator.jspages/address/city-data.min.jsutils/barIndex.jsutils/barcode.jsutils/base64.jsutils/bluetooth.jsutils/common.jsutils/config.jsutils/internationalCode/hkList.jsutils/internationalCode/internationalCode.jsutils/login.jsutils/md5.jsutils/qqmap-wx-jssdk.min.jsutils/qrcode.jsutils/requestApi.jsutils/urlEncodeGBK.min.jsapp.jscomponents/Dialog/dialog.jscomponents/address-card/address-card.jscomponents/address-view/address-view.jscomponents/agreeMent/agreeMent.jscomponents/appointment/appointment.jscomponents/childaddress-card/childaddress-card.jscomponents/cityView/cityView.jscomponents/cropper/cropper.jscomponents/pasteboard/pasteboard.jscomponents/realInfo-view/realInfo-view.jscomponents/show-model/show-model.jscomponents/show-protocol/show-protocol.jscomponents/tip/tip.jspages/main/main.jspages/place_order/order.jspages/dropin_order/order.jspages/home/home.jspages/address/address.jspages/newOrEditAddress/newOrEditAddress.jspages/follow/follow.jspages/printOrders/printOrders.jspages/batchSend/batchSend.jspages/batchSendSuccess/batchSendSuccess.jspages/emsCropper/emsCropper.jspages/message/message.jspages/estimatedCost/estimatedCost.jspages/freightTime/freightTime.jspages/queryMail/queryMail.jspages/wxLogin/wxLogin.jspages/inviteFriends/inviteFriends.jspages/inviteOrder/inviteOrder.jspages/myMessage/myMessage.jspages/orderDetails/orderDetails.jspages/batchRecognition/batchRecognition.jspages/batchRecognitionSuccess/batchRecognitionSuccess.jspages/evaluate/evaluate.jspages/batchGoodsType/batchGoodsType.jspages/orderDetailsByCancel/orderDetailsByCancel.jspages/batchSendList/batchSendList.jspages/queryResult/queryResult.jspages/returnGoods/returnGoods.jsSplitting "/Users/xg/project/wxappUnpacker/ems/_1968016507_142/app-service.js" done.Import count info: {"./bin/weui.wxss":3}Guess wxss(first turn) done.Generate wxss(second turn)...Generate wxss(second turn) done.Save wxss...saveDir: /Users/xg/project/wxappUnpacker/ems/_1968016507_142Split and make up done.Delete files...Deleted.
File done.Total use: 4801.182ms

3.解分包
命令格式:./bingo.sh分包.wxapkg-s=主包目录

  1. ./bingo.sh ems/_-844810613_142.wxapkg -s=ems/_1968016507_142


执行结果

  •  
node /Users/xg/project/wxappUnpacker/wuWxapkg.js Unpack file ems/_-844810613_142.wxapkg...
Header info: firstMark: 0xbe unknownInfo: 0 infoListLength: 2065 dataLength: 518422 lastMark: 0xed
File list info: fileCount: 38Saving files...Unpack done.now dir: /Users/xg/project/wxappUnpacker/ems/_-844810613_142param of mainDir: ems/_1968016507_142sub package word dir: /Users/xg/project/wxappUnpacker/ems/_-844810613_142/packageAreal mainDir: /Users/xg/project/wxappUnpacker/ems/_-844810613_142/ems/_1968016507_142Split app-service.js and make up configs & wxss & wxml & wxs...deal js okdeal sub html oksplitJs: /Users/xg/project/wxappUnpacker/ems/_-844810613_142/packageA/app-service.jspackageA/components/advertBanner/advertBanner.jspackageA/pages/advertLoadHtl/advertLoadHtl.jspackageA/pages/internationalOrder/baojia/baojia.jspackageA/pages/internationalOrder/goodsName/goodsName.jspackageA/pages/printer/printer.jspackageA/pages/explain/explain.jspackageA/pages/invoice/invoice.jspackageA/pages/certification/certification.jspackageA/pages/member/member.jspackageA/pages/newAddAddress/newAddAddress.jspackageA/pages/goodsType/goodsType.jspackageA/pages/orderDoorResult/orderDoorResult.jspackageA/pages/orderSelfResult/orderSelfResult.jspackageA/pages/internationalAddress/receive/receive.jspackageA/pages/internationalList/internationalList.jspackageA/pages/interOrderDetails/interOrderDetails.jspackageA/pages/internationalOrder/haiguan/haiguan.jspackageA/pages/internationalOrder/internationalOrder.jspackageA/pages/internationalSuccess/internationalSuccess.jspackageA/pages/internationalOrder/addHaiguanContent/addHaiguanContent.jspackageA/pages/stayInviteOrder/stayInviteOrder.jspackageA/pages/pickUpComplaint/pickUpComplaint.jspackageA/pages/complaintSuccess/complaintSuccess.jspackageA/pages/complaintDetail/complaintDetail.jspackageA/pages/entertainment/entertainment.jsSplitting "/Users/xg/project/wxappUnpacker/ems/_-844810613_142/packageA/app-service.js" done.Decompile ./packageA/components/advertBanner/advertBanner.wxml...Decompile success!Decompile ./packageA/pages/advertLoadHtl/advertLoadHtl.wxml...Decompile success!Decompile ./packageA/pages/certification/certification.wxml...Decompile success!Decompile ./packageA/pages/complaintDetail/complaintDetail.wxml...Decompile success!Decompile ./packageA/pages/complaintSuccess/complaintSuccess.wxml...Decompile success!Decompile ./packageA/pages/entertainment/entertainment.wxml...Decompile success!Decompile ./packageA/pages/explain/explain.wxml...Decompile success!Decompile ./packageA/pages/goodsType/goodsType.wxml...Decompile success!Decompile ./packageA/pages/interOrderDetails/interOrderDetails.wxml...Decompile success!Decompile ./packageA/pages/internationalAddress/receive/receive.wxml...Decompile success!Decompile ./packageA/pages/internationalList/internationalList.wxml...Decompile success!Decompile ./packageA/pages/internationalOrder/addHaiguanContent/addHaiguanContent.wxml...Decompile success!Decompile ./packageA/pages/internationalOrder/baojia/baojia.wxml...Decompile success!Decompile ./packageA/pages/internationalOrder/goodsName/goodsName.wxml...Decompile success!Decompile ./packageA/pages/internationalOrder/haiguan/haiguan.wxml...Decompile success!Decompile ./packageA/pages/internationalOrder/internationalOrder.wxml...Decompile success!Decompile ./packageA/pages/internationalSuccess/internationalSuccess.wxml...Decompile success!Decompile ./packageA/pages/invoice/invoice.wxml...Decompile success!Decompile ./packageA/pages/member/member.wxml...Decompile success!Decompile ./packageA/pages/newAddAddress/newAddAddress.wxml...Decompile success!Decompile ./packageA/pages/orderDoorResult/orderDoorResult.wxml...Decompile success!Decompile ./packageA/pages/orderSelfResult/orderSelfResult.wxml...Decompile success!Decompile ./packageA/pages/pickUpComplaint/pickUpComplaint.wxml...Decompile success!Decompile ./packageA/pages/printer/printer.wxml...Decompile success!Decompile ./packageA/pages/stayInviteOrder/stayInviteOrder.wxml...Decompile success!Guess wxss(first turn)...Import count info: {}Guess wxss(first turn) done.Generate wxss(second turn)...Generate wxss(second turn) done.Save wxss...saveDir: /Users/xg/project/wxappUnpacker/ems/_-844810613_142/ems/_1968016507_142

4.将分包内容拷贝至主包相应目录

导入开发者工具

打开微信开发者工具,导入项目
注意在项目设置中勾选不校验合法域名

微信小程序分包反编译教程_微信小程序_03

参考资料

  • 网易MuMu:http://mumu.163.com/

 

微信小程序分包反编译教程_微信小程序_04

啥??微信小程序逆向教程微信小程序上线嘞


微信小程序分包反编译教程_微信小程序_05

微信小程序解包常见问题汇总第二弹


微信小程序分包反编译教程_微信小程序_06

2020年微信小程序解包常见问题汇总


微信小程序分包反编译教程_微信小程序_07

一起来探索下微信小程序包的魔数


微信小程序分包反编译教程_微信小程序_08

微信小程序逆向源码深度揭秘


微信小程序分包反编译教程_微信小程序_09

介绍一个可跨平台的微信小程序反编译客户端

 

本文摘自 :https://blog.51cto.com/x

开通会员,享受整站包年服务立即开通 >