mirror of
https://github.com/capstone-engine/capstone
synced 2026-08-11 16:26:07 -04:00
* Remove deprecated packaging and cython * Fix some issues after cherry-picking * Fix CI issues * Remove test files added for v6 * Also remove test_alpha.py
39 lines
1.6 KiB
Text
39 lines
1.6 KiB
Text
0. This documentation explains how to install the Python bindings for Capstone
|
|
from source. If you want to install it from a PyPi package (recommended if
|
|
you are on Windows), see README.txt.
|
|
|
|
1. To install Capstone and the Python bindings on *nix, run the command below:
|
|
|
|
$ sudo make install
|
|
|
|
To install Capstone for Python 3, run the command below:
|
|
(Note: this requires python3 installed in your machine)
|
|
|
|
$ sudo make install3
|
|
|
|
To control the install destination, set the DESTDIR environment variable.
|
|
|
|
2. The tests directory contains some test code to show how to use the Capstone API.
|
|
|
|
- test_basic.py
|
|
This code shows the most simple form of API where we only want to get basic
|
|
information out of disassembled instruction, such as address, mnemonic and
|
|
operand string.
|
|
|
|
- test_lite.py
|
|
Similarly to test_basic.py, but this code shows how to use disasm_lite(), a lighter
|
|
method to disassemble binary. Unlike disasm() API (used by test_basic.py), which returns
|
|
CsInsn objects, this API just returns tuples of (address, size, mnemonic, op_str).
|
|
|
|
The main reason for using this API is better performance: disasm_lite() is at least
|
|
20% faster than disasm(). Memory usage is also less. So if you just need basic
|
|
information out of disassembler, use disasm_lite() instead of disasm().
|
|
|
|
- test_detail.py:
|
|
This code shows how to access to architecture-neutral information in disassembled
|
|
instructions, such as implicit registers read/written, or groups of instructions
|
|
that this instruction belong to.
|
|
|
|
- test_<arch>.py
|
|
These code show how to access architecture-specific information for each
|
|
architecture.
|