Instead of running running the commands to dump shellcode from assembly code that I write, I made a very simple script to help speed it up a bit. This isn’t anything fancy, but it works for me.
Essentially what it does:
-Compile assembly with nasm
-Linking with ld
-Spits out pretty shellcode with objdump
Code up the assembly that you want to convert, then run the following command:
echo '[-] 32-Bit Assembly to Shellcode converter '
echo '[+] Assembling with Nasm ... '
nasm -f elf32 -o $1.o $1
echo '[+] Linking ...'
ld -m elf_i386 -o $1.bin $1.o
echo '[+] Generating shellcode ...'
for i in $(objdump -d ./$1.bin |grep "^ " |cut -f2); do echo -n '\x'$i >> sc.txt; done; echo
echo '[+] Done.'
Check out the script here on Github.