Examples of writing shellcode in x86
Now that we have covered the Windows PE implementation for static memory distribution and dynamic memory arrangement, and how to successfully call the system function pointer, we will begin this section with a further discussion on using what we have learned to develop 32-bit shellcode with x86 commands on our own.
The following example is the 32b_shellcode.asm
source code in the Chapter#4
folder of the GitHub project. In order to save space, this book only extracts the highlighted code; please refer to the full project for the complete source code.
As this is a demonstration of 32-bit shellcode development, we need to use a compiler to help us translate the x86 script into machine code that the chip can read. It is recommended that readers practice this section by downloading the open source x86 assembler Moska (github.com/aaaddress1/moska) written by the author of this book, which can compile any x86 script based on the Keystone engine and...