Converting a Binary to shellcode
Now we will talk about converting a binary to shellcode
by using this program binary2shellcode (FOR LINUX AND UNIX)
1- Compile & Run :
To build binary2shellcode
The program will be installed in /usr/bin/ and the app name bin2shell.
To test just run it (/usr/bin/bin2shell) and it should be like this
2- Use Binary2Shellcode :
We have here assembly code to flush iptables (iptables -F) with 43 bytes size
Let's compile and link and then try to run it
It's works fine
Now we have to convert the assembly code into shellcode so we can inject it as a payload by using Binary2Shellcode application
The shellcode is
Now let's try it in C code
It's works fine too
Hint 1: Binary2Shell program is works only under Unix and Linux.
Hint 2: Binary2Shell is opensource written in C under GNU General Public License.
Hint 3: Binary2Shell calculate the size of shellcode.
Hint 4: Binary2Shell Link https://github.com/Hamza-Megahed/binary2shellcode