Code Monkey home page Code Monkey logo

coronium's Introduction

coronium

coronium: a hypothetical chemical element thought to have been detected in the solar corona whose spectrum showed a number of lines later identified as belonging to iron, nickel, and other elements highly ionized at the extreme solar temperatures.

Coronium is the ghidra disassembler + decompiler in library form. Made suitable for use in c++ projects. Usage is as easy as g++ <your-code>.cpp $(pkg-config --cflags --libs coronium) -o output>. None of the Ghidra source code for the decompiler has been modified. The purpose of this project is to enable installation of the ghidra c++ source for use as a c++ library. To that end, a convenience header coronium.hpp is provided which holds helper function(s) to simplify interacting with the ghidra library code.

Install

mkdir build
cd build
cmake ..               # (alt.) cmake .. -DSLA_LOCATION=<your-directory>
make -j$(nproc)
sudo make cpus         # build and install .sla files. Optional if you plan to use SLA_DIR.
sudo make install      # install headers + lib.
sudo ldconfig          # make linker recognize lib on path.

coronium installs: slgh-compile (i.e., the sleigh compiler), coronium header files, libcoronium.so, and optionally a build of all the cpu spec files. The cpu specification files (.sla files) will be installed in /var/coronium (default location –can change this during install).

However, if you decide to change/move the cpu directory, just be sure to set the environment variable SLA_DIR to this new location. That way coronium will still be able to find the sla cpu definitions. The environment variable SLA_DIR is given precedence over whatever path was decided during the initial install.

.sla files are searched for recursively inside whatever folder SLA_DIR points to (or wherever you specified SLA_LOCATION to point to at compile time). The subfolder hierarchy does not matter. You could point SLA_DIR to your top level ghidra folder and coronium will search recursively to find the correct .sla file.

After installation compile and run the file test/example_one/example_one.cpp to make sure everything is working. If you face a problem create an issue. One issue you may face is if you direct SLA_DIR to an older ghidra installation that uses a different sleigh version. To find out, open one of the compiled .sla files inside your ghidra install and note the field <sleigh version at the top and compare that with an .sla file compiled using this project. If there is a mismatch, you will need to recompile the ghidra installed .slaspec files using the sleigh compiler but by this project slgh-compile.

After install you can link to targets with headers such as

/* main.cpp */
#include <coronium/coronium.hpp>
#include <coronium/types.h>
#include <coronium/loadimage.hh>
#include <coronium/sleigh.hh>
#include <coronium/emulate.hh>
/* ... */

via the cmdline – g++ main.cpp -lcoronium -o main

Dependencies

For the bfd related headers to be installed you will need libbfd, which you can get with

apt install binutils-dev

This dependency is optional.

Updating to latest the ghidra source code

The convenience script update_ghidra_src.py can be used to ensure that coronium uses the latest and greatest source code directly from the official ghidra github repo. Just run ./update_ghidra_src.py. If this is desirable, you will need to run the script prior the install instructions given above.

However, by updating you do risk the chance of being unable to build coronium. There is no guarantee that the cutting edge ghidra source will always compile. So far this has yet to be an issue. Regardless, only the ghidra source present in this repo is guaranteed to compile.

coronium's People

Contributors

jstaursky 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.