Skip to content

Instantly share code, notes, and snippets.

fun injectShellcode(vararg shellcode: Int) {
val length = shellcode.size
val hProcess = (lms!! as WindowsProcess).handle
val internalBlock = Kernel32.VirtualAllocEx(hProcess, 0, shellcode.size,
WinNT.MEM_COMMIT, WinNT.PAGE_EXECUTE_READWRITE)
val buffer = Memory(shellcode.size.toLong())
for (i in 0..shellcode.lastIndex) buffer.setByte(i.toLong(), shellcode[i].toByte())