Source Insight 4 是一款非常强大的源代码编辑器和代码分析工具,而对于其授权过程的逆向分析网上已经有许多文章了(本文结尾也贴了几个参考的帖子),本文不再赘述,这里仅分享一个本人编写的更方便的补丁及其实现方式,集成了联网验证补丁和注册机的功能,用于自动通过其授权而无需修改任何文件(众所周知添加不是修改x)。

Snipaste_2025-05-02_09-37-30.png (131.53 KB, 下载次数: 0)
下载附件
2025-5-2 10:01 上传
实现原理
通过在 Source Insight 4 的程序目录中伪造并代理其导入的系统库 msimg32.dll 来注入其进程(使用本人制作的小工具 ProxyPESourceGenerator 生成用于代理 msimg32.dll 的源代码),并使用微软的 Detours 库劫持其哈希校验和联网校验功能后自动生成授权文件以本地激活。
劫持校验
劫持哈希校验功能部分
BOOL Patch::CryptVerifySignatureW(HCRYPTHASH hHash, const BYTE* pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR szDescription, DWORD dwFlags) {
// 跳过签名验证
return TRUE;
}
劫持联网校验功能部分
HINTERNET Patch::InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags) {
// 阻止检查授权,防止序列号被加入在线黑名单
// 检查授权的 UA 是 Source Insight,检查更新的 UA 是 SourceInsight/4.0
if (std::wcscmp(lpszAgent, L"Source Insight") == 0) {
SetLastError(ERROR_ACCESS_DENIED);
return NULL;
}
return internetOpenW(lpszAgent, dwAccessType, lpszProxy, lpszProxyBypass, dwFlags);
}
授权文件生成
生成序列号部分
wchar_t LicenseSerial::GenerateRandomLetterOrDigit() {
std::uniform_int_distribution distribution(0, 35);
uint16_t randomValue = distribution(randomEngine);
if (randomValue
生成授权文件部分
void License::EnsureAvailability() {
// 获取 %ProgramData%\Source Insight\4.0\si4.lic 文件路径,如果父目录不存在则创建
std::array commonAppDataPath;
if (SHGetFolderPathW(nullptr, CSIDL_COMMON_APPDATA, nullptr, 0, commonAppDataPath.data()) != S_OK) {
throw std::runtime_error("Failed to get CSIDL_COMMON_APPDATA path, error code: " + std::to_string(GetLastError()));
}
std::filesystem::path licenseFilePath = std::filesystem::path(commonAppDataPath.data()) / L"Source Insight" / L"4.0" / L"si4.lic";
std::filesystem::create_directories(licenseFilePath.parent_path());
// 如果 License 文件不存在或不包含 SourceInsight4Patch 字符串,则生成一个新的
std::wfstream licenseFile;
licenseFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
if (std::filesystem::exists(licenseFilePath)) {
licenseFile.open(licenseFilePath, std::ios::in);
std::span magic(L"SourceInsight4Patch", 19);
std::istreambuf_iterator end;
if (std::search(std::istreambuf_iterator(licenseFile), end, magic.begin(), magic.end()) != end) {
licenseFile.close();
return;
}
licenseFile.close();
}
licenseFile.open(licenseFilePath, std::ios::out | std::ios::trunc);
LicenseSerial licenseSerial;
std::chrono::time_point now = std::chrono::system_clock::now();
licenseFile \n" \
L" \n" \
L" \n" \
L"", licenseSerial.Generate(), now);
licenseFile.close();
}
使用方式
[ol]
[/ol]
使用说明
[ol]
[/ol]
相关链接
参考帖子
免责声明
本补丁仅供技术交流使用。我们感谢软件作者的辛勤努力,强烈鼓励用户支持正版,以便软件得以持续改进和更新。未经软件作者许可,不得将本补丁用于商业用途或侵犯版权行为。使用本补丁所产生的一切后果由用户自行承担,与补丁提供者无关。