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

Usage:

Code up the assembly that you want to convert, then run the following command:

./asm2shell.sh filename.asm

Code:

#!/bin/bash
echo '[-] 32-Bit Assembly to Shellcode converter '
echo ''
echo ''
echo '[+] Assembling with Nasm ... '
nasm -f elf32 -o $1.o $1
echo '[+] Linking ...'
ld -m elf_i386 -o $1.bin $1.o
echo ''
echo '[+] Generating shellcode ...'
for i in $(objdump -d ./$1.bin |grep "^ " |cut -f2); do echo -n '\x'$i >> sc.txt; done; echo
cat sc.txt
echo''
echo '[+] Done.'

Check out the script here on Github.

Simple x86 Assembly to shellcode script

by | Aug 26, 2018 | Exploit Development | 0 comments

Your Title Goes Here

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Your Title Goes Here

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Lorem ipsum dolor sit amet

Are You Looking Dive Into Crypto?

Blog

Citrix Releases Security Updates on July 8, 2020 at 1:32 pm

Original release date: July 8, 2020Citrix has released security updates to address vulnerabilities in Citrix ADC (formerly known as NetScaler ADC), Citrix Gateway (formerly known as NetScaler Gateway), and Citrix SD-WAN WANOP appliance. A remote attacker could exploit...

Skip to toolbar