Last active
July 7, 2025 09:20
-
-
Save nonefffds/532580aaa591d01f40c5d2c387fac129 to your computer and use it in GitHub Desktop.
对加密的anki卡片内容解密
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //本脚本参考了 https://oddpaw.com/2023/07/decrypt-anki-deck/ | |
| //非常感谢原作者的贡献 | |
| //本脚本仅供个人使用,请勿将获取他人的anki卡组解密后再次售卖 | |
| //本脚本适用于anki卡片模板里有 decryptBack() 的js函数的anki卡片,本质:使用了 https://www.jsjiami.com/jsjiami.v6.html 进行加密 | |
| //使用方法:在anki里使用chrome inspector打断点获得加密使用的key,在本脚本开头填入key,在本脚本末尾填入输入输出的txt路径 | |
| //保存本脚本为 anki-decryption.js 在终端内导航到脚本所在位置并输入 node ./anki-decryption.js | |
| //如何打断点:(如果有时间再更新) | |
| function akDecrypt(encryptedText) { | |
| const key = "这里填写打断点获得的key"; | |
| const iv = "12345679abcdefgj"; | |
| return KKK['JJJ'].decrypt(encryptedText, KKK.enc.Utf8.parse(key), { | |
| 'iv': KKK.enc.Utf8.parse(iv), | |
| 'mode': KKK.mode.CBC, | |
| 'padding': KKK.pad.Pkcs7 | |
| }).toString(KKK.enc.Utf8); | |
| } | |
| //为了避免一些原因,请在这自行插入你找到的从 | |
| //KKK = KKK || function(u, p) { | |
| //开始,一直到 | |
| //u.JJJ = p._createHelper(d)})(); | |
| //这里结束的大概715行的代码 | |
| const fs = require('fs'); | |
| const regex = /≯#.*?#≮/g; | |
| function run(){ | |
| const content = fs.readFileSync('这里填写输入的txt文件路径', {encoding: 'utf-8'}); | |
| const rows = content.split('\n'); | |
| const results = []; | |
| for(const row of rows){ | |
| const matches = row.match(regex); | |
| if(!matches){ | |
| results.push(row); | |
| continue; | |
| } | |
| let newRow = row; | |
| for(const match of matches){ | |
| newRow = newRow.replace(match, akDecrypt(match.replace('≯#', '').replace('#≮', ''))); | |
| } | |
| results.push(newRow); | |
| } | |
| fs.writeFileSync('这里填写输出的txt文件路径', results.join('\n'), {encoding: 'utf-8'}) | |
| } | |
| run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
作者很厉害啊,我也是参照https://oddpaw.com/2023/07/decrypt-anki-deck/这篇博客把一个加密卡组解密了,但是我找key的方式比较麻烦,是从混淆代码里面找到key的生成路径,找到私钥后再进行解析混淆代码解决的,iv也是这么找到的。打断点的确方便很多