Keystone Engine shellcode template
This python script uses keystone-engine to create asm instruction. Keystone is a lightweight multi-platform, multi-architecture assembler framework for more information visit site.
After create the desired instruction this script will Allocate space in memory, Move the encoded ASM instruction to the new allocated space and CreateThread from this location, so basically is a shellcode runner
The shellcode runner uses it classic invocation
LPVOID VirtualAlloc(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD flAllocationType,
DWORD flProtect
);
VOID RtlMoveMemory(
_Out_ VOID UNALIGNED *Destination,
_In_ const VOID UNALIGNED *Source,
_In_ SIZE_T Length
);
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
__drv_aliasesMem LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWORD lpThreadId
);
WaitForSingleObject function info
DWORD WaitForSingleObject(
HANDLE hHandle,
DWORD dwMilliseconds
);
Keystone-engine The framework make things more easily.
github-epi052 Good job automating functions.
Offsec Amazing shellcode development course.