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

2020-11-24 18:09:26

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

实验环境

  • 操作系统:MacOS v10.15.7
  • node: v10.18.0
  • 微信开发者工具: Nightly v1.04.2011202

前置准备

模拟器内软件安装

需要安装以下两个软件

  • RE文件管理器(获取root权限,查看小程序压缩包)
  • 微信(使用微信打开小程序以下载小程序包)

获取小程序包

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

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

6.拷贝小程序包至模拟器共享文件夹

获取完毕。

开始解包

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

解包流程

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

npm install

2.解主包

./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:  220
Saving files...
Unpack done.
Split app-service.js and make up configs & wxss & wxml & wxs...
deal config ok
deal js ok
deal wxss.js ok
deal 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.js
pages/address/city-data.min.js
utils/barIndex.js
utils/barcode.js
utils/base64.js
utils/bluetooth.js
utils/common.js
utils/config.js
utils/internationalCode/hkList.js
utils/internationalCode/internationalCode.js
utils/login.js
utils/md5.js
utils/qqmap-wx-jssdk.min.js
utils/qrcode.js
utils/requestApi.js
utils/urlEncodeGBK.min.js
app.js
components/Dialog/dialog.js
components/address-card/address-card.js
components/address-view/address-view.js
components/agreeMent/agreeMent.js
components/appointment/appointment.js
components/childaddress-card/childaddress-card.js
components/cityView/cityView.js
components/cropper/cropper.js
components/pasteboard/pasteboard.js
components/realInfo-view/realInfo-view.js
components/show-model/show-model.js
components/show-protocol/show-protocol.js
components/tip/tip.js
pages/main/main.js
pages/place_order/order.js
pages/dropin_order/order.js
pages/home/home.js
pages/address/address.js
pages/newOrEditAddress/newOrEditAddress.js
pages/follow/follow.js
pages/printOrders/printOrders.js
pages/batchSend/batchSend.js
pages/batchSendSuccess/batchSendSuccess.js
pages/emsCropper/emsCropper.js
pages/message/message.js
pages/estimatedCost/estimatedCost.js
pages/freightTime/freightTime.js
pages/queryMail/queryMail.js
pages/wxLogin/wxLogin.js
pages/inviteFriends/inviteFriends.js
pages/inviteOrder/inviteOrder.js
pages/myMessage/myMessage.js
pages/orderDetails/orderDetails.js
pages/batchRecognition/batchRecognition.js
pages/batchRecognitionSuccess/batchRecognitionSuccess.js
pages/evaluate/evaluate.js
pages/batchGoodsType/batchGoodsType.js
pages/orderDetailsByCancel/orderDetailsByCancel.js
pages/batchSendList/batchSendList.js
pages/queryResult/queryResult.js
pages/returnGoods/returnGoods.js
Splitting "/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_142
Split and make up done.
Delete files...
Deleted.

File done.
Total use: 4801.182ms

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

./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:  38
Saving files...
Unpack done.
now dir: /Users/xg/project/wxappUnpacker/ems/_-844810613_142
param of mainDir: ems/_1968016507_142
sub package word dir: /Users/xg/project/wxappUnpacker/ems/_-844810613_142/packageA
real mainDir: /Users/xg/project/wxappUnpacker/ems/_-844810613_142/ems/_1968016507_142
Split app-service.js and make up configs & wxss & wxml & wxs...
deal js ok
deal sub html ok
splitJs: /Users/xg/project/wxappUnpacker/ems/_-844810613_142/packageA/app-service.js
packageA/components/advertBanner/advertBanner.js
packageA/pages/advertLoadHtl/advertLoadHtl.js
packageA/pages/internationalOrder/baojia/baojia.js
packageA/pages/internationalOrder/goodsName/goodsName.js
packageA/pages/printer/printer.js
packageA/pages/explain/explain.js
packageA/pages/invoice/invoice.js
packageA/pages/certification/certification.js
packageA/pages/member/member.js
packageA/pages/newAddAddress/newAddAddress.js
packageA/pages/goodsType/goodsType.js
packageA/pages/orderDoorResult/orderDoorResult.js
packageA/pages/orderSelfResult/orderSelfResult.js
packageA/pages/internationalAddress/receive/receive.js
packageA/pages/internationalList/internationalList.js
packageA/pages/interOrderDetails/interOrderDetails.js
packageA/pages/internationalOrder/haiguan/haiguan.js
packageA/pages/internationalOrder/internationalOrder.js
packageA/pages/internationalSuccess/internationalSuccess.js
packageA/pages/internationalOrder/addHaiguanContent/addHaiguanContent.js
packageA/pages/stayInviteOrder/stayInviteOrder.js
packageA/pages/pickUpComplaint/pickUpComplaint.js
packageA/pages/complaintSuccess/complaintSuccess.js
packageA/pages/complaintDetail/complaintDetail.js
packageA/pages/entertainment/entertainment.js
Splitting "/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.将分包内容拷贝至主包相应目录

导入开发者工具

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

逆向教程小程序

为小程序逆向而生的小程序
逆向教程

参考资料

小程序逆向视频专栏

帮助你快速入门小程序逆向技能
人人都能学会的微信小程序逆向技能

小程序逆向训练营

需要指导?那就来参加训练营吧~。
小程序逆向实战训练营
购买后请微信联系讲师,拉你进学员群。

小程序正逆向·进化岛

和wept项目(就是那个可以把小程序代码运行在web端的工具)作者一起运营了一个知识星球。
这是一个私密的圈子,产出一些不方便公开的内容、技巧、工具。

  • 研究小程序/小游戏的底层实现方式、编译原理,或许对怎么开发一个小程序私有化部署平台有帮助?
  • 研究小程序/小游戏逆向的方式方法、常见问题
  • 当然这里并不局限于讨论这些、微信系产品动态、serverless 我们也会及时跟进
  • 内部发布一些独家的工具(区别于开源)、视频课

感兴趣的话可以右侧领券加入🐶

本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-ND 3.0 许可协议。可自由转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。

扫描下方二维码阅读当前文章

浏览器、微信扫码
微信小程序

评 论:

好文推荐
极客之路公众号
微信情报 更多 >
    每天进步一点点~