Skip to content

Instantly share code, notes, and snippets.

@Grazfather
Last active October 4, 2018 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grazfather/91e1ea3c3b51be844552263ce0f0d538 to your computer and use it in GitHub Desktop.
Save Grazfather/91e1ea3c3b51be844552263ce0f0d538 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Install/update Capstone/Keystone/Unicorn from GitHub with Python/Python3 bindings
# First time, run:
# $ sudo apt-get install git cmake gcc g++ pkg-config libglib2.0-dev
#
LOGFILE=/tmp/update-trinity.log
NB_CPU="$(grep -c processor /proc/cpuinfo)"
set -e
pushd .
echo "[+] Installing keystone + bindings" >&2
pushd /tmp
git clone --quiet https://github.com/keystone-engine/keystone.git
mkdir -p keystone/build && cd keystone/build
sed -i "s/make -j8/make -j${NB_CPU}/g" ../make-share.sh
../make-share.sh
sudo make install
cd ../bindings/python
sudo make install install3
popd
echo "[+] Done" >&2
echo "[+] Installing capstone + bindings" >&2
pushd /tmp
git clone --quiet https://github.com/aquynh/capstone.git
cd capstone
./make.sh default -j${NB_CPU}
sudo ./make.sh install
cd ./bindings/python
sudo make install install3
popd
echo "[+] Done" >&2
echo "[+] Installing unicorn + bindings" >&2
pushd /tmp
git clone --quiet https://github.com/unicorn-engine/unicorn.git
cd unicorn
UNICORN_QEMU_FLAGS="--python=`which python2`" MAKE_JOBS=${NB_CPU} ./make.sh
sudo ./make.sh install
cd ./bindings/python
sudo make install install3
popd
echo "[+] Done" >&2
echo "[+] Cleanup" >&2
sudo rm -fr -- /tmp/{keystone,capstone,unicorn}
sudo ldconfig
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment