Category : code-injection

#include <cstdio> #include <stdlib.h> #include <dos.h> #include <windows.h> #include <chrono> #include <thread> #include <iostream> #include <TlHelp32.h> #include <variant> #include <stdio.h> #include <sys/types.h> using namespace std; int APIENTRY DllMain(HMODULE module, DWORD callReason, LPVOID reserved) { if (callReason == DLL_PROCESS_ATTACH) { std::chrono::milliseconds timespan(5000); std::this_thread::sleep_for(timespan); HANDLE HProc; LPVOID LibAddr, DllAdr; char Dll[9] = "test.dll"; printf("HProcn"); HProc = OpenProcess(PROCESS_ALL_ACCESS, ..

Read more

#include <Windows.h> #include <cstdio> #include <stdlib.h> #include <dos.h> #include <windows.h> #include <chrono> #include <thread> #include <iostream> #include <TlHelp32.h> #include <variant> #include <stdio.h> #include <sys/types.h> using namespace std; int APIENTRY DllMain(HMODULE module, DWORD callReason, LPVOID reserved) { if (callReason == DLL_PROCESS_ATTACH) { std::chrono::milliseconds timespan(5000); std::this_thread::sleep_for(timespan); HANDLE HProc; LPVOID LibAddr, DllAdr; char Dll[9] = "test.dll"; printf("HProcn"); HProc ..

Read more

char Dll[9] = "test.dll"; // Open process HProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, _getpid() ); // Allocating memory DllAdr = (LPVOID)VirtualAllocEx(HProc, NULL, strlen(Dll), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); // Writing process mem WriteProcessMemory(HProc, (LPVOID)DllAdr, Dll, strlen(Dll), NULL); string kernel = "kernel32.dll"; // LoadLib adress (there is error) LoadLibrary = (LPVOID)GetProcAddress(GetModuleHandle(kernel),"LoadLibraryA"); CreateRemoteThread(HProc, NULL, NULL, (LPTHREAD_START_ROUTINE)LoadLibrary, (LPVOID)DllAdr, NULL, NULL); CloseHandle(HProc); ..

Read more