forked from pwndbg/pwndbg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·39 lines (31 loc) · 1.27 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -ex
if uname | grep -i Linux &>/dev/null; then
sudo apt-get update
sudo apt-get -y install python-dev python3-dev python-pip python3-pip libglib2.0-dev
fi
# Update all submodules
git submodule update --init --recursive
# Find the Python version used by GDB.
PYVER=$(gdb -batch -q --nx -ex 'pi import platform; print(".".join(platform.python_version_tuple()[:2]))')
PYTHON=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)')
PYTHON="${PYTHON}${PYVER}"
# Find the Python site-packages that we need to use so that
# GDB can find the files once we've installed them.
SITE_PACKAGES=$(gdb -batch -q --nx -ex 'pi import site; print(site.getsitepackages()[0])')
# Install Python dependencies
sudo ${PYTHON} -m pip install --target ${SITE_PACKAGES} -Ur requirements.txt
# 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
for directory in capstone unicorn; do
pushd $directory
sudo ./make.sh install
cd bindings/python
sudo ${PYTHON} -m pip install --target ${SITE_PACKAGES} .
popd
done
# Load Pwndbg into GDB on every launch.
if ! grep pwndbg ~/.gdbinit &>/dev/null; then
echo "source $PWD/gdbinit.py" >> ~/.gdbinit
fi