.. | ||
prebuilt | ||
unicorn | ||
.gdb_history | ||
build_wheel.sh | ||
Makefile | ||
MANIFEST.in | ||
musl_wheel.sh | ||
README.md | ||
sample_all.sh | ||
sample_arm64.py | ||
sample_arm64eb.py | ||
sample_arm.py | ||
sample_armeb.py | ||
sample_ctl.py | ||
sample_m68k.py | ||
sample_mips.py | ||
sample_network_auditing.py | ||
sample_ppc.py | ||
sample_riscv.py | ||
sample_s390x.py | ||
sample_sparc.py | ||
sample_tricore.py | ||
sample_x86.py | ||
setup.cfg | ||
setup.py | ||
shellcode.py |
Python Bindings for Unicorn
Originally written by Nguyen Anh Quynh, polished and redesigned by elicn, maintained by all community contributors.
Install
Install a prebuilt wheel from PyPI:
pip3 install unicorn
In case you would like to develop the bindings:
# Python3
DEBUG=1 THREADS=4 pip3 install --user -e .
# Workaround for Pylance
DEBUG=1 THREADS=4 pip3 install --user -e . --config-settings editable_mode=strict
# Python2
DEBUG=1 THREADS=4 pip install -e .
or install it by building it by yourself:
# Python3
THREADS=4 pip3 install --user .
# Python2, unfortunately `pip2` doesn't support in-tree build
THREADS=4 python3 setup.py install
Explanations for arguments:
THREADS=4
will use 4 threads for building.DEBUG=1
will build debug version of unicorn.--user
will install the bindings to your user directory instead of requiring root permission.-e
infers the editable mode, which gives your instant feedback instead of re-compiling every time.
Note that you should setup a valid building environment according to docs/COMPILE.md but not necessarily build it because setup.py
will do this for you.
Python2 compatibility
By default, Unicorn python bindings will be maintained against Python3 as it offers more powerful features which improves developing efficiency. Meanwhile, Unicorn will only keep compatible with all features Unicorn1 offers regarding Python2 because Python2 has reached end-of-life for more than 3 years as the time of writing this README. While offering all features for both Python2 & Python3 is desirable and doable, it inevitably costs too much efforts to maintain and few users really rely on this. Therefore, we assume that if users still stick to Python2, previous Unicorn1 features we offer should be enough. If you really want some new features Unicorn2 offers, please check and pull request to `unicorn/unicorn_py2``. We are happy to review and accept!