Coder Social home page Coder Social logo

gmh5225 / ghidra-to-llvm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from toor-de-force/ghidra-to-llvm

0.0 0.0 0.0 495 KB

An binary-to-LLVM IR lifter that leverages Ghidra's IR and analysis

License: MIT License

Java 26.62% Python 41.26% Makefile 0.21% LLVM 9.90% C++ 22.01%

ghidra-to-llvm's Introduction

Ghidra-to-LLVM

This tool lifts a a compiled binary to LLVM.

Special thanks to the my advisor Arie Gurfinkel and the CMU Pharos team (https://github.com/cmu-sei/pharos). Tests taken from their repository.

Required packages for Python 3

  • llvmlite
  • graphviz

Installation Instructions (Linux Only)

1. Install Ghidra

https://ghidra-sre.org/ghidra_9.1.1_PUBLIC_20191218.zip

  • Extract the JDK: tar xvf <JDK distribution .tar.gz>
  • Open ~/.bashrc with an editor of your choice. For example:vi ~/.bashrc
  • At the very end of the file, add the JDK bin directory to the PATH variable:export PATH=/bin:$PATH
  • Save file
  • Restart any open terminal windows for changes to take effect

2. Edit g2llvm.py

The script requires you to provide the location of two files (absolute path):

  • ghidra_headless_loc = "/PATH/TO/ghidra_9.1.1_PUBLIC/support/analyzeHeadless"
  • prj_dir = "/PATH/TO/GhidraProjects/"

Usage

To run the the tool, simply run the g2llvm.py script. It takes a single mandatory argument, the target executable.

Optional arguments:

  • '-out' emits intermediate files
  • '-opt X' attempts to optimize the file. Valid options 0-3. (Currently only 0 works)
  • '-cfg' saves a .PNG of the whole module CFG.
Extra Scripts
  • HighFunction_Analysis.java: Prints readable version of high function representation
  • HighFunction2LLVM.java: Makes an XML file if the high function representation
TODO
  • Implement lifting using Ghidra's HighFunction (will eventually be the default)

ghidra-to-llvm's People

Contributors

toor-de-force 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.