From ad314a8c42b7fe696f7133a2dde81faa8cb3424c Mon Sep 17 00:00:00 2001 From: xhacker-zzz <959220793@qq.com> Date: Thu, 19 Jan 2023 19:41:01 +0800 Subject: [PATCH] small fixes --- src/QmcWasm/qmc.hpp | 8 ++++---- src/decrypt/index.ts | 8 +++++++- src/decrypt/qmc.ts | 12 +++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/QmcWasm/qmc.hpp b/src/QmcWasm/qmc.hpp index c56c8e9..3f26ecf 100644 --- a/src/QmcWasm/qmc.hpp +++ b/src/QmcWasm/qmc.hpp @@ -131,6 +131,10 @@ public: int PreDecode(std::string ext) { cipherType = checkType(ext); size_t tailSize = 0; + if (cipherType == "invalid" || cipherType == "STag") { + error = "file is invalid or not supported (Please downgrade your app)."; + return -1; + } if (cipherType == "QTag") { tailSize = 8; } @@ -156,10 +160,6 @@ public: } rawKeyBuf = tmp; } - if (cipherType == "invalid") { - error = "file is invalid or not supported(Please downgrade your app.)"; - return -1; - } return keySize + tailSize; } diff --git a/src/decrypt/index.ts b/src/decrypt/index.ts index 58d09bb..e7c464b 100644 --- a/src/decrypt/index.ts +++ b/src/decrypt/index.ts @@ -50,9 +50,12 @@ export async function Decrypt(file: FileInfo, config: Record): Prom case 'tm3': // QQ Music IOS Mp3 rt_data = await RawDecrypt(file.raw, raw.name, 'mp3'); break; + case 'qmc0': //QQ Music Android Mp3 case 'qmc3': //QQ Music Android Mp3 case 'qmc2': //QQ Music Android Ogg - case 'qmc0': //QQ Music Android Mp3 + case 'qmc4': //QQ Music Android Ogg + case 'qmc6': //QQ Music Android Ogg + case 'qmc8': //QQ Music Android Ogg case 'qmcflac': //QQ Music Android Flac case 'qmcogg': //QQ Music Android Ogg case 'tkm': //QQ Music Accompaniment M4a @@ -68,6 +71,7 @@ export async function Decrypt(file: FileInfo, config: Record): Prom case 'mggl': //QQ Music Mac case 'mflac': //QQ Music New Flac case 'mflac0': //QQ Music New Flac + case 'mflach': //QQ Music New Flac case 'mgg': //QQ Music New Ogg case 'mgg1': //QQ Music New Ogg case 'mgg0': @@ -98,6 +102,8 @@ export async function Decrypt(file: FileInfo, config: Record): Prom case 'x3m': rt_data = await XimalayaDecrypt(file.raw, raw.name, raw.ext); break; + case 'mflach': //QQ Music New Flac + throw '网页版无法解锁,请使用CLI版本' default: throw '不支持此文件格式'; } diff --git a/src/decrypt/qmc.ts b/src/decrypt/qmc.ts index ebeebfe..3154f90 100644 --- a/src/decrypt/qmc.ts +++ b/src/decrypt/qmc.ts @@ -28,8 +28,16 @@ export const HandlerMap: { [key: string]: Handler } = { qmc0: { ext: 'mp3', version: 2 }, qmc2: { ext: 'ogg', version: 2 }, qmc3: { ext: 'mp3', version: 2 }, + qmc4: { ext: 'ogg', version: 2 }, + qmc6: { ext: 'ogg', version: 2 }, + qmc8: { ext: 'ogg', version: 2 }, bkcmp3: { ext: 'mp3', version: 1 }, + bkcm4a: { ext: 'm4a', version: 1 }, bkcflac: { ext: 'flac', version: 1 }, + bkcwav: { ext: 'wav', version: 1 }, + bkcape: { ext: 'ape', version: 1 }, + bkcogg: { ext: 'ogg', version: 1 }, + bkcwma: { ext: 'wma', version: 1 }, tkm: { ext: 'm4a', version: 1 }, '666c6163': { ext: 'flac', version: 1 }, '6d7033': { ext: 'mp3', version: 1 }, @@ -131,7 +139,9 @@ export class QmcDecoder { private searchKey() { const last4Byte = this.file.slice(-4); const textEnc = new TextDecoder(); - if (textEnc.decode(last4Byte) === 'QTag') { + if (textEnc.decode(last4Byte) === 'STag') { + throw new Error('文件中没有写入密钥,无法解锁,请降级App并重试'); + } else if (textEnc.decode(last4Byte) === 'QTag') { const sizeBuf = this.file.slice(-8, -4); const sizeView = new DataView(sizeBuf.buffer, sizeBuf.byteOffset); const keySize = sizeView.getUint32(0, false);