Add ability to assemble shellcode.

This commit is contained in:
David Tomaschik
2015-09-19 10:54:16 -07:00
parent bbf444460e
commit 2fba9d3bf5
2 changed files with 21 additions and 2 deletions

View File

@@ -44,8 +44,10 @@ bindkey '^[[B' history-search-forward
bindkey '^[[1;5C' forward-word bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word bindkey '^[[1;5D' backward-word
# Source extras # Source extras if interactive
if [[ $- == *i* ]] ; then
for file in $HOME/.zshrc.d/* ; do source "$file" ; done for file in $HOME/.zshrc.d/* ; do source "$file" ; done
fi
# Load any local settings # Load any local settings
if [ -e $HOME/.zshrc.local ] ; then source $HOME/.zshrc.local ; fi if [ -e $HOME/.zshrc.local ] ; then source $HOME/.zshrc.local ; fi

View 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