22/6/2,重启电脑后打开typora跳转到https://typora.io/#download,记得这个版本不是收费版。所以猜测是不是过期了(当时不确定是否有过期设定)?
回退系统时间测试可以打开,恢复时间则不能打开,确定是根据时间戳判定过期。
打开注册表:
HKEY_CURRENT_USER\SOFTWARE\Typora\IDate
11/26/2018
修改其中的时间为最近的时间,测试可以打开。
没时间,先凑合用。不忙了分析下收费版本,做个补丁。
22/6/14,失效了,打开还是过期了。网上搜了下,有人分析过了,还有工具,照着操作不成功,记录下完整的步骤吧。
解包
https://github.com/fossabot/typoraCracker/blob/master/README_CN.md
clone下来,需要py3环境,py2缺少依赖库。
按照README操作是错误的,可以解包,但是不能打包(也可能是没有兼容Windows)。
Python39\python.exe typora.py app.asar asar\
解包是可以的,但是下面的打包:
Python39\python.exe typora.py -u asar\ asar_dest\
2022-06-14 17:14:36.788 | INFO | __main__:packWenc:109 - set outFilePath: asar_dest\app.asar
2022-06-14 17:14:36.788 | ERROR | __main__:packWenc:115 - TODO: found folder
Traceback (most recent call last):
File "C:\data\typoraCracker\typora.py", line 151, in <module>
main()
File "C:\data\typoraCracker\typora.py", line 146, in main
args.mode(args.asarPath, args.dirPath, args.format)
File "C:\data\typoraCracker\typora.py", line 116, in packWenc
raise IsADirectoryError
IsADirectoryError
需要指定具体目录:
Python39\python.exe typora.py -u asar\dec_app asar_dest\
但是打包生成的app.asar无法运行(已测试dec_app和tmp_app,以及解包后不修改打包等)。
不打包
看到其他文章,不需要打包,复制解包后的dec_app到resources\app(dec_app改名为app),还是不能运行,根据报错信息:缺少main.node,把resources\app.asar.unpacked下面的main.node复制过来,可以启动了。
修改
格式化License.js,修改其中的:
const firstValidateLicense = e = > {
licenseInitialed = !0;
const n = readLicenseInfo(), {
license: t,
email: i
} = n || {};
t && i ? (fillLicense(i, t), renewLicense(n, e)) : unfillLicense()
}, showDialog = (e, n) = > electron.dialog.showMessageBox(null, {
type: "error",
buttons: ["OK"],
defaultId: 0,
cancelId: 0,
title: e,
message: n
}), endBetaTest = function() {
/*app.expired = !0, showDialog(Dict.getPanelString("Error"), Dict.getPanelString("This beta version of Typora is expired, please download and install a newer version.")).then(() = > {
shell.openExternal("https://typora.io/#download"), setTimeout(() = > {
process.exit(1)
}, 1e3)
})*/
}, validateBetaTest = function() {
if (!hasLicense && !isLinux && global.devVersion) {
var e = getInstallDate(),
n = new Date;
console.log("buildTime is 1634312906905"), (isNaN(1634312906905) || n - 1634312906905 > 20736e6) && endBetaTest(), e -= 0, console.log("verInitTime is " + e), !isNaN(e) && n - e > 1728e7 && endBetaTest()
}
}, showLicensePanelIfNeeded = function() {
shouldShowNoLicenseHint() && !app.setting.inFirstShow && (!lastShown || new Date - lastShown > 18e6 || getTrailRemains(!0, 30) <= 0) && showLicensePanel()
};
把过期时触发的endBetaTest(跳网站,结束进程)函数注释掉即可。
可知除了安装时间和当前时间计算外,还有当前时间和固定的时间戳(1634312906905)比较,所以当前时间超过固定的时间戳太多的情况下修改安装时间就无效了。
修改后运行报错,猜测是格式化问题。测试格式化不修改果然也报错。修改后压缩代码后运行通过,不过期了。不确定是不是格式化后的JavaScript语法错误了。
当前最新版1.3.6应该是改了密钥、算法?因为base64解码后不是16的倍数。还是逻辑放在main.node,待分析。