Install pwndbg in a custom manner.

This commit is contained in:
David Tomaschik
2016-12-06 12:07:37 -08:00
parent 68dcadd52b
commit 78df984b55
2 changed files with 35 additions and 5 deletions

View File

@@ -22,5 +22,19 @@ define reg
info registers info registers
end end
source ~/.peda/peda.py # Fancy sourcing of modules
source ~/.gdbinit.local python
import sys
import os.path
pwndbg = os.path.expanduser('~/.pwndbg/gdbinit.py')
peda = os.path.expanduser('~/.peda/peda.py')
if os.path.isfile(pwndbg):
sys.path.insert(0, os.path.expanduser('~/.pwndbg/vendor'))
gdb.execute('source {}'.format(pwndbg))
elif os.path.isfile(peda):
gdb.execute('source {}'.format(peda))
local_init = os.path.expanduser('~/.gdbinit.local')
if os.path.isfile(local_init):
gdb.execute('source {}'.format(local_init))
end

View File

@@ -20,9 +20,6 @@ function prerequisites {
install_git https://github.com/VundleVim/Vundle.vim.git \ install_git https://github.com/VundleVim/Vundle.vim.git \
$HOME/.vim/bundle/Vundle.vim $HOME/.vim/bundle/Vundle.vim
fi fi
if which gdb > /dev/null 2>&1 ; then
install_git https://github.com/longld/peda.git $HOME/.peda
fi
} }
function install_dotfile_dir { function install_dotfile_dir {
@@ -76,7 +73,26 @@ function add_bin_symlink {
ln -sf ${1} ${LINKNAME} ln -sf ${1} ${LINKNAME}
} }
# Custom version of pwndbg's installer
function install_pwndbg {
if \! which gdb > /dev/null 2>&1 ; then
return 1
fi
install_git https://github.com/pwndbg/pwndbg.git $HOME/.pwndbg
mkdir -p $HOME/.pwndbg/vendor
local PYVER=$(gdb -batch -q --nx -ex 'pi import platform; print(".".join(platform.python_version_tuple()[:2]))')
local PYTHON=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)')
PYTHON="${PYTHON}${PYVER}"
local PY_PACKAGES=$HOME/.pwndbg/vendor
${PYTHON} -m pip install --target ${PY_PACKAGES} -Ur $HOME/.pwndbg/requirements.txt
${PYTHON} -m pip install --target ${PY_PACKAGES} -U capstone
# capstone package is broken
cp ${PY_PACKAGES}/usr/lib/*/dist-packages/capstone/libcapstone.so ${PY_PACKAGES}/capstone
}
function postinstall { function postinstall {
install_pwndbg
# Install Vundle plugins # Install Vundle plugins
if [[ -d $HOME/.vim/bundle/Vundle.vim ]] ; then if [[ -d $HOME/.vim/bundle/Vundle.vim ]] ; then
vim +VundleInstall +qall vim +VundleInstall +qall