aL1CesT 168a8e42f1 feat(decrypt): 支持酷狗 .kgg 格式
原先的解密依赖 MusicDecrypto.Library,它支持 ncm/qmc/kgm/kgma/kwm,但任何
版本都不支持 .kgg,这类文件会被直接拒绝。

.kgg 不是自包含的:音频用 QMC2 加密,而每个文件的 ekey 并不存放在文件里。
文件里只有偏移 0x48 处的 32 字节音频哈希;对应的 ekey 在酷狗客户端的
KGMusicV3.db(表 ShareFileItems)里,而这个数据库本身也是逐页加密的。

所以必须先读数据库:

  1. 逐页解密 KGMusicV3.db(AES-128-CBC,key/IV 由主密钥和页号派生)
  2. 用文件的音频哈希查出 ekey
  3. 解码 ekey(TC-TEA CBC,含 V2 两段式变体)
  4. 构造 QMC2 解密器(短密钥用映射表,长密钥用 RC4)
  5. 按 1 MB 分块流式解密音频
  6. 读解密后的头 4 个字节判断真实扩展名(fLaC / OggS / 否则 mp3)

实际后果:.kgg 只能在本机解密,因为那条 ekey 记录只有在酷狗客户端下载过
这首歌时才会写入。别人给的 .kgg 解不了。

新增内容:
- Common/MusicDecryption/Kugou/ —— TcTea、EkeyDecoder、Qmc2Cipher、
  KugouEkeyDatabase、KggMusicDecryptor
- IKugouKeyProvider / KugouKeyProvider —— 探测数据库、缓存已解析的密钥表、
  支持手动指定数据库路径
- IMusicDecryptor.ConvertMusicAsync 增加可选 CancellationToken,让大文件真的
  能被中断(桌面端有"停止"按钮)
- 输出先写 .part,校验字节数之后才改名,中途中断不会留下一个看起来完成
  了的残缺文件

注意:
- Microsoft.Data.Sqlite 会传递引入 SQLitePCLRaw.lib.e_sqlite3 2.1.11,该版本
  被 NU1903 / GHSA-2m69-gcr7-jv3q 标记。显式引用
  SQLitePCLRaw.bundle_e_sqlite3 3.0.5 覆盖掉它。
- e_sqlite3.dll 是原生依赖,单文件发布会把它留在 exe 外面,必须随包分发。

酷狗算法移植自 MIT 协议的 kgg-dec 参考实现,因此 THIRD-PARTY-NOTICES.md
带上原始版权与许可声明,每个移植文件头部也标了来源。
2026-11-09 04:27:41 +08:00
2026-01-09 00:25:01 +08:00
2026-01-09 00:25:01 +08:00
2022-10-01 14:01:46 +08:00
2026-01-09 00:15:43 +08:00
2021-05-07 10:26:26 +08:00

English | 简体中文

Disclaimer

  • This tool is for personal learning and research purposes only. The executable binary files are for demonstration purposes only and the source code and its products must not be used for commercial purposes. Otherwise, I here will not be responsible for any related legal issues.
  • Any unit or individual that downloads and uses the software resulting in any accidents, negligence, contract breaches, defamation, copyright or intellectual property infringement, and their resulting losses (including but not limited to direct, indirect, incidental or derivative losses), I here will not bear any legal responsibility.
  • Users clearly agree to all the terms listed in this statement and fully assume the risks and consequences of using this tool. I here will not bear any legal responsibility.

Introduction

ZonyLrcToolX 4 is a cross-platform lyrics download tool based on CEF. QQ Group: 337656932. Detailed video tutorials are available in the group files.

🚧 The current version is under development. 🚧 If you want to see working code, please switch to the dev branch.

Download

To get the latest version, please visit the Release page for download.

Arch Linux User Repository

This software has been packaged into AUR. Arch Linux and its derivative distribution users can install it with the following command:

# yay or other AUR Helpers
yay -S zonylrctoolsx-bin

ZonyLrcTools.Cli --help

Usage

Detailed usage instructions have been moved to a new documentation site. Please visit https://docs.myzony.com for complete documentation.

Donation

爱发电

Star History

Star History Chart

S
Description
ZonyLrcToolsX 是一个能够方便地下载歌词的小软件。
Readme MIT
18 MiB
0 Stars 1 Watchers 0 Forks
Languages
C# 99.7%
PowerShell 0.2%
Shell 0.1%