Coder Social home page Coder Social logo

kajaaz / pcode-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rbran/ice-kola

0.0 0.0 0.0 100.89 MB

Generates raw Pcode and high-level Pcode from a binary using the Ghidra API.

License: Apache License 2.0

Rust 53.60% C++ 22.08% Go 7.79% C 1.02% Python 15.51%

pcode-generator's Introduction

Pcode Generator

Tool that generates low-level (raw) Pcode and high-level Pcode from a binary file using the Ghidra API.

Currently covered and partiely tested binaries handling from following languages : Golang, C.

Install

Make sure to have Rust and C++ installed.

Install submodules and the repo with the --recursive flag:

sudo apt-get update
sudo apt install binutils-dev bison
git clone --recursive https://github.com/kajaaz/pcode-generator.git

You will need to adapt the path to your include/c++ inside the ghidra-decompiler/build.rs file:

.clang_arg("-I/usr/include/c++/11")

If needed, export the correct path to Ghidra:

export GHIDRA_SRC=${HOME}/path/to/pcode-generator/ghidra

Usage

If you work with Go binaries, make sure to have built them with BoringSSL:

GOEXPERIMENT=boringcrypto go build .

Getting this Pcode generator running is quite simple:

USAGE:
    cargo run [ABSOLUTE PATH TO BINARY] [FLAGS]

FLAGS:
    --high-pcode         Generate an output file with the Ghidra high level Pcode instructions
    --low-pcode          Generate an output file with the Ghidra low level (raw) Pcode instructions

Be aware that the first build will take 2 to 3 minutes. After that, the generation of the file should be done in several seconds.

You can generate the raw Pcode of a binary using Pcode-generator and then use Pcode-parser to parse the produced pcode.

Example of use

If you want to generate the high-level Pcode of the binary "calculus", use the following command in pcode-generator/src:

cargo run /absolute/path/to/tests/calculus/calculus --high-pcode

The output file with the generated Pcode can be found in the locally created results directory at the root of the repo.

Credits

Thanks to @rbran, @niooss-ledger and @yhql.

pcode-generator's People

Contributors

kajaaz avatar rbran avatar niooss-ledger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.