Python bindings to Ghidra's SLEIGH library
Project description
pypcode
Machine code disassembly and IR translation library for Python using the excellent SLEIGH library from the Ghidra framework (version 10.2.2).
This library was created primarily for use with angr, which provides analyses and symbolic execution of p-code.
Quick Start
This package can be installed on Linux, macOS, and Windows platforms for recent
(3.8+) versions of both CPython and PyPy. Wheels are provided for several
configurations. You can install the latest release from PyPI using pip:
pip install pypcode
You can also install the very latest development version from this repository
using pip:
pip install --user https://github.com/angr/pypcode/archive/refs/heads/master.zip
You can now invoke the pypcode module from command line to translate supported
machine code to P-code from command line. Run python -m pypcode --help for
usage information. See module source (__main__.py) for examples of using
pypcode as a library.
Example
$ python -m pypcode -b x86:LE:64:default test-x64.bin
--------------------------------------------------------------------------------
00000000/2: XOR EAX,EAX
--------------------------------------------------------------------------------
0: CF = 0x0
1: OF = 0x0
2: EAX = EAX ^ EAX
3: RAX = zext(EAX)
4: SF = EAX s< 0x0
5: ZF = EAX == 0x0
6: unique[0x2580:4] = EAX & 0xff
7: unique[0x2590:1] = popcount(unique[0x2580:4])
8: unique[0x25a0:1] = unique[0x2590:1] & 0x1
9: PF = unique[0x25a0:1] == 0x0
--------------------------------------------------------------------------------
00000002/2: CMP ESI,EAX
--------------------------------------------------------------------------------
0: CF = ESI < EAX
1: OF = sborrow(ESI, EAX)
2: unique[0x5180:4] = ESI - EAX
3: SF = unique[0x5180:4] s< 0x0
4: ZF = unique[0x5180:4] == 0x0
5: unique[0x2580:4] = unique[0x5180:4] & 0xff
6: unique[0x2590:1] = popcount(unique[0x2580:4])
7: unique[0x25a0:1] = unique[0x2590:1] & 0x1
8: PF = unique[0x25a0:1] == 0x0
--------------------------------------------------------------------------------
00000004/2: JBE 0x17
--------------------------------------------------------------------------------
0: unique[0x18f0:1] = CF || ZF
1: if (unique[0x18f0:1]) goto ram[0x17:8]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypcode-1.1.0.tar.gz.
File metadata
- Download URL: pypcode-1.1.0.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea0fb04ab0f2d510e9421e5be72ccfaca3ebdb170ed574946c109160620f8e16
|
|
| MD5 |
6a2cac413629bb9e0869eb46822d726e
|
|
| BLAKE2b-256 |
cdb0cd07e19ef663dd33de26653ab22de2a4291df8a77f651c98364d0b31c8b5
|
File details
Details for the file pypcode-1.1.0-pp39-pypy39_pp73-win_amd64.whl.
File metadata
- Download URL: pypcode-1.1.0-pp39-pypy39_pp73-win_amd64.whl
- Upload date:
- Size: 17.7 MB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ad67124363a2b5f41065462ce681a8dd5b9c19353681b8ab7f18b1d9b34b8a1
|
|
| MD5 |
5cda87f3c32dd10d8a74817444afc9bd
|
|
| BLAKE2b-256 |
e12047b189122074ae7e9d1485176443b9bf6bf91b67781e69bb2d713832a9f0
|
File details
Details for the file pypcode-1.1.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pypcode-1.1.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 17.8 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8372c87769bf64f496235f2be3ed6de08c6984eadf2b7666e35e1756c7a4486a
|
|
| MD5 |
ae3d57df64f5114f994a0a8cf69066a0
|
|
| BLAKE2b-256 |
33d8d8e6fd096108ee91f25d0f41726a77d6ce38fd360e724b37e73cab7f012a
|
File details
Details for the file pypcode-1.1.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pypcode-1.1.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 17.7 MB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
999173463d50fd08aaa12343727e18a5ca028a3c90cc66089a93c0f7edee696d
|
|
| MD5 |
b880a931442a5a158cf65680b7e6e79b
|
|
| BLAKE2b-256 |
f83aee5f0b998dc982db9fcd69b0c2661c268d51798901f7f930b158881f0020
|
File details
Details for the file pypcode-1.1.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: pypcode-1.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 17.7 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea0302581a94e8f05784779614000b5f0826cb572f16512c2a85640e6f8bff07
|
|
| MD5 |
336e3c046af81f5cac25e6339e8ec757
|
|
| BLAKE2b-256 |
3cd873f9a27c50b0107cda53ea99d07d8feddfe391ed222b7cfa7e8de83e24ca
|
File details
Details for the file pypcode-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pypcode-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 17.9 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0932f95f922c8cc342bd04ff8f93498f05f5ebc1db59c2869f12fc21e4378a49
|
|
| MD5 |
d80b47f473f196efaa73ebc7be1725d7
|
|
| BLAKE2b-256 |
533b02de5c52b27c401d3bda0250372bab8dbed2faa58eb09a17d3587bd0559e
|
File details
Details for the file pypcode-1.1.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pypcode-1.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 17.5 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cae12bd8bd2471c204fb586c6296f0ee1d993f55647c2440032fbaf38578f855
|
|
| MD5 |
af08089e48f8f8fc3d77fba7540df447
|
|
| BLAKE2b-256 |
dd0064101c66546bbf4e845665b465cf82cd9f23b1ef93fbed5905df1b2c1c19
|
File details
Details for the file pypcode-1.1.0-cp38-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pypcode-1.1.0-cp38-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 17.7 MB
- Tags: CPython 3.8+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec9fffac5818fee8d45755ff31153764c2a28483610a4f08bf1a784f5708f74d
|
|
| MD5 |
486ee2d30ccbfc9fcdc4c41c8b3b551e
|
|
| BLAKE2b-256 |
b7eb1f40b71706ab5a7fbab9b642de4dca8e119b2047e5cca90c07bc824ef925
|