Here is my ‘’. This is a short bash script that will convert binary to shellcode on the Linux console using objdump:

code=$(objdump -d $1|grep '[0-9a-f]:'|grep -v 'file'|cut -f2 -d:|tr -s ' '|tr '\t' '!'|cut -d \! -f 2|sed s/^/\ /g|sed 's/ $//g'|sed 's/ /\\x/g'|paste -d '' -s |sed 's/^/"/'|sed 's/$/"/g')
len=$(echo $code|grep -o \\\\|wc -l)
echo $code
echo "len: " $len

This was originally taken from the SecurityTube SLAE video series however it was improved to face a shortcoming where it didn’t work in all cases if a certain set of instructions was too long. This new version should work in all cases

Here’s a far better version from commandlinefu:

for i in $(objdump -d binary -M intel |grep "^ " |cut -f2); do echo -n '\x'$i; done;echo