This project demonstrates the execution of shellcode using a simple C++ program. The main functionality is implemented in main.cpp.
The program includes:
- A
codearray containing shellcode in hexadecimal format. - A function pointer that points to the shellcode.
- Execution of the shellcode through the function pointer.
This project is for educational purposes only. Executing arbitrary shellcode can be dangerous and may compromise system security. Ensure you fully understand the code and its implications before running it on your machine.
main.cpp: Contains the main code for executing the shellcode.
- The shellcode is stored in the
codearray as hexadecimal values. - A function pointer
funcis assigned to the shellcode. - The shellcode is executed by calling the function pointer.
char code[] = "\x31\xc9\x51\x68\x2e\x65\x78\x65\x68\x63\x61"
"\x6c\x63\x89\xe0\x41\x51\x50\xbb\xfd\xe5\xf0"
"\x76\xff\xd3\x31\xc0\x50\xb8\x4f\x21\xed\x76"
"\xff\xe0";- A C++ compiler (e.g.,
gccorg++). - A supported operating system.
To compile the program, use the following command:
g++ main.cpp -o shellcode_execExecute the compiled binary:
./shellcode_execIf the shellcode executes successfully, the program returns 0. Otherwise, it returns 1.
This program is provided "as is" without any warranty. The author is not responsible for any misuse or damage caused by the execution of this code. Use responsibly and at your own risk.