经常用creator开发,但是有时候碰到一些问题,想看下creator源码,无赖creator不开源。 话不多说直接开始。
首先安装工具:
npm install --engine-strict asar -g
查看帮助:
➜ Resources asar --help Usage: asar [options] [command] Manipulate asar archive files Options: -V, --version output the version number -h, --help display help for command Commands: pack|p [options] <dir> <output> create asar archive list|l [options] <archive> list files of asar archive extract-file|ef <archive> <filename> extract one file from archive extract|e <archive> <dest> extract archive * help [command] display help for command
和zip命令类似, 先查看list命令。
➜ Resources asar help list Usage: asar list|l [options] <archive> list files of asar archive Options: -i, --is-pack each file in the asar is pack or unpack -h, --help display help for command
直接进入creator安装目录
➜ Resources ls -la total 357048 drwxr-xr-x 19 dzq admin 608 7 12 19:33 . drwxr-xr-x 8 dzq admin 256 9 27 2020 .. -rw-r--r-- 1 dzq admin 76134 9 27 2020 LICENSE.rtf -rw-r--r-- 1 dzq admin 182170717 9 27 2020 app.asar drwxr-xr-x 4 dzq admin 128 9 27 2020 app.asar.unpacked drwxr-xr-x 13 dzq admin 416 9 27 2020 builtin drwxr-xr-x 21 dzq admin 672 9 27 2020 cocos2d-x -rwxr-xr-x 1 dzq admin 99681 9 27 2020 default_app.asar -rwxr-xr-x 1 dzq admin 298152 9 27 2020 electron.asar -rw-r--r-- 1 dzq admin 151467 9 27 2020 electron.icns drwxr-xr-x 2 dzq admin 64 9 27 2020 en.lproj drwxr-xr-x 2 dzq admin 64 9 27 2020 en_GB.lproj drwxr-xr-x 33 dzq admin 1056 9 27 2020 engine -rw-r--r-- 1 dzq admin 27 7 12 19:33 package-lock.json drwxr-xr-x 26 dzq admin 832 9 23 18:02 static drwxr-xr-x 8 dzq admin 256 9 27 2020 templates drwxr-xr-x 6 dzq admin 192 9 27 2020 utils drwxr-xr-x 2 dzq admin 64 9 27 2020 zh_CN.lproj drwxr-xr-x 2 dzq admin 64 9 27 2020 zh_TW.lproj
开始使用工具查看文件:
➜ Resources asar list -i app.asar node:internal/buffer:84 throw new ERR_BUFFER_OUT_OF_BOUNDS(); ^ RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds at new NodeError (node:internal/errors:370:5) at boundsError (node:internal/buffer:84:11) at Buffer.readUInt32LE (node:internal/buffer:220:5) at Pickle.getPayloadSize (/usr/local/lib/node_modules/asar/node_modules/chromium-pickle-js/lib/pickle.js:192:24) at new PickleIterator (/usr/local/lib/node_modules/asar/node_modules/chromium-pickle-js/lib/pickle.js:27:28) at Pickle.createIterator (/usr/local/lib/node_modules/asar/node_modules/chromium-pickle-js/lib/pickle.js:144:12) at Object.module.exports.readArchiveHeaderSync (/usr/local/lib/node_modules/asar/lib/disk.js:78:31) at Object.module.exports.readFilesystemSync (/usr/local/lib/node_modules/asar/lib/disk.js:84:25) at Object.module.exports.listPackage (/usr/local/lib/node_modules/asar/lib/asar.js:165:15) at Command.<anonymous> (/usr/local/lib/node_modules/asar/bin/asar.js:54:22) { code: 'ERR_BUFFER_OUT_OF_BOUNDS' }
非常尴尬,越界了。可能app.asar 文件太大导致吧。现在开始对asar 工具动刀。
从逻辑来看可能是sizeBuf太大。 加个日志打印一下下。。。
看到这个信息,我就确定creator对 .asar做了特殊处理了。 900的大小,居然报错?
有时间再破解它,有加密就有解密。