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. Primarily for use in angr.
Quick Start
This package can be installed on Linux, macOS, and Windows platforms for recent versions of both CPython and PyPy. You will need a working compiler and CMake to build the bindings.
Install with PIP+Git via:
python -m pip install --user git+https://github.com/angr/pypcode
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 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
Hashes for pypcode-0.0.4-pp37-pypy37_pp73-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b53c430c7d0c9a737a669f24dc6445da7602c2b76dc8d7336e964f271f0d949 |
|
MD5 | 35ac9fe8de706ce3db5a28ae29f68d64 |
|
BLAKE2b-256 | f8caf13fd10d5306beb79702b9e57c569e04b35d7256d5b6d885c6fd5d34d242 |
Hashes for pypcode-0.0.4-pp37-pypy37_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a9ccb668c898f3ef1b66fb969ba9acab3bac0448d2662df187b884651c5a741 |
|
MD5 | f8c9c6fb1824c153a7751784e53e72a1 |
|
BLAKE2b-256 | cc6e08aafb25e79013eb27fdc4f7d698d6ae1264b75c97499bc8abbf62df04ab |
Hashes for pypcode-0.0.4-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fed96258503007f45778384af190a53165017f1fae506c748de7794caa5d720a |
|
MD5 | 951751756c018e397512f13daa19d1f8 |
|
BLAKE2b-256 | 2adb54a10889a89c0a94b5068f2e97b3769dafc25c5bd03706d9913184272b46 |
Hashes for pypcode-0.0.4-pp36-pypy36_pp73-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f22ef8687e818d70d1fae3afcce94ca5dc1e21a8a030d82dcd395485d0424bb |
|
MD5 | 3e26a5a11f93627996a4876f24e2704d |
|
BLAKE2b-256 | 13e008e76ccdebb5338147d7803ae5f4280089ed9fb8e5ef6c6ee02410871e17 |
Hashes for pypcode-0.0.4-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 199a7c7f5c7cbf073b0d2f17fe78419da5f7bb270d36943dcb3f0a2567124c8a |
|
MD5 | 9a0829e76650baa7fb507b4d2e8cfb13 |
|
BLAKE2b-256 | 19e755cc14b3a42e1c24a6f7118baff117696ba23709c251c9be260817f6d374 |
Hashes for pypcode-0.0.4-pp36-pypy36_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aeb92f87d8653341fbe4c9111ba7d4c4f00cd66193e87ea9f7141bee952f79f |
|
MD5 | 2f4986198f1b97cc61552f7505b60d94 |
|
BLAKE2b-256 | 791070295015345b6c0c75dcbdc7b4fbf496f5699685b2660fffe062ef9919e6 |
Hashes for pypcode-0.0.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45cd68bccacfa88f99ea822b4782c2e39261c44d146393f49654700a38ce2f61 |
|
MD5 | 17e6733f001634d8ead76d8a88673e70 |
|
BLAKE2b-256 | 759c31ef309ca8ed9b42f2fcc325c3c052dd0fa376ca8903b66890cf8fada40e |
Hashes for pypcode-0.0.4-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c083c7344e6bfbd961b59544e6d6036d7a6ebbb1bf7266be3e343caea07920d1 |
|
MD5 | a1f1c542c40b5415685f883f2f45b380 |
|
BLAKE2b-256 | 2e2e6de3967f2e6c304ec47add937edbf39e1a026b03ce3d04a890a15e845a10 |
Hashes for pypcode-0.0.4-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a37d6e5e0e4c7668a55dbbc9916fe801e36b97e5da2110dff7b66c89da9defa |
|
MD5 | 41f9cbc5f4621de5d8756e5125d1e4c3 |
|
BLAKE2b-256 | 92b659f2a4b765bde148028625f2c7e041d260fdabbeebbe1816c4d7e239dc2b |
Hashes for pypcode-0.0.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 641e62ffbfedf22d74d4b54bbcf4381693767d014803f16d991b692be5cf7509 |
|
MD5 | 5546cafe19e426fe563c3f002af7e2ac |
|
BLAKE2b-256 | 0cec94f59f5023896675075a337b99b57f5a5b52efda75c2e980a3ba0e7c583e |
Hashes for pypcode-0.0.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d3c3ecd5bc6542c085201a507b568dea4607f310452858118fd2aaf3b578ba2 |
|
MD5 | ce53efb7ce20011d4a063f146c1402e5 |
|
BLAKE2b-256 | c7f89dd46d41bc8d6d49c81c0c4b99a85ee88ea9f88077b6bc761204296aa5c7 |
Hashes for pypcode-0.0.4-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23bda3b4571ab25048f02ba75f84623507e3e62af0e035120bcf7c544f0af2ff |
|
MD5 | f67e7b95523a7c382490904eec4c35c0 |
|
BLAKE2b-256 | e4da03aca161b007a24dc09edcfb88be74fbb61faa8821aca7aa37ae0bbf0582 |
Hashes for pypcode-0.0.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58180a3f540a76beac51ec719e80f86add0f4703f2fb2cc4058fb62a2b2af35d |
|
MD5 | 89f4b809f95166fc1d775d40013ff46e |
|
BLAKE2b-256 | 781870e47102fccc0bccde7c22b972bc06bc429655836c265d33e39a725fa927 |
Hashes for pypcode-0.0.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afaff93365d296a35a5ddd35ffc259ee1c303622defc2b06387a1438e12149fc |
|
MD5 | cb8b7073f6903ec213b7ed55b5fbe54b |
|
BLAKE2b-256 | f244140d5dcefb90386487f9ad3c61f76395b2ed1633912bf0ca452e31c67622 |
Hashes for pypcode-0.0.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22e388befd83056d5895ba6de450d73ccec5efbec7cd6728501d292409bd60bc |
|
MD5 | d96b10ba74473369b512a0744457d44b |
|
BLAKE2b-256 | a7d2d68389b4097d11c413de5e635e1c1b7b5be184139d2aaa3dbebedcfc23c9 |
Hashes for pypcode-0.0.4-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe7e7bc7eec9ad8665204aea9ca0edc158cafaaf0a0c6e11be2dc5564803013c |
|
MD5 | b03b4b92253c10f5bb2bbbc529b28008 |
|
BLAKE2b-256 | 1ba55dd5b4cdecf117202ea5db5ced9c7859ddcbe06a2de1f91ba1a2c7bbdba1 |
Hashes for pypcode-0.0.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0eeb1ae49ac276403cc92d00ce0b4b1a6b30dd43dfb63a28c0ad2f36abcea556 |
|
MD5 | 9dc3636cadb017571df49fbc0d52e03e |
|
BLAKE2b-256 | 22659b4902be5436e952a1da2a61cc32c19d8525545702965e98c4376f7c8d6a |
Hashes for pypcode-0.0.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d3fe62f302b70415327b34087a98c0d798e144baefde5b94b047b4fae225daf |
|
MD5 | 3c5a0e01c6d31bd2e4a89cadd90ab042 |
|
BLAKE2b-256 | ea0471dafdd023f89e65f12fe6e1b17f816cce6ed839ca33f87e0fb07bc186da |
Hashes for pypcode-0.0.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39aae8828ac395bc54da4d719f975b98336a675fa5cd151a7bc53bc85c6b11d4 |
|
MD5 | 6250da15e1c38b3abdb9f3d0640f15cf |
|
BLAKE2b-256 | bc9c104d28832def6f10e173de82005976c331d417744e7697f8db63c67fa70c |
Hashes for pypcode-0.0.4-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20b389351d94a31ed1cd4a302a87f01e656d7e7fd8eb5f7d359dfe42f947b9d2 |
|
MD5 | 17350e80ff005368d576a93f1445da41 |
|
BLAKE2b-256 | 735bd5089a852788d744726a00bb4d3ee29a724f563f1fabf367e319edcc5fb2 |
Hashes for pypcode-0.0.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5f2fc485de99d230b1a3d754ec3bf24a113a11f1183e3f9a21dcef5c07cdfb6 |
|
MD5 | 5f888e6c5b5e51f6da88bc88b9e7479d |
|
BLAKE2b-256 | 5256698ea091a45a21674dc37676a4c69e661ded008fff387b58ec96dc9c68ea |
Hashes for pypcode-0.0.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6cb5cff2a4bd52676b619daa253e394753b4581c07e08f7665f2f21e28f6414 |
|
MD5 | f371888d3ce2baf9cc63c8b4b945276d |
|
BLAKE2b-256 | 648e7c96d0818148ececa537408d05fed0512b5c5200011efa119b6d309f39c5 |