mirror of
https://github.com/Matir/skel.git
synced 2026-05-25 21:19:09 -07:00
Add ability to assemble shellcode.
This commit is contained in:
17
dotfiles/zshrc.d/assemble.zsh
Normal file
17
dotfiles/zshrc.d/assemble.zsh
Normal file
@@ -0,0 +1,17 @@
|
||||
if [ -f "`command which nasm`" -a -f "`command which objdump`" ] ; then
|
||||
assemble_shellcode() {
|
||||
if [ -z "$1" ] ; then echo "Usage: $0 <assembly file>" >&2 ; return 1 ; fi
|
||||
local NASM=`command which nasm`
|
||||
local OBJDUMP=`command which objdump`
|
||||
local TMPF=`mktemp`
|
||||
local bytes
|
||||
local byte
|
||||
$NASM -f elf -o $TMPF $1
|
||||
$OBJDUMP -M intel -d $TMPF | grep '^ ' | cut -f2 | while read -A bytes ; do
|
||||
for byte in $bytes ; do
|
||||
echo -n "\\\\x$byte"
|
||||
done
|
||||
done
|
||||
echo
|
||||
}
|
||||
fi
|
||||
Reference in New Issue
Block a user