Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philzook58/pcode2c
Convert low ghidra pcode to verifiable C
https://github.com/philzook58/pcode2c
binary-analysis c ghidra verification
Last synced: 3 months ago
JSON representation
Convert low ghidra pcode to verifiable C
- Host: GitHub
- URL: https://github.com/philzook58/pcode2c
- Owner: philzook58
- Created: 2023-12-12T15:54:02.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-13T18:17:00.000Z (5 months ago)
- Last Synced: 2024-09-14T09:20:29.773Z (5 months ago)
- Topics: binary-analysis, c, ghidra, verification
- Language: Jupyter Notebook
- Homepage:
- Size: 1.59 MB
- Stars: 17
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pcode2c
WIP: Do not expect this to work for you yet.
pcode2c is a Ghidra translator script from low pcode to a [specialized C interpreter](https://www.gtoal.com/sbt/) for the purposes of running the resulting code through off the shelf verifiers (for example [CBMC](https://github.com/diffblue/cbmc)). The resulting C has a direct mapping to the underlying assembly.
C is a useful intermediate because it enables using powerful off the shelf verifiers and can be directly compared (with a little muscle grease) against decompilaton or source.
This enables soundly answering questions about the relationship between high level source and binary in a relatively easy manner that no other method I know of can do.
Blog posts:
- [PCode2C: Steps Towards Translation Validation with Ghidra and CBMC](https://www.philipzucker.com/pcode2c/)
- [DWARF Verification via Ghidra and CBMC](https://www.philipzucker.com/pcode2c-dwarf/)
## Installation```bash
python3 -m pip install -e .
```## Usage
```bash
python3 -m pcode2c ./examples/min/mymin.o > tmp.c
gcc -I _templates -c tmp.c
```## Ghidra Plugin Installation
- Open up Ghidra on a binary
- Click on `Window > Script Manager` in the toolbar
- Manage Script Directories button in top right of Script Manager window (looks like a checklist)
- Find the `./scripts` directory and add it
- Click Refresh Script List in script manager
- There is now a PCode2C folder in the script manager. Go to it and click## Example