反编译小程序

发布时间:2023年12月21日

在电脑端安装模拟器工具,夜神模拟器
在模拟器中安装微信:用于微信打开小程序时加载小程序包。
在模拟器中文件管理器:用于查看小程序包,这里使用模拟器自带的Amaze。
文件共享路径:可以通过模拟器的文件助手查看文件共享路径,模拟器中的安卓共享路径对应于电脑共享路径。作用是方便后续找到并复制小程序包。
在这里插入图片描述

下载反编译工具

开始反编译小程序

1、获取小程序包
这里以东方财富小程序为例,在夜神模拟器中登录微信,然后找到并打开东方财富小程序

在这里插入图片描述
2、打开模拟器中的Amaze文件管理器,进入到以下路径查找源码包(可以根据文件的下载时间,区分出你想要的源码包),不同的小程序中间的那段hash值是不一样的/data/data/com.tencent.mm/MicroMsg/7931eb2bec903760d4266d663b5fbd0e/appbrand/pkg
在这里插入图片描述
3、拷贝小程序文件包至模拟器共享文件夹,为了方便起见,可以先新建了一个文件夹wxcode,将复制的小程序包放到此文件夹下的东方财富文件夹

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
4、然后在电脑端的共享文件夹中,可以看到刚刚复制的小程序包

在这里插入图片描述

开始解包

1、进入反编译工具wxappUnpacker项目的根目录,运行yarn install安装依赖包

2、在wxappUnpacker项目根目录下,执行解包命令node wuWxapkg.js <path/to/xxx.wxapkg>。一个小程序一般会有多个包,我们需要找出主包。执行解包命令时,后面的参数需要具体到主包的文件名。经过多次试验总结发现,一般主包是以 _-开头,文件名与其他的文件看起来是不同的。

在这里插入图片描述
可以看到命令行输出如下提示:

$ node wuWxapkg.js ../dongFangCaiFu/_-2081057737_66.wxapkg
Unpack file ../dongFangCaiFu/_-2081057737_66.wxapkg...

Header info:
  firstMark: 0xbe
  unknownInfo:  0
  infoListLength:  6445
  dataLength:  2158356
  lastMark: 0xed

File list info:
  fileCount:  172
Saving files...
Unpack done.
Split app-service.js and make up configs & wxss & wxml & wxs...
deal config ok
deal js ok
deal html ok
deal css ok
splitJs: F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66\app-se
rvice.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 02CB91817FA2198
C64ADF986253F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 0FD5E5F37FA2198
C69B38DF4E56F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 11EAF9667FA2198
C778C91613F8F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 1CC3D0F37FA2198
C7AA5B8F4A5BF1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 212D2CB47FA2198
C474B44B3E9ED1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 24EFAE017FA2198
C4289C606DDFE1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 3CE424D77FA2198
C5A824CD01A9F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 44199CD77FA2198
C227FF4D0319E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 4C52C3117FA2198
C2A34AB16818D1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 4E3F4A367FA2198
C28592231639D1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 50E340B47FA2198
C368528B3AD5E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 5A0161E27FA2198
C3C6709E5BCAF1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 5B1C0EE47FA2198
C3D7A66E321EF1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 61219CD57FA2198
C0747F4D25F6E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 6249DFF57FA2198
C042FB7F293FE1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 680649437FA2198
C0E602144E54F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 69160F537FA2198
C0F706754BA2E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 6987BC357FA2198
C0FE1D432427F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 7B819AE57FA2198
C1DE7F2E233DE1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 8AC58DF47FA2198
CECA3E5F3B31E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 8ACE1F557FA2198
CECA8775277FD1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 8D1643E27FA2198
CEB702BE507CD1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 99D2EAB27FA2198
CFFB482B564BD1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/arrayLikeToArray.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/arrayWithHoles.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/arrayWithoutHoles.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/asyncToGenerator.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/defineProperty.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/interopRequireDefault.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/iterableToArray.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/iterableToArrayLimit.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/nonIterableRest.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/nonIterableSpread.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/objectSpread2.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/slicedToArray.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/toConsumableArray.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/typeof.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
helpers/unsupportedIterableToArray.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 @babel/runtime/
regenerator.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 A2A31AD37FA2198
CC4C572D43E9E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 A2E1F3817FA2198
CC4879B86A08E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 ADC668017FA2198
CCBA0000675CF1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 B33469017FA2198
CD552010620FF1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 B4790A047FA2198
CD21F6203CEAE1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 C6F555147FA2198
CA0933D13385F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 C7D2F7C37FA2198
CA1B49FC4CE1F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 C92323547FA2198
CAF454B537B2F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 D5D51E667FA2198
CB3B37661A5AD1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 D7E073717FA2198
CB1861B76F3EE1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 DD9D93E57FA2198
CBBFBFBE2D12E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 E174D1B77FA2198
C8712B9B0BC0F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 E48C9AB07FA2198
C82EAF2B73D3E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 E9AA86447FA2198
C8FCCEE438F4E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 F19F4B857FA2198
C97F92382008F1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 F4E555647FA2198
C92833D6310CE1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 F917D9857FA2198
C9F71B182FFCF1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 FE8EF1457FA2198
C98E8994269DD1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 FF3491C77FA2198
C9952F9C0870E1537.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 app.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/base
-modal/modal.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/call
-login-modal/call-login-modal.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/down
form/downform.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/foot
bar-share/footbar-share.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/foot
bar/footbar.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/imag
e-share copy/image-share.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/imag
e-share/image-share.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/kaih
uform/kaihuform.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/logi
n-modal/login-modal.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/moda
l/modal.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/navb
ar/navbar.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/navi
gator/navigator.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/open
app copy/openapp.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/open
app/openapp.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/stoc
k-list/stock-list.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/user
/user.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 components/zhi-
shu/zhi-shu.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/download
copy/download.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/index/ind
ex.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/kaihu/kai
hu.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/kaihuDeta
il/kaihuDetail.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/download/
download.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/market/ma
rket.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/stockDeta
il/stockDetail.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/gubaDetai
l/gubaDetail.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/protocol/
index.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/LoginInde
x/LoginIndex.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/timeShare
/timeShare.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/timeShare
HK/timeShareHK.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/timeShare
US/timeShareUS.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/SearchPag
e/SearchPage.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/informati
onDetail/informationDetail.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/LoginPage
/Login.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/My/My.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/Bindinged
EMPage/BindingedEMPage.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/zixun/zix
un.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/zixunDeta
il/zixunDetail.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/gubaPost/
gubaPost.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/loginByTe
l/loginByTel.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/BPTest/BP
Test.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/viewDialo
g/viewDialog.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/test/test
.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/bankuai/b
ankuai.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/data/data
.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/me/me.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/error/err
or.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/Agreement
View/AgreementView.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/fissionkh
Auth/fissionkhAuth.js
F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66 pages/fissionkh
AuthSucc/fissionkhAuthSucc.js
Splitting "F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66\app-
service.js" done.
Decompile ./components/base-modal/modal.wxml...
Decompile success!
Decompile ./components/call-login-modal/call-login-modal.wxml...
Decompile success!
Decompile ./components/downform/downform.wxml...
Decompile success!
Decompile ./components/footbar-share/footbar-share.wxml...
Decompile success!
Decompile ./components/footbar/footbar.wxml...
Decompile success!
Decompile ./components/image-share copy/image-share.wxml...
Decompile success!
Decompile ./components/image-share/image-share.wxml...
Decompile success!
Decompile ./components/kaihuform/kaihuform.wxml...
Decompile success!
Decompile ./components/login-modal/login-modal.wxml...
Decompile success!
Decompile ./components/modal/modal.wxml...
Decompile success!
Decompile ./components/navbar/navbar.wxml...
Decompile success!
Decompile ./components/navigator/navigator.wxml...
Decompile success!
Decompile ./components/openapp copy/openapp.wxml...
Decompile success!
Decompile ./components/openapp/openapp.wxml...
Decompile success!
Decompile ./components/stock-list/stock-list.wxml...
Decompile success!
Decompile ./components/user/user.wxml...
Decompile success!
Decompile ./components/zhi-shu/zhi-shu.wxml...
Decompile success!
Decompile ./pages/AgreementView/AgreementView.wxml...
Decompile success!
Decompile ./pages/BPTest/BPTest.wxml...
Decompile success!
Decompile ./pages/BindingedEMPage/BindingedEMPage.wxml...
Decompile success!
Decompile ./pages/LoginIndex/LoginIndex.wxml...
Decompile success!
Decompile ./pages/LoginPage/Login.wxml...
Decompile success!
Decompile ./pages/My/My.wxml...
Decompile success!
Decompile ./pages/SearchPage/SearchPage.wxml...
Decompile success!
Decompile ./pages/bankuai/bankuai.wxml...
Decompile success!
Decompile ./pages/data/data.wxml...
Decompile success!
Decompile ./pages/download copy/download.wxml...
Decompile success!
Decompile ./pages/download/download.wxml...
Decompile success!
Decompile ./pages/error/error.wxml...
Decompile success!
Decompile ./pages/fissionkhAuth/fissionkhAuth.wxml...
Decompile success!
Decompile ./pages/fissionkhAuthSucc/fissionkhAuthSucc.wxml...
Decompile success!
Decompile ./pages/gubaDetail/gubaDetail.wxml...
Decompile success!
Decompile ./pages/gubaPost/gubaPost.wxml...
Decompile success!
Decompile ./pages/index/index.wxml...
Decompile success!
Decompile ./pages/informationDetail/informationDetail.wxml...
Decompile success!
Decompile ./pages/kaihu/kaihu.wxml...
Decompile success!
Decompile ./pages/kaihuDetail/kaihuDetail.wxml...
Decompile success!
Decompile ./pages/loginByTel/loginByTel.wxml...
Decompile success!
Decompile ./pages/market/market.wxml...
Decompile success!
Decompile ./pages/me/me.wxml...
Decompile success!
Decompile ./pages/protocol/index.wxml...
Decompile success!
Decompile ./pages/stockDetail/stockDetail.wxml...
Decompile success!
Decompile ./pages/test/test.wxml...
Decompile success!
Decompile ./pages/timeShare/timeShare.wxml...
Decompile success!
Decompile ./pages/timeShareHK/timeShareHK.wxml...
Decompile success!
Decompile ./pages/timeShareUS/timeShareUS.wxml...
Decompile success!
Decompile ./pages/viewDialog/viewDialog.wxml...
Decompile success!
Decompile ./pages/zixun/zixun.wxml...
Decompile success!
Decompile ./pages/zixunDetail/zixunDetail.wxml...
Decompile success!
Guess wxss(first turn)...
Regard F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66\app.wxss
 as pure import file.
Regard F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66\pages\ba
nkuai\bankuai.wxss as pure import file.
Regard F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66\pages\gu
baDetail\gubaDetail.wxss as pure import file.
Regard F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66\pages\ti
meShare\timeShare.wxss as pure import file.
Import count info: {"./app.wxss":7,"./pages/index/index.wxss":5,"./pages/gubaD
etail/gubaDetail.wxss":2,"./timeShareCommon.wxss":4}
Guess wxss(first turn) done.
Generate wxss(second turn)...
Generate wxss(second turn) done.
Save wxss...
saveDir: F:\webstormProjects\mini-program\dongFangCaiFu\_-2081057737_66
Split and make up done.
Delete files...
Deleted.

File done.
Total use: 5.626s

3、如果想单独执行config、js、wxml、wxss的反编译可以在解包时加-o参数不做后续操作

4、工具的其他脚本的用法(基本用不到):

node wuConfig.js <files…> 将 app-config.json 中的内容拆分到各个文件对应的 .json 和 app.json , 并通过搜索 app-config.json 所在文件夹下的所有文件尝试将 iconData 还原为 iconPath 。
node wuJs.js <files…> 将 app-service.js (或小游戏中的 game.js ) 拆分成一系列原先独立的 javascript 文件,并使用 Uglify-ES 美化,从而尽可能还原编译前的情况。
node wuWxml.js [-m] <files…> 将编译/混合到 page-frame.html ( 或 app-wxss.js ) 中的 wxml 和 wxs 文件还原为独立的、未编译的文件。如果加上-m指令,就会阻止block块自动省略,可能帮助解决一些相关过程的 bug 。
node wuWxss.js <dirs…> 通过获取文件夹下的 page-frame.html ( 或 app-wxss.js ) 和其他 html 文件的内容,还原出编译前 wxss 文件的内容。
node wuWxapkg.js [-o] [-d] [-s=] <files…> 将 wxapkg 文件解包,并将包中上述命令中所提的被编译/混合的文件自动地恢复原状。如果加上-o指令,表示仅解包,不做后续操作。如果加上-d指令,就会保留编译/混合后所生成的新文件,否则会自动删去这些文件。同时,前面命令中的指令也可直接加在这一命令上。

导入开发者工具

打开微信开发者工具,导入项目即可。

在本次的东方财富小程序解包后,注意在开发者工具的详情—>本地设置

勾掉e6转es5(这个小程序貌似并没有使用es6语法)
注意勾选不校验合法域名
解包其它小程序可能项目配置略有不同,多调试调试。
在这里插入图片描述
扩展小结
体验版解包
体验版的需要找到debug开头的文件(形如:debug_xxx 是没有后缀的),然后拿到文件后手动添加wxapkg后缀再执行以上操作,即可完成解包。

解包时提示是子包
解决:有些小程序可能采取了分包策略,所以就有一个主包和多个子包之分。经过多次试验总结发现,一般主包是以 _-开头,文件名与其他的文件看起来是不同的。

在这里插入图片描述
在这里插入图片描述

转载https://blog.csdn.net/KOOK007/article/details/129784426

文章来源:https://blog.csdn.net/weixin_45289656/article/details/135123155
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。