Pesquisar na Comunidade
Mostrando resultados para as tags ''injeção dll''.
Encontrado 1 registro
-
[source Code] Injeção C# /DLL (CreateRemoteThread) Uma forma bastante básica de injeção dll escrita em C #. Nada espetacular, mas, pelo menos, faz o trabalho! Basta encerrá-lo em uma classe e criar uma instância. Embora, tenha em mente, WinNT apenas. private const int ACLOC = 0x1F0FFF; private static Process[] getProcesses(string name) { name = name.Replace(".exe", ""); Process[] ret = Process.GetProcessesByName(name); if (ret.Length == 0) return null; return ret; } private string _error; public string Error() { return _error; } public bool dllInject(string dllName, string processName) { Process[] proc = getProcesses(processName); if (proc == null) { _error = "Target process not found"; return false; } IntPtr ptrProc = Inject.OpenProcess(Inject.ACLOC, false, proc[0].Id); if (ptrProc == IntPtr.Zero) { _error = "Target process pointer is invalid"; return false; } int retLib = Inject.GetProcAddress(Inject.GetModuleHandleA("Kernel32.dll"), "LoadLibraryA"); if (retLib == 0) { _error = "Loadlibrary unreachable"; return false; } int objBuffer = dllName.Length + 1; int objPtr = Inject.VirtualAllocEx(ptrProc, 0, objBuffer, 4096, 4); if (objPtr == 0) { _error = "Virtual alloc failure"; return false; } int ret = Inject.WriteProcessMemory(ptrProc, objPtr, dllName, objBuffer, 0); if (ret == 0) { _error = "Write process mem failure"; return false; } Inject.CreateRemoteThread(ptrProc, 0, 0, retLib, objPtr, 0, 0); Inject.CloseHandle(ptrProc); return true; }
-
- 9
-
-
- csharp
- injeção dll
-
(e 1 mais)
Tags:
