代码拉取完成,页面将自动刷新
同步操作将从 猫头猫/wxpc-miniprogram-decryption 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const fs = require('fs').promises;
const crypto = require('crypto');
const path = require('path');
const program = require('commander');
const chalk = require('chalk');
// consts
const salt = 'saltiest';
const iv = 'the iv: 16 bytes';
// main
const wxmd = async (wxid, pkgsrc, pkgdst) => {
try {
const buf = await fs.readFile(pkgsrc);
const bufHead = buf.slice(6, 1024 + 6);
const bufTail = buf.slice(1024 + 6);
// handle head part
const dk = await new Promise((resolve, reject) => {
crypto.pbkdf2(wxid, salt, 1000, 32, 'sha1', (err, dk) => {
if (err) {
reject(err);
}
resolve(dk);
})
})
const decipher = crypto.createDecipheriv('aes-256-cbc', dk, iv);
const originalHead = Buffer.alloc(1024, decipher.update(bufHead));
// handle tail part
const xorKey = wxid.length < 2 ? 0x66 : wxid.charCodeAt(wxid.length - 2);
const tail = [];
for(let i = 0; i < bufTail.length; ++i){
tail.push(xorKey ^ bufTail[i]);
}
const originalTail = Buffer.from(tail);
// write to file
pkgdst = pkgdst || '.'
const fstate = await fs.lstat(pkgdst);
if(fstate.isDirectory()){
pkgdst = path.join(pkgdst, `/decrypt_${wxid}.wxapkg`);
}
await fs.writeFile(pkgdst, Buffer.concat([originalHead, originalTail]), 'binary');
console.log(chalk.green('解码完成'))
} catch (err) {
console.log(chalk.red(`错误: ${err}`));
}
}
program
.command('decry <wxid> <src> [dst]')
.description('解码PC端微信小程序包')
.action((wxid, src, dst) => {
wxmd(wxid, src, dst);
})
program.version('1.0.0')
.usage("decry <wxid> <src> [dst]")
.parse(process.argv);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。