2016-05-12 10:36:26 +08:00
|
|
|
#!/bin/bash -ex
|
2016-05-13 03:35:35 +08:00
|
|
|
|
|
|
|
if uname | grep -i Linux &>/dev/null; then
|
2016-05-25 13:32:59 +08:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y install python-dev python3-dev python-pip python3-pip libglib2.0-dev
|
2016-05-13 03:35:35 +08:00
|
|
|
fi
|
2016-05-12 10:36:26 +08:00
|
|
|
|
|
|
|
# Update all submodules
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
2016-05-12 10:42:13 +08:00
|
|
|
# Find the path to the Python interpreter used by GDB.
|
2016-05-12 10:36:26 +08:00
|
|
|
PYTHON=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)')
|
|
|
|
|
2016-05-13 03:35:35 +08:00
|
|
|
# Install Python dependencies
|
|
|
|
sudo $PYTHON -m pip install -Ur requirements.txt
|
|
|
|
|
2016-05-12 10:42:13 +08:00
|
|
|
# Find the path to the Python2 interpreter needed by the Unicorn install process.
|
|
|
|
export UNICORN_QEMU_FLAGS="--python=$(which python2)"
|
|
|
|
|
|
|
|
# Install both Unicorn and Capstone
|
2016-05-12 10:36:26 +08:00
|
|
|
for directory in capstone unicorn; do
|
|
|
|
pushd $directory
|
2016-05-12 10:42:13 +08:00
|
|
|
git clean -xdf
|
2016-05-12 10:36:26 +08:00
|
|
|
sudo ./make.sh install
|
|
|
|
cd bindings/python
|
|
|
|
sudo ${PYTHON} setup.py install
|
|
|
|
popd
|
|
|
|
done
|
|
|
|
|
2016-05-12 10:42:13 +08:00
|
|
|
# Load Pwndbg into GDB on every launch.
|
2016-05-12 10:36:26 +08:00
|
|
|
if ! grep pwndbg ~/.gdbinit &>/dev/null; then
|
|
|
|
echo "source $PWD/pwndbg/gdbinit.py" >> ~/.gdbinit
|
|
|
|
fi
|