-将版本号从 0.0.2 修改为 0.1.2 - 移除了异常时抛出的 RuntimeException - 新增了 C 语言和 Java代码的执行功能 - 优化了 Python 代码的执行方式- 添加了代码编辑器的前端界面 - 新增了 QQ音乐文件解密工具的 UI 界面 - 添加了 C++ 解密库的框架
96 lines
3.4 KiB
Java
96 lines
3.4 KiB
Java
package org.QQdecryption;
|
|
|
|
import com.axis.innovators.box.tools.FolderCreator;
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.InputStreamReader;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
public class QQMusicAutoDecryptor {
|
|
|
|
/**
|
|
* 解密QQ加密的文件
|
|
* @param inputPath 源文件路径
|
|
* @param outputDir 标准输出目录路径
|
|
*/
|
|
public static void decrypt(String inputPath, String outputDir) {
|
|
try {
|
|
// 构建UnlockQQ.exe路径
|
|
String unlockExe = FolderCreator.getLibraryFolder() + File.separator + "UnlockQQ.exe";
|
|
|
|
// 处理输出文件名和路径
|
|
File inputFile = new File(inputPath);
|
|
String originalName = inputFile.getName();
|
|
|
|
// 创建扩展名映射表(可根据需要扩展)
|
|
Map<String, String> formatMap = new HashMap<>() {{
|
|
put(".mflac", ".flac");
|
|
put(".mgg", ".ogg");
|
|
put(".qmc0", ".mp3");
|
|
put(".qmc3", ".mp3");
|
|
put(".qmcflac", ".flac");
|
|
put(".qmcogg", ".ogg");
|
|
put(".tkm", ".mp3");
|
|
put(".qmc2", ".mp3");
|
|
put(".bkcmp3", ".mp3");
|
|
put(".bkcflac", ".flac");
|
|
put(".ogg", ".ogg");
|
|
}};
|
|
|
|
// 自动识别并转换文件格式
|
|
String outputFileName = originalName;
|
|
int lastDotIndex = originalName.lastIndexOf('.');
|
|
if (lastDotIndex > 0) {
|
|
String ext = originalName.substring(lastDotIndex).toLowerCase();
|
|
if (formatMap.containsKey(ext)) {
|
|
outputFileName = originalName.substring(0, lastDotIndex)
|
|
+ formatMap.get(ext);
|
|
} else {
|
|
throw new RuntimeException("未知文件格式: " + ext);
|
|
}
|
|
}
|
|
|
|
File outputFile = new File(outputDir, outputFileName);
|
|
|
|
// 构建命令参数(处理带空格的路径)
|
|
String[] cmd = {
|
|
unlockExe,
|
|
"\"" + inputFile.getAbsolutePath() + "\"",
|
|
"\"" + outputFile.getAbsolutePath() + "\""
|
|
};
|
|
|
|
// 执行解密命令
|
|
Process process = Runtime.getRuntime().exec(cmd);
|
|
int exitCode = process.waitFor();
|
|
|
|
// 检查执行结果
|
|
if (exitCode == 0) {
|
|
System.out.println("解密成功: " + outputFile.getAbsolutePath());
|
|
|
|
} else {
|
|
System.err.println("解密失败,错误码: " + exitCode);
|
|
printProcessError(process);
|
|
}
|
|
|
|
} catch (IOException | InterruptedException e) {
|
|
System.err.println("解密过程中出现异常: ");
|
|
e.printStackTrace();
|
|
throw new RuntimeException("解密过程中出现异常: ", e);
|
|
}
|
|
}
|
|
|
|
// 添加错误流打印方法
|
|
private static void printProcessError(Process process) throws IOException {
|
|
try (BufferedReader reader = new BufferedReader(
|
|
new InputStreamReader(process.getErrorStream()))) {
|
|
String line;
|
|
while ((line = reader.readLine()) != null) {
|
|
System.err.println("[EXE ERROR] " + line);
|
|
throw new RuntimeException("解密失败: " + line);
|
|
}
|
|
}
|
|
}
|
|
} |