2020-07-21 08:19:18 +00:00
|
|
|
# The Bitdefender disassembler Python wrapper
|
|
|
|
|
|
|
|
## Build
|
|
|
|
|
|
|
|
Building and installing is easy:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
python3 setup.py build
|
|
|
|
python3 setup.py install
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2023-06-22 11:54:41 +00:00
|
|
|
Use it by importing the pybddisasm module:
|
2020-07-21 08:19:18 +00:00
|
|
|
|
|
|
|
```python
|
2023-06-22 11:54:41 +00:00
|
|
|
import pybddisasm
|
2020-07-21 08:19:18 +00:00
|
|
|
|
2023-06-22 11:54:41 +00:00
|
|
|
ret, instr = pybddisasm.nd_decode_ex(code, def_code, def_data, def_stack)
|
2020-07-21 08:19:18 +00:00
|
|
|
```
|
|
|
|
|
2020-11-17 15:24:57 +00:00
|
|
|
## Example
|
|
|
|
|
|
|
|
```python
|
2023-06-22 11:54:41 +00:00
|
|
|
import pybddisasm
|
2020-11-17 15:24:57 +00:00
|
|
|
|
2023-06-22 11:54:41 +00:00
|
|
|
code = b"\x55\x48\x8b\x05\xb8\x13\x00\x00"
|
2020-11-17 15:24:57 +00:00
|
|
|
offset = 0
|
|
|
|
|
2023-06-22 11:54:41 +00:00
|
|
|
while offset < len(code):
|
|
|
|
_, instr = pybddisasm.nd_decode_ex(code[offset:], len(code[offset:]), pybddisasm.ND_CODE_64, pybddisasm.ND_DATA_64)
|
2020-11-17 15:24:57 +00:00
|
|
|
|
|
|
|
if instr is None:
|
|
|
|
break
|
|
|
|
|
2023-06-22 11:54:41 +00:00
|
|
|
_, text = pybddisasm.nd_to_text(instr, 0x0)
|
|
|
|
print(text)
|
2020-11-17 15:24:57 +00:00
|
|
|
|
|
|
|
offset += instr.Length
|
|
|
|
```
|
|
|
|
|
2020-08-04 10:57:03 +00:00
|
|
|
## Pip
|
|
|
|
|
|
|
|
Use pip to install the package:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
pip install pybddisasm
|
|
|
|
```
|