Last active
April 5, 2024 22:52
-
-
Save antifob/7de68ac12cc61f57be6edba855300047 to your computer and use it in GitHub Desktop.
An unoptimized, "it works", Triton install script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install https://triton-library.github.io/ | |
# | |
# Tested with Triton commit: 924bcbb28578cff6b3e2f396098b478d0428fd21 on Debian bookworm | |
# | |
set -eu | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update | |
apt-get -y --no-install-recommends install \ | |
\ | |
git \ | |
ca-certificates \ | |
publicsuffix \ | |
\ | |
python3 \ | |
meson \ | |
gcc \ | |
libc6-dev \ | |
g++ \ | |
pkgconf \ | |
libgmp-dev \ | |
\ | |
cmake \ | |
make \ | |
llvm-dev \ | |
libcapstone-dev \ | |
libz3-dev \ | |
python3-dev \ | |
# -------------------------------------------------------------------- # | |
# bitwuzla | |
git clone https://github.com/bitwuzla/bitwuzla ~/bitwuzla/ | |
cd ~/bitwuzla/ | |
# ensure 0.2.x is used | |
git checkout -b 0.2.0 0.2.0 | |
# python bindings are broken | |
./configure.py --wipe --kissat --shared | |
cd ./build/ | |
meson compile | |
meson install | |
# -------------------------------------------------------------------- # | |
# triton | |
git clone https://github.com/JonathanSalwan/Triton ~/triton/ | |
mkdir ~/triton/build/ | |
cd ~/triton/build/ | |
cmake \ | |
-DLLVM_INTERFACE=ON \ | |
-DCMAKE_PREFIX_PATH=$(llvm-config --prefix) \ | |
-DBITWUZLA_INTERFACE=ON \ | |
-DBITWUZLA_INCLUDE_DIRS=/usr/local/include/lib64 \ | |
-DBITWUZLA_LIBRARIES=/usr/local/lib64/libbitwuzla.so \ | |
.. | |
make -j3 | |
make install | |
cd ~/triton/ | |
python3 setup.py install | |
# -------------------------------------------------------------------- # | |
# test | |
python3 -c' | |
from triton import * | |
ctx = TritonContext(ARCH.X86_64) | |
ctx.setConcreteRegisterValue(ctx.registers.rip, 0x40000) | |
ctx.symbolizeRegister(ctx.registers.rax, "my_rax") | |
ctx.processing(Instruction(b"\x48\x35\x34\x12\x00\x00")) # xor rax, 0x1234 | |
ctx.processing(Instruction(b"\x48\x89\xc1")) # mov rcx, rax | |
rcx_expr = ctx.getSymbolicRegister(ctx.registers.rcx) | |
print(rcx_expr) | |
ctx.getModel(rcx_expr.getAst() == 0xdead) | |
print("done") | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment