pydis
Pydis is a python binding for the Zydis disassembler library.
import pydis
instructions = b'\x51\x8d\x45\xff\x50\xff\x75\x0c\xff\x75\x08\xff\x15\xa0\xa5\x48\x76\x85\xc0\x0f\x88\xfc\xda\x02\x00'
instruction_pointer = 0x007FFFFFFF400000
for instruction in pydis.decode(instructions, instruction_pointer):
print(instruction)
Output:
push rcx
lea eax, [rbp-0x01]
push rax
push [rbp+0x0C]
push [rbp+0x08]
call [0x008000007588A5B1]
test eax, eax
js 0x007FFFFFFF42DB15
The module uses the same field names as Zydis with the exception that snake_case is used instead of camelCase.
Requirements
Pydis requires a python version >=3.6. The package has been tested on macOS, linux, and windows running cpython. Since
pydis uses ctypes to interface with zydis it may or may not work on other interpreters.
Installing
pip install py-dis
or you can build from source as described below.
Building
MacOS and linux machines will need cmake and a C compiler in order to build Zydis. Windows machines will need Visual Studios. Pydis does not use any python modules beyond ones provided by a default python installation.
With the tooling installed running: python setup.py build install will build Zydis and install the package.
Usage
Documentation is currently being worked on. For now the example script pydisinfo is the best place to look for example usage.
Metadata
Release files for py-dis 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| py_dis-0.3-cp36-none-win_amd64.whl | CPython 3.6 | none | Windows x86-64 | Details |
| py_dis-0.3-cp36-none-win32.whl | CPython 3.6 | none | Windows x86-32 | Details |
| py_dis-0.3-cp36-none-manylinux1_x86_64.whl | CPython 3.6 | none | Linux glibc 2.5+ x86-64 | Details |
| py_dis-0.3-cp36-none-manylinux1_i686.whl | CPython 3.6 | none | Linux glibc 2.5+ x86-32 | Details |
| py_dis-0.3-cp36-none-macosx_10_12_x86_64.whl | CPython 3.6 | none | macOS 10.12+ x86-64 | Details |
Total release size: 750.6 kB
Release files / py_dis-0.3-cp36-none-win_amd64.whl
| Download URL | py_dis-0.3-cp36-none-win_amd64.whl |
|---|---|
| Size | 139.7 kB |
| Tags | CPython 3.6 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1949a4284976156691f0f6a6b76a740e695ee12d979b00864573c1bac654586c
|
|
BLAKE2b-256 checksum How to use checksums |
083bb79759368244a3364c429b58427210da9676794f2f49cd0a04c859ade3fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|
Release files / py_dis-0.3-cp36-none-win32.whl
| Download URL | py_dis-0.3-cp36-none-win32.whl |
|---|---|
| Size | 139.8 kB |
| Tags | CPython 3.6 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
5fdd326f45288a52a16397dbb13dcd1e21fa1621bf685f602e547ffb7bd7823e
|
|
BLAKE2b-256 checksum How to use checksums |
9f632725af721c8b20a2d3696a186b19500c509d78959e4c39eea64a66e6131c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|
Release files / py_dis-0.3-cp36-none-manylinux1_x86_64.whl
| Download URL | py_dis-0.3-cp36-none-manylinux1_x86_64.whl |
|---|---|
| Size | 160.7 kB |
| Tags | CPython 3.6 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
e41677ed1ee13c8c220a4e66c40fd0c464858fc7c9364f321708a7abfd911ff5
|
|
BLAKE2b-256 checksum How to use checksums |
50034112e1acbb84b847f8023d07c5449229535290c770c5bada41ed6292be39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|
Release files / py_dis-0.3-cp36-none-manylinux1_i686.whl
| Download URL | py_dis-0.3-cp36-none-manylinux1_i686.whl |
|---|---|
| Size | 160.9 kB |
| Tags | CPython 3.6 Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
a50b03f4187a7b3640c8b856ca2beb056b1a8d09b9a6e576cae922e2c40f0f53
|
|
BLAKE2b-256 checksum How to use checksums |
ea10fb5461df42d6210265bfedc6b7efe1c82b98e5b6104bf4df2ac593b1fb8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|
Release files / py_dis-0.3-cp36-none-macosx_10_12_x86_64.whl
| Download URL | py_dis-0.3-cp36-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 149.6 kB |
| Tags | CPython 3.6 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b931810c77aff5b049b0d31c183b0b6b6f33be5f1689bbf1a9a139afdeb18210
|
|
BLAKE2b-256 checksum How to use checksums |
223a400a3ac5b002aadec195b4c89cfad8f8e2ef63b6d928704676ee9b9ed629
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|