| 1 |
0. This documentation explains how to install the Python bindings for Capstone |
| 2 |
from source. If you want to install it from a PyPi package (recommended if |
| 3 |
you are on Windows), see README.txt. |
| 4 |
|
| 5 |
1. To install Capstone and the Python bindings on *nix, run the command below: |
| 6 |
|
| 7 |
$ sudo make install |
| 8 |
|
| 9 |
To install Capstone for Python 3, run the command below: |
| 10 |
(Note: this requires python3 installed in your machine) |
| 11 |
|
| 12 |
$ sudo make install3 |
| 13 |
|
| 14 |
To control the install destination, set the DESTDIR environment variable. |
| 15 |
|
| 16 |
2. The tests directory contains some test code to show how to use the Capstone API. |
| 17 |
|
| 18 |
- test_basic.py |
| 19 |
This code shows the most simple form of API where we only want to get basic |
| 20 |
information out of disassembled instruction, such as address, mnemonic and |
| 21 |
operand string. |
| 22 |
|
| 23 |
- test_lite.py |
| 24 |
Similarly to test_basic.py, but this code shows how to use disasm_lite(), a lighter |
| 25 |
method to disassemble binary. Unlike disasm() API (used by test_basic.py), which returns |
| 26 |
CsInsn objects, this API just returns tuples of (address, size, mnemonic, op_str). |
| 27 |
|
| 28 |
The main reason for using this API is better performance: disasm_lite() is at least |
| 29 |
20% faster than disasm(). Memory usage is also less. So if you just need basic |
| 30 |
information out of disassembler, use disasm_lite() instead of disasm(). |
| 31 |
|
| 32 |
- test_detail.py: |
| 33 |
This code shows how to access to architecture-neutral information in disassembled |
| 34 |
instructions, such as implicit registers read/written, or groups of instructions |
| 35 |
that this instruction belong to. |
| 36 |
|
| 37 |
- test_<arch>.py |
| 38 |
These code show how to access architecture-specific information for each |
| 39 |
architecture. |