feat(box): 升级版本号并优化代码执行功能

-将版本号从 0.0.2 修改为 0.1.2
- 移除了异常时抛出的 RuntimeException
- 新增了 C 语言和 Java代码的执行功能
- 优化了 Python 代码的执行方式- 添加了代码编辑器的前端界面
- 新增了 QQ音乐文件解密工具的 UI 界面
- 添加了 C++ 解密库的框架
This commit is contained in:
tzdwindows 7
2025-05-24 09:36:48 +08:00
parent f632b9584d
commit e475e84851
53 changed files with 42629 additions and 9 deletions

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{c4fa048f-df39-48ab-a261-c40dfedaecee}</ProjectGuid>
<RootNamespace>QQDecryption</RootNamespace>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>C:\Users\Administrator\.jdks\corretto-20.0.2.1\include\win32;C:\Users\Administrator\.jdks\corretto-20.0.2.1\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;QQDECRYPTION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;QQDECRYPTION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;QQDECRYPTION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;QQDECRYPTION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="org_QQdecryption_QQMusicAutoDecryptor.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="org_QQdecryption_QQMusicAutoDecryptor.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="org_QQdecryption_QQMusicAutoDecryptor.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="org_QQdecryption_QQMusicAutoDecryptor.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,60 @@
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
HMODULE hInjectedModule = 0;
// 修改后的导出函数定义(接受两个独立参数)
extern "C" __declspec(dllexport) void __stdcall RemoteDecrypt(LPVOID lpParam) {
DecryptParams* pParams = static_cast<DecryptParams*>(lpParam);
// 直接使用 params.src 和 params.dst
const wchar_t* src = pParams->src;
const wchar_t* dst = pParams->dst;
// 加载QQMusicCommon.dll函数
HMODULE hLib = LoadLibraryW(L"QQMusicCommon.dll");
if (!hLib) return;
typedef void* (__thiscall* EncConstructor)(void*);
typedef void(__thiscall* EncDestructor)(void*);
typedef BOOL(__thiscall* EncOpen)(void*, const wchar_t*, BOOL, BOOL);
typedef DWORD(__thiscall* EncGetSize)(void*);
typedef DWORD(__thiscall* EncRead)(void*, BYTE*, DWORD, __int64);
EncConstructor pConstructor = (EncConstructor)GetProcAddress(hLib, "??0EncAndDesMediaFile@@QAE@XZ");
EncDestructor pDestructor = (EncDestructor)GetProcAddress(hLib, "??1EncAndDesMediaFile@@QAE@XZ");
EncOpen pOpen = (EncOpen)GetProcAddress(hLib, "?Open@EncAndDesMediaFile@@QAE_NPB_W_N1@Z");
EncGetSize pGetSize = (EncGetSize)GetProcAddress(hLib, "?GetSize@EncAndDesMediaFile@@QAEKXZ");
EncRead pRead = (EncRead)GetProcAddress(hLib, "?Read@EncAndDesMediaFile@@QAEKPAEK_J@Z");
if (!pConstructor || !pDestructor || !pOpen || !pGetSize || !pRead) {
FreeLibrary(hLib);
return;
}
// 执行解密
BYTE obj[0x28] = { 0 };
pConstructor(obj);
if (pOpen(obj, src, TRUE, FALSE)) {
DWORD size = pGetSize(obj);
BYTE* buffer = new BYTE[size];
if (pRead(obj, buffer, size, 0) == size) {
std::ofstream out(dst, std::ios::binary);
out.write(reinterpret_cast<char*>(buffer), size);
out.close();
}
delete[] buffer;
}
pDestructor(obj);
FreeLibrary(hLib);
}
// DLL入口点
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
// 可选:自动解密示例文件(需根据实际路径调整)
// DecryptFileInProcess(L"C:\\Music\\encrypted.mflac", L"C:\\Music\\decrypted.flac");
hInjectedModule = hModule;
}
return TRUE;
}

View File

@@ -0,0 +1,5 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>

View File

@@ -0,0 +1,156 @@
#include "pch.h"
#include <iostream>
#include <windows.h>
#include <tlhelp32.h>
#include <string>
// <20><><EFBFBD><EFBFBD><E5B5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>DLL<4C><4C>ʵ<EFBFBD>֣<EFBFBD>
typedef void(__stdcall* RemoteDecryptFunc)(LPVOID lpParam);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQ<51><51><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>PID
DWORD FindQQMusicPID() {
PROCESSENTRY32W pe32 = { sizeof(PROCESSENTRY32W) };
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
DWORD pid = 0;
if (Process32FirstW(hSnapshot, &pe32)) {
do {
if (wcscmp(pe32.szExeFile, L"QQMusic.exe") == 0) {
pid = pe32.th32ProcessID;
break;
}
} while (Process32NextW(hSnapshot, &pe32));
}
CloseHandle(hSnapshot);
return pid;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>DLL<4C><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>̺<EFBFBD><CCBA><EFBFBD>
bool InjectAndCallDecrypt(DWORD pid, const wchar_t* src, const wchar_t* dst) {
// <20><>ȡ<EFBFBD><C8A1>ǰDLL·<4C><C2B7><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>ǰģ<C7B0><C4A3><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>
wchar_t dllPath[MAX_PATH] = { 0 };
HMODULE hCurrentModule = NULL;
// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ȡ<EFBFBD><C8A1>ǰģ<C7B0><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (!GetModuleHandleExW(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(LPCWSTR)&InjectAndCallDecrypt, // <20><><EFBFBD>⵱ǰģ<C7B0><C4A3><EFBFBD>еĵ<D0B5>ַ
&hCurrentModule
)) {
return false;
}
GetModuleFileNameW(hCurrentModule, dllPath, MAX_PATH);
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (!hProcess) return false;
// <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>д<EFBFBD><D0B4>DLL·<4C><C2B7>
SIZE_T pathSize = (wcslen(dllPath) + 1) * sizeof(wchar_t);
LPVOID pRemoteDllPath = VirtualAllocEx(hProcess, NULL, pathSize, MEM_COMMIT, PAGE_READWRITE);
if (!pRemoteDllPath || !WriteProcessMemory(hProcess, pRemoteDllPath, dllPath, pathSize, NULL)) {
CloseHandle(hProcess);
return false;
}
// ע<><D7A2>DLL
HANDLE hThread = CreateRemoteThread(
hProcess,
NULL,
0,
(LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "LoadLibraryW"),
pRemoteDllPath,
0,
NULL
);
if (!hThread) {
VirtualFreeEx(hProcess, pRemoteDllPath, 0, MEM_RELEASE);
CloseHandle(hProcess);
return false;
}
WaitForSingleObject(hThread, INFINITE);
// <20><>ȡע<C8A1><D7A2><EFBFBD><EFBFBD>DLL<4C><4C>ַ
DWORD_PTR dllBaseAddr = 0;
GetExitCodeThread(hThread, (LPDWORD)&dllBaseAddr);
CloseHandle(hThread);
// <20><><EFBFBD><EFBFBD>Զ<EFBFBD>̺<EFBFBD><CCBA><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ؼ<EFBFBD><D8BC>޸IJ<DEB8><C4B2>֣<EFBFBD>
// <20><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>غ<EFBFBD><D8BA><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ַ
HMODULE hLocalModule = GetModuleHandleW(dllPath); // <20><><EFBFBD>ص<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>ͬDLL
if (!hLocalModule) {
VirtualFreeEx(hProcess, pRemoteDllPath, 0, MEM_RELEASE);
CloseHandle(hProcess);
return false;
}
// <20><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>еĵ<D0B5>ַ<EFBFBD><D6B7>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RemoteDecryptFunc pLocalFunc = (RemoteDecryptFunc)GetProcAddress(hLocalModule,
#ifdef _WIN32
"_RemoteDecrypt@4" // 32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#else
"RemoteDecrypt" // 64λ<34><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#endif
);
if (!pLocalFunc) {
VirtualFreeEx(hProcess, pRemoteDllPath, 0, MEM_RELEASE);
CloseHandle(hProcess);
return false;
}
// <20><><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E3BAAF>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
DWORD_PTR funcOffset = (DWORD_PTR)pLocalFunc - (DWORD_PTR)hLocalModule;
// <20><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>̺<EFBFBD><CCBA><EFBFBD><EFBFBD><EFBFBD>ַ
RemoteDecryptFunc pRemoteFunc = (RemoteDecryptFunc)(dllBaseAddr + funcOffset);
// ׼<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DecryptParams localParams = { 0 };
wcscpy_s(localParams.src, MAX_PATH, src);
wcscpy_s(localParams.dst, MAX_PATH, dst);
// <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LPVOID pRemoteParams = VirtualAllocEx(hProcess, NULL, sizeof(DecryptParams), MEM_COMMIT, PAGE_READWRITE);
if (!pRemoteParams || !WriteProcessMemory(hProcess, pRemoteParams, &localParams, sizeof(DecryptParams), NULL)) {
VirtualFreeEx(hProcess, pRemoteDllPath, 0, MEM_RELEASE);
CloseHandle(hProcess);
return false;
}
// <20><><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>̵߳<DFB3><CCB5>ý<EFBFBD><C3BD>ܺ<EFBFBD><DCBA><EFBFBD>
hThread = CreateRemoteThread(
hProcess,
NULL,
0,
(LPTHREAD_START_ROUTINE)pRemoteFunc,
pRemoteParams,
0,
NULL
);
if (!hThread) {
VirtualFreeEx(hProcess, pRemoteParams, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, pRemoteDllPath, 0, MEM_RELEASE);
CloseHandle(hProcess);
return false;
}
// <20>ȴ<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
WaitForSingleObject(hThread, INFINITE);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
VirtualFreeEx(hProcess, pRemoteDllPath, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, pRemoteParams, 0, MEM_RELEASE);
CloseHandle(hThread);
CloseHandle(hProcess);
return true;
}
extern "C" __declspec(dllexport) void Execute(const wchar_t* src, const wchar_t* dst)
{
InjectAndCallDecrypt(FindQQMusicPID(), src, dst);
}

View File

@@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_QQdecryption_QQMusicAutoDecryptor */
#ifndef _Included_org_QQdecryption_QQMusicAutoDecryptor
#define _Included_org_QQdecryption_QQMusicAutoDecryptor
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_QQdecryption_QQMusicAutoDecryptor
* Method: decrypt
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_QQdecryption_QQMusicAutoDecryptor_decrypt
(JNIEnv *, jclass, jstring, jstring);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,5 @@
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

View File

@@ -0,0 +1,45 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#include <windows.h>
#include <string>
#include <fstream>
#pragma pack(push, 1)
struct DecryptParams {
wchar_t src[MAX_PATH]; // 源文件路径
wchar_t dst[MAX_PATH]; // 目标文件路径
};
#pragma pack(pop)
// 导出函数声明
extern "C" __declspec(dllexport) void __stdcall RemoteDecrypt(LPVOID lpParam);
// 目标DLL函数声明
typedef void* (__thiscall* EncConstructor)(void* thisPtr);
typedef void(__thiscall* EncDestructor)(void* thisPtr);
typedef BOOL(__thiscall* EncOpen)(void* thisPtr, const wchar_t* path, BOOL a1, BOOL a2);
typedef DWORD(__thiscall* EncGetSize)(void* thisPtr);
typedef DWORD(__thiscall* EncRead)(void* thisPtr, BYTE* buf, DWORD size, __int64 offset);
// 全局函数指针
extern EncConstructor pConstructor;
extern EncDestructor pDestructor;
extern EncOpen pOpen;
extern EncGetSize pGetSize;
extern EncRead pRead;
extern HMODULE hTargetDll;
extern HMODULE hInjectedModule;
#endif //PCH_H

View File

@@ -0,0 +1,49 @@
#include <iostream>
#include <Windows.h>
#include <io.h>
#include <fcntl.h>
// DLL function declaration
extern "C" __declspec(dllimport) void Execute(const wchar_t* src, const wchar_t* dst);
// Set console to UTF-8 mode
void SetConsoleUTF8() {
_setmode(_fileno(stdout), _O_U8TEXT);
_setmode(_fileno(stderr), _O_U8TEXT);
SetConsoleOutputCP(CP_UTF8);
}
int wmain(int argc, wchar_t* argv[]) {
// Initialize console encoding
SetConsoleUTF8();
if (argc != 3) {
std::wcerr << L"Usage: " << argv[0]
<< L" <source_path> <destination_path>" << std::endl;
return 1;
}
// Verify parameters
std::wstring src(argv[1]);
std::wstring dst(argv[2]);
try {
// Debug output
std::wcout << L"Processing file:\nSource: " << src
<< L"\nDestination: " << dst << std::endl;
// Call DLL function
Execute(src.c_str(), dst.c_str());
std::wcout << L"Operation completed successfully!" << std::endl;
return 0;
}
catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
return 2;
}
catch (...) {
std::cerr << "Unknown error occurred!" << std::endl;
return 3;
}
}

View File

@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{5f9e6925-65ba-4c62-839c-7ceb7c735e2b}</ProjectGuid>
<RootNamespace>UnlockQQ</RootNamespace>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\Users\Administrator\source\repos\QQDecryption\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>QQDecryption.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="UnlockQQ.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="UnlockQQ.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@@ -37,7 +37,7 @@ import java.util.Map;
*/
public class AxisInnovatorsBox {
private static final Logger logger = LogManager.getLogger(AxisInnovatorsBox.class);
private static final String VERSIONS = "0.0.2";
private static final String VERSIONS = "0.1.2";
private static final String[] AUTHOR = new String[]{
"tzdwindows 7"
};
@@ -71,7 +71,6 @@ public class AxisInnovatorsBox {
LibraryLoad.loadLibrary("ThrowSafely");
} catch (Exception e) {
logger.error("Failed to load the 'FridaNative' library", e);
throw new RuntimeException(e);
}
}
@@ -421,7 +420,6 @@ public class AxisInnovatorsBox {
logger.error("In unexpected errors", e);
main.ex.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
main.organizingCrashReports(e);
throw new RuntimeException(e);
}
}

View File

@@ -1,6 +1,7 @@
package com.axis.innovators.box;
import com.axis.innovators.box.browser.MainApplication;
import com.axis.innovators.box.browser.WindowRegistry;
import com.axis.innovators.box.decompilation.gui.ModernJarViewer;
import com.axis.innovators.box.tools.ArgsParser;
import com.axis.innovators.box.tools.FolderCleaner;

View File

@@ -57,6 +57,9 @@ public class CefAppManager {
try {
settings.windowless_rendering_enabled = false;
settings.javascript_flags = "--expose-gc";
settings.cache_path = FolderCreator.getLibraryFolder() + "/jcef/cache";
settings.root_cache_path = FolderCreator.getLibraryFolder() + "/jcef/cache";
settings.persist_session_cookies = true;
settings.log_severity = CefSettings.LogSeverity.LOGSEVERITY_VERBOSE;
String subprocessPath = FolderCreator.getLibraryFolder() + "/jcef/lib/win64/jcef_helper.exe";

View File

@@ -1,5 +1,6 @@
package com.axis.innovators.box.browser;
import com.axis.innovators.box.browser.util.CodeExecutor;
import com.axis.innovators.box.tools.FolderCreator;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
@@ -8,6 +9,11 @@ import org.cef.browser.CefFrame;
import org.cef.browser.CefMessageRouter;
import org.cef.callback.CefQueryCallback;
import org.cef.handler.CefMessageRouterHandlerAdapter;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.PolyglotException;
import org.graalvm.polyglot.Value;
import org.json.JSONObject;
import org.python.util.PythonInterpreter;
import org.tzd.lm.LM;
import javax.swing.*;
@@ -28,13 +34,14 @@ import java.util.concurrent.atomic.AtomicReference;
* 这是一个简单的示例程序用于展示如何使用JCEF来创建一个简单的浏览器窗口。
* @author tzdwindows 7
*/
public class MainApplication {
private static final ExecutorService executor = Executors.newCachedThreadPool();
private static long modelHandle;
private static long ctxHandle;
private static boolean isSystem = true;
public static void main(String[] args) {
//popupHTMLWindow();
}
@@ -79,6 +86,118 @@ public class MainApplication {
});
}
public static void popupCCodeEditorWindow() {
AtomicReference<BrowserWindow> window = new AtomicReference<>();
SwingUtilities.invokeLater(() -> {
WindowRegistry.getInstance().createNewWindow("main", builder ->
window.set(builder.title("TzdC 代码编辑器")
.icon(new ImageIcon(Objects.requireNonNull(MainApplication.class.getClassLoader().getResource("icons/logo.png"))).getImage())
.size(1487, 836)
.htmlPath(FolderCreator.getJavaScriptFolder() + "\\" + "CCodeEditor.html")
.operationHandler(createOperationHandler())
.build())
);
CefMessageRouter msgRouter = window.get().getMsgRouter();
if (msgRouter != null) {
msgRouter.addHandler(new CefMessageRouterHandlerAdapter() {
@Override
public boolean onQuery(CefBrowser browser, CefFrame frame, long queryId,
String request, boolean persistent, CefQueryCallback callback) {
try {
JSONObject requestJson = new JSONObject(request);
if ("executeCode".equals(requestJson.optString("type"))) {
String code = requestJson.optString("code");
String language = requestJson.optString("language");
// 调用代码执行逻辑
String result = CodeExecutor.executeCode(code, language,null);
JSONObject response = new JSONObject();
response.put("status", "success");
response.put("output", result);
callback.success(response.toString());
return true;
}
} catch (Exception e) {
JSONObject error = new JSONObject();
error.put("status", "error");
error.put("message", e.getMessage());
callback.failure(500, error.toString());
}
return false;
}
@Override
public void onQueryCanceled(CefBrowser browser, CefFrame frame, long queryId) {
// 处理请求取消
}
}, true);
}
});
}
public static void popupCodeEditorWindow() {
AtomicReference<BrowserWindow> window = new AtomicReference<>();
SwingUtilities.invokeLater(() -> {
WindowRegistry.getInstance().createNewWindow("main", builder ->
window.set(builder.title("代码编辑器")
.icon(new ImageIcon(Objects.requireNonNull(MainApplication.class.getClassLoader().getResource("icons/logo.png"))).getImage())
.size(1487, 836)
.htmlPath(FolderCreator.getJavaScriptFolder() + "\\" + "CodeEditor.html")
.operationHandler(createOperationHandler())
.build())
);
CefMessageRouter msgRouter = window.get().getMsgRouter();
if (msgRouter != null) {
msgRouter.addHandler(new CefMessageRouterHandlerAdapter() {
@Override
public boolean onQuery(CefBrowser browser, CefFrame frame, long queryId,
String request, boolean persistent, CefQueryCallback callback) {
try {
JSONObject requestJson = new JSONObject(request);
if ("executeCode".equals(requestJson.optString("type"))) {
String code = requestJson.optString("code");
String language = requestJson.optString("language");
// 调用代码执行逻辑
String result = executeCode(code, language);
JSONObject response = new JSONObject();
response.put("status", "success");
response.put("output", result);
callback.success(response.toString());
return true;
}
} catch (Exception e) {
JSONObject error = new JSONObject();
error.put("status", "error");
error.put("message", e.getMessage());
callback.failure(500, error.toString());
}
return false;
}
@Override
public void onQueryCanceled(CefBrowser browser, CefFrame frame, long queryId) {
// 处理请求取消
}
}, true);
}
});
}
public static String executeCode(String code, String language) {
return CodeExecutor.executeCode(code, language,new CodeExecutor.OutputListener() {
@Override
public void onOutput(String newOutput) {}
});
}
private static Value executeC(Context context, String code) {
return context.eval("c", code);
}
/**
* 弹出html预览窗口
*/
@@ -107,11 +226,11 @@ public class MainApplication {
Path filePath = Paths.get(path);
//// 验证文件存在性
//if (!Files.exists(filePath)) {
// callback.failure(404, "{\"code\":404,\"message\":\"文件未找到\"}");
// return true;
//}
// 验证文件存在性
if (!Files.exists(filePath)) {
callback.failure(404, "{\"code\":404,\"message\":\"文件未找到\"}");
return true;
}
// 读取文件内容
String content = Files.readString(filePath, StandardCharsets.UTF_8);

View File

@@ -1,5 +1,14 @@
package com.axis.innovators.box.browser;
import com.axis.innovators.box.tools.FolderCreator;
import org.cef.CefApp;
import org.cef.browser.CefBrowser;
import org.cef.browser.CefFrame;
import org.cef.handler.CefLoadHandlerAdapter;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.*;
import java.util.function.Consumer;
@@ -58,6 +67,8 @@ public class WindowRegistry {
config.accept(builder);
BrowserWindow window = builder.build();
registerWindow(window);
loadExtLibsPath(window);
}
/**
@@ -70,5 +81,59 @@ public class WindowRegistry {
config.accept(builder);
BrowserWindowJDialog window = builder.build();
registerChildWindow(window);
loadExtLibsPath(window);
}
private void loadExtLibsPath(BrowserWindow window) {
CefBrowser cefBrowser = window.getBrowser();
if (cefBrowser != null)
// 使用 CefClient 的调度方法(如果可用)或直接添加 LoadHandler
cefBrowser.getClient().addLoadHandler(new CefLoadHandlerAdapter() {
@Override
public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) {
if (frame.isMain()) {
try {
String extLibsPath = FolderCreator.getJavaScriptFolder() + "\\" + "extLibs";
File extLibsDir = new File(extLibsPath);
if (!extLibsDir.exists() || !extLibsDir.isDirectory()) {
throw new IOException("extLibs目录无效: " + extLibsPath);
}
String script = "window.extLibsPath = " + JSONObject.valueToString(extLibsPath) + ";";
browser.executeJavaScript(script, frame.getURL(), 0);
} catch (Exception e) {
System.err.println("注入extLibsPath失败: " + e.getMessage());
e.printStackTrace();
}
}
}
});
}
private void loadExtLibsPath(BrowserWindowJDialog window) {
CefBrowser cefBrowser = window.getBrowser();
if (cefBrowser != null)
// 使用 CefClient 的调度方法(如果可用)或直接添加 LoadHandler
cefBrowser.getClient().addLoadHandler(new CefLoadHandlerAdapter() {
@Override
public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) {
if (frame.isMain()) {
try {
String extLibsPath = FolderCreator.getJavaScriptFolder() + "\\" + "extLibs";
File extLibsDir = new File(extLibsPath);
if (!extLibsDir.exists() || !extLibsDir.isDirectory()) {
throw new IOException("extLibs目录无效: " + extLibsPath);
}
String script = "window.extLibsPath = " + JSONObject.valueToString(extLibsPath) + ";";
browser.executeJavaScript(script, frame.getURL(), 0);
} catch (Exception e) {
System.err.println("注入extLibsPath失败: " + e.getMessage());
e.printStackTrace();
}
}
}
});
}
}

View File

@@ -0,0 +1,392 @@
package com.axis.innovators.box.browser.util;
import com.axis.innovators.box.tools.LibraryLoad;
import org.jnc.DllExtractor;
import org.jnc.windows.JncNative;
import org.python.util.PythonInterpreter;
import javax.tools.JavaCompiler;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
import java.io.*;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
public class CodeExecutor {
// 用于捕获输出的回调接口
public interface OutputListener {
void onOutput(String newOutput);
}
public static String executeCode(String code, String language, OutputListener listener) {
switch (language.toLowerCase()) {
case "python":
return executePythonNative(code, listener);
case "c":
case "cpp":
return executeC(code, listener);
case "java":
return executeJavaCode(code, listener);
default:
return "不支持的语言类型: " + language;
}
}
public static String executeJavaCode(String code, OutputListener listener) {
Path tempDir = null;
try {
// ===== 1. 创建临时目录 =====
tempDir = Files.createTempDirectory("javaCode");
// ===== 2. 写入Java源文件强制UTF-8=====
Path javaFile = tempDir.resolve("Main.java");
Files.writeString(javaFile,
code,
StandardCharsets.UTF_8
);
// ===== 3. 编译时指定编码 =====
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, StandardCharsets.UTF_8);
List<String> options = new ArrayList<>();
options.add("-encoding");
options.add("UTF-8");
options.add("-d");
options.add(tempDir.toString());
JavaCompiler.CompilationTask task = compiler.getTask(
null,
fileManager,
null,
options,
null,
fileManager.getJavaFileObjects(javaFile)
);
if (!task.call()) {
return "编译失败";
}
// ===== 4. 执行配置 =====
String javaExe = Path.of(System.getProperty("java.home"), "bin", "java").toString();
ProcessBuilder pb = new ProcessBuilder(
javaExe,
"-Dfile.encoding=UTF-8",
"-Dsun.stdout.encoding=UTF-8", // 针对OpenJDK的特殊设置
"-Dsun.stderr.encoding=UTF-8",
"-cp",
tempDir.toString(),
"Main"
);
// ===== 5. 设置环境变量 =====
Map<String, String> env = pb.environment();
env.put("JAVA_TOOL_OPTIONS", "-Dfile.encoding=UTF-8");
env.put("LANG", "en_US.UTF-8"); // Linux/macOS
env.put("LC_ALL", "en_US.UTF-8");
// ===== 6. 输出处理 =====
pb.redirectErrorStream(true);
Process process = pb.start();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
StringBuilder output = new StringBuilder();
char[] buffer = new char[4096];
int charsRead;
while ((charsRead = reader.read(buffer)) != -1) {
String chunk = new String(buffer, 0, charsRead);
output.append(chunk);
if (listener != null) {
// 处理控制台编码转换Windows专用
if (System.getProperty("os.name").startsWith("Windows")) {
chunk = new String(chunk.getBytes(StandardCharsets.UTF_8), "GBK");
}
listener.onOutput(chunk);
}
}
int exitCode = process.waitFor();
return output.toString() + "\n退出码: " + exitCode;
}
} catch (Exception e) {
return "执行错误: " + e.getMessage();
} finally {
// 清理代码...
}
}
/**
* 需要用户安装python环境
*/
private static String executePythonNative(String code, OutputListener listener) {
try {
Path pythonFile = Files.createTempFile("script_", ".py");
Files.writeString(pythonFile,
"# -*- coding: utf-8 -*-\n" + code,
StandardCharsets.UTF_8
);
ProcessBuilder pb = new ProcessBuilder("python", pythonFile.toString())
.redirectErrorStream(true);
Map<String, String> env = pb.environment();
env.put("PYTHONIOENCODING", "UTF-8");
env.put("PYTHONUTF8", "1");
Process process = pb.start();
StringBuilder output = new StringBuilder();
Thread outputThread = new Thread(() -> {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
String finalLine = line + "\n";
output.append(finalLine);
if (listener != null) {
listener.onOutput(finalLine);
}
}
} catch (IOException e) {
e.printStackTrace();
}
});
outputThread.start();
// 等待执行完成
int exitCode = process.waitFor();
outputThread.join();
// 清理文件
Files.deleteIfExists(pythonFile);
return String.format("退出码: %d\n输出内容:\n%s", exitCode, output);
} catch (Exception e) {
return "执行错误: " + e.getMessage();
}
}
private static String executeC(String code, OutputListener listener) {
Path tempDir = null;
Path cFile = null;
Path exeFile = null;
try {
// 创建临时工作目录
tempDir = Files.createTempDirectory("c_compile_");
// 生成C源代码文件
cFile = tempDir.resolve("program.c");
Files.writeString(cFile, code, StandardCharsets.UTF_8);
// 生成可执行文件路径
exeFile = tempDir.resolve("program.exe");
// 1. 编译代码 -------------------------------------------------
String tccPath =System.getProperty("user.dir") + "/library/tcc/tcc.exe";
Process compileProcess;
if (listener != null) {
compileProcess = new ProcessBuilder(
tccPath,
"-o", exeFile.toString(),
cFile.toString()
)
.directory(tempDir.toFile())
.redirectErrorStream(true)
.start();
// 捕获编译输出
StringBuilder compileOutput = new StringBuilder();
Thread compileOutputThread = new Thread(() -> {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(compileProcess.getInputStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
compileOutput.append(line).append("\n");
if (listener != null) {
listener.onOutput("[编译输出] " + line + "\n");
}
}
} catch (IOException e) {
e.printStackTrace();
}
});
compileOutputThread.start();
// 等待编译完成
int compileExitCode = compileProcess.waitFor();
compileOutputThread.join(1000);
if (compileExitCode != 0) {
return "编译失败:\n" + compileOutput;
}
// 2. 执行程序 -------------------------------------------------
Process executeProcess = new ProcessBuilder(exeFile.toString())
.directory(tempDir.toFile())
.redirectErrorStream(true)
.start();
// 实时输出处理
AtomicReference<StringBuilder> execOutput = new AtomicReference<>(new StringBuilder());
Thread executeOutputThread = new Thread(() -> {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(executeProcess.getInputStream(), StandardCharsets.UTF_8))) {
char[] buffer = new char[1024];
int charsRead;
while ((charsRead = reader.read(buffer)) != -1) {
String outputChunk = new String(buffer, 0, charsRead);
execOutput.get().append(outputChunk);
if (listener != null) {
listener.onOutput(outputChunk);
}
}
} catch (IOException e) {
e.printStackTrace();
}
});
executeOutputThread.start();
// 等待执行完成最多10秒
boolean finished = executeProcess.waitFor(10, TimeUnit.SECONDS);
executeOutputThread.join(1000);
if (!finished) {
executeProcess.destroyForcibly();
return "执行超时\n部分输出:\n" + execOutput.get();
}
// 获取最终输出
String finalOutput = execOutput.get().toString();
int exitCode = executeProcess.exitValue();
return String.format("执行结果: %s\n退出码: %d\n输出内容:\n%s",
exitCode == 0 ? "成功" : "失败",
exitCode,
finalOutput);
} else {
new ProcessBuilder(
tccPath,
"-o", exeFile.toString(),
cFile.toString()
)
.directory(tempDir.toFile())
.redirectErrorStream(true)
.start();
new ProcessBuilder(
"cmd.exe",
"/c",
"start",
"\"Tzd输出窗口\"",
"cmd.exe",
"/K",
"chcp 65001 & ",
exeFile.toString()
).start();
return String.format("执行结果: %s\n退出码: %d\n输出内容:\n%s",
"成功",
0,
"");
}
} catch (Exception e) {
return "执行错误: " + e.getMessage();
} finally {
// 清理临时文件
try {
if (listener != null){
if (cFile != null) Files.deleteIfExists(cFile);
if (exeFile != null) Files.deleteIfExists(exeFile);
if (tempDir != null) Files.deleteIfExists(tempDir);
}
} catch (IOException e) {
System.err.println("临时文件清理失败: " + e.getMessage());
}
}
}
private static String captureProcessOutput(Process process, OutputListener listener)
throws IOException {
StringBuilder totalOutput = new StringBuilder();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = reader.readLine()) != null) {
totalOutput.append(line).append("\n");
if (listener != null) {
listener.onOutput(line + "\n");
}
}
}
return totalOutput.toString();
}
// 输出监控线程
private static class OutputMonitor implements Runnable {
private final BufferedReader reader;
private final OutputListener listener;
private volatile boolean running = true;
private final StringBuilder totalOutput = new StringBuilder();
public OutputMonitor(BufferedReader reader, OutputListener listener) {
this.reader = reader;
this.listener = listener;
}
public void run() {
try {
while (running) {
if (reader.ready()) {
String line = reader.readLine();
if (line != null) {
totalOutput.append(line).append("\n");
if (listener != null) {
listener.onOutput(line + "\n");
}
}
} else {
Thread.sleep(50);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void stop() {
running = false;
}
public String getTotalOutput() {
return totalOutput.toString();
}
}
// 使用方法
public static void main(String[] args) {
String pythonCode = "#include <stdio.h>\n" +
"\n" +
"int main() {\n" +
" while (1){\n" +
" printf(\"Hello World\\n\");\n" +
"}\n" +
" return 0;\n" +
"}";
executeCode(pythonCode, "c", null);
}
}

View File

@@ -48,6 +48,7 @@ public class RegistrationTool {
}
}));
MainWindow.ToolCategory programmingToolsCategory = new MainWindow.ToolCategory("编程工具",
"programming/programming.png",
"编程工具");
@@ -62,6 +63,26 @@ public class RegistrationTool {
}
}));
programmingToolsCategory.addTool(new MainWindow.ToolItem("C语言编辑器", "programming/LanguageEditor/file-editing.png",
"C语言编译器智能化的idea" +
"\n作者tzdwindows 7", ++id, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
// Window owner = SwingUtilities.windowForComponent((Component) e.getSource());
MainApplication.popupCCodeEditorWindow();
}
}));
programmingToolsCategory.addTool(new MainWindow.ToolItem("多语言在线执行(当遇到无限循环时会抛出错误)", "programming/LanguageEditor/file-editing.png",
"多语言在线执行,当遇到无限循环时会抛出错误" +
"\n作者tzdwindows 7", ++id, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
// Window owner = SwingUtilities.windowForComponent((Component) e.getSource());
MainApplication.popupCodeEditorWindow();
}
}));
MainWindow.ToolCategory aICategory = new MainWindow.ToolCategory("AI工具",
"ai/ai.png",
"人工智能/大语言模型");

View File

@@ -0,0 +1,96 @@
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);
}
}
}
}

View File

@@ -0,0 +1,167 @@
package org.QQdecryption.ui;
import org.QQdecryption.QQMusicAutoDecryptor;
import com.formdev.flatlaf.FlatIntelliJLaf;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDropEvent;
import java.io.File;
import java.util.List;
public class DecryptionUI extends JFrame {
private JProgressBar progressBar;
private JTextArea logArea;
public DecryptionUI() {
initUI();
setupDnD();
}
private void initUI() {
setTitle("QQ音乐文件解锁工具 v2.1");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(800, 600);
setLocationRelativeTo(null);
setupModernLookAndFeel();
JPanel mainPanel = new JPanel(new BorderLayout(10, 10));
mainPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
// 拖放区域
JPanel dropZone = createDropZone();
mainPanel.add(dropZone, BorderLayout.CENTER);
// 控制面板
JPanel controlPanel = createControlPanel();
mainPanel.add(controlPanel, BorderLayout.SOUTH);
// 日志区域
logArea = new JTextArea();
logArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(logArea);
scrollPane.setPreferredSize(new Dimension(0, 150));
mainPanel.add(scrollPane, BorderLayout.SOUTH);
add(mainPanel);
}
private void setupModernLookAndFeel() {
try {
UIManager.setLookAndFeel(new FlatIntelliJLaf());
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
}
private JPanel createDropZone() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createDashedBorder(null, 3, 5));
panel.setBackground(UIManager.getColor("Panel.background").darker());
JLabel dropLabel = new JLabel("拖放QQ音乐文件到此区域", SwingConstants.CENTER);
dropLabel.setFont(new Font("微软雅黑", Font.BOLD, 18));
dropLabel.setForeground(new Color(0x666666));
panel.add(dropLabel);
return panel;
}
private JPanel createControlPanel() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));
// 进度条
progressBar = new JProgressBar();
progressBar.setPreferredSize(new Dimension(200, 20));
progressBar.setStringPainted(true);
panel.add(progressBar);
return panel;
}
private void setupDnD() {
new DropTarget(this, new DropTargetAdapter() {
@Override
public void drop(DropTargetDropEvent dtde) {
try {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
List<File> files = (List<File>) dtde.getTransferable()
.getTransferData(DataFlavor.javaFileListFlavor);
processFiles(files);
} catch (Exception ex) {
logError("文件拖放错误: " + ex.getMessage());
}
}
});
}
private void processFiles(List<File> files) {
SwingWorker<Void, Void> worker = new SwingWorker<>() {
@Override
protected Void doInBackground() {
progressBar.setIndeterminate(true);
for (File file : files) {
decryptFile(file);
}
return null;
}
@Override
protected void done() {
progressBar.setIndeterminate(false);
JOptionPane.showMessageDialog(DecryptionUI.this,
"处理完成!",
"完成",
JOptionPane.INFORMATION_MESSAGE);
}
};
worker.execute();
}
private void decryptFile(File inputFile) {
try {
logMessage("开始处理: " + inputFile.getName());
// 自动获取源文件所在目录
File outputDir = inputFile.getParentFile();
QQMusicAutoDecryptor.decrypt(
inputFile.getAbsolutePath(),
outputDir.getAbsolutePath()
);
logMessage("✓ 成功解密保存到: " + outputDir.getAbsolutePath());
} catch (Exception ex) {
logError("解密失败: " + ex.getMessage());
}
}
private void logMessage(String message) {
SwingUtilities.invokeLater(() -> {
logArea.append("[INFO] " + message + "\n");
logArea.setCaretPosition(logArea.getDocument().getLength());
});
}
private void logError(String error) {
SwingUtilities.invokeLater(() -> {
logArea.append("[ERROR] " + error + "\n");
logArea.setCaretPosition(logArea.getDocument().getLength());
});
}
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
try {
UIManager.setLookAndFeel(new FlatIntelliJLaf());
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
new DecryptionUI().setVisible(true);
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB