All Projects → GrammaTech → Gtirb

GrammaTech / Gtirb

Licence: mit
Intermediate Representation for Binary analysis and transformation

Projects that are alternatives of or similar to Gtirb

Ddisasm
A fast and accurate disassembler
Stars: ✭ 325 (+71.05%)
Mutual labels:  analysis, disassembler, binary, binary-analysis, reverse-engineering
Replica
Ghidra Analysis Enhancer 🐉
Stars: ✭ 194 (+2.11%)
Mutual labels:  analysis, disassembler, binary, binary-analysis, reverse-engineering
B2r2
B2R2 is a collection of useful algorithms, functions, and tools for binary analysis.
Stars: ✭ 262 (+37.89%)
Mutual labels:  disassembler, binary, binary-analysis, reverse-engineering
Qiling
Qiling Advanced Binary Emulation Framework
Stars: ✭ 2,816 (+1382.11%)
Mutual labels:  analysis, binary, reverse-engineering
Bap
Binary Analysis Platform
Stars: ✭ 1,385 (+628.95%)
Mutual labels:  disassembler, binary-analysis, reverse-engineering
Radare2
UNIX-like reverse engineering framework and command-line toolset
Stars: ✭ 15,412 (+8011.58%)
Mutual labels:  disassembler, binary-analysis, reverse-engineering
Detect It Easy
Program for determining types of files for Windows, Linux and MacOS.
Stars: ✭ 2,982 (+1469.47%)
Mutual labels:  disassembler, binary-analysis, reverse-engineering
Redasm
The OpenSource Disassembler
Stars: ✭ 1,042 (+448.42%)
Mutual labels:  disassembler, binary-analysis, reverse-engineering
Die Engine
DIE engine
Stars: ✭ 648 (+241.05%)
Mutual labels:  disassembler, binary-analysis, reverse-engineering
E9patch
A powerful static binary rewriting tool
Stars: ✭ 317 (+66.84%)
Mutual labels:  binary, binary-analysis, reverse-engineering
Binee
Binee: binary emulation environment
Stars: ✭ 408 (+114.74%)
Mutual labels:  analysis, binary, binary-analysis
Pref
Portable Reverse Engineering Framework
Stars: ✭ 127 (-33.16%)
Mutual labels:  analysis, binary-analysis, reverse-engineering
Bam
The Binary Analysis Metadata tool gathers information about Windows binaries to aid in their analysis. #nsacyber
Stars: ✭ 93 (-51.05%)
Mutual labels:  binary, binary-analysis
Barf Project
BARF : A multiplatform open source Binary Analysis and Reverse engineering Framework
Stars: ✭ 1,280 (+573.68%)
Mutual labels:  binary-analysis, reverse-engineering
Panopticon
A libre cross-platform disassembler.
Stars: ✭ 1,376 (+624.21%)
Mutual labels:  disassembler, reverse-engineering
Php Malware Analysis
Deobfuscation and analysis of PHP malware captured by a WordPress honey pot
Stars: ✭ 82 (-56.84%)
Mutual labels:  analysis, reverse-engineering
S2e
S2E: A platform for multi-path program analysis with selective symbolic execution.
Stars: ✭ 102 (-46.32%)
Mutual labels:  analysis, reverse-engineering
X64dbg
An open-source x64/x32 debugger for windows.
Stars: ✭ 37,825 (+19807.89%)
Mutual labels:  disassembler, reverse-engineering
Kiewtai
A port of Kaitai to the Hiew hex editor
Stars: ✭ 108 (-43.16%)
Mutual labels:  binary-analysis, reverse-engineering
Bin2llvm
A binary to LLVM translator
Stars: ✭ 108 (-43.16%)
Mutual labels:  disassembler, reverse-engineering

GTIRB

The GrammaTech Intermediate Representation for Binaries (GTIRB) is a machine code analysis and rewriting data structure. It is intended to facilitate the communication of binary IR between programs performing binary disassembly, analysis, transformation, and pretty printing. GTIRB is modeled on LLVM-IR, and seeks to serve a similar functionality of encouraging communication and interoperability between tools.

The remainder of this file describes various aspects of GTIRB:

Structure

GTIRB has the following structure. Solid lines denote inheritance. Dotted lines denote reference by UUID.

GTIRB Data Structure

IR

An instance of GTIRB may include multiple modules (Module) which represent loadable objects such as executables or libraries, an inter-procedural control flow graph (IPCFG), and Auxiliary Data tables (AuxData) which can hold arbitrary analysis results in user-defined formats which can easily reference other elements of the IR. Each module holds information such as symbols (Symbol) and sections which themselves hold the actual bytes and data and code blocks of the module. The CFG consists of basic blocks (Block) and control flow edges between these blocks. Each data or code block references a range of bytes in a byte interval (ByteInterval). A section may hold one large byte interval holding all blocks---if the relative positions of blocks in that section are defined---or may hold one byte interval per block---if the relative positions of blocks is not defined, e.g. for the code blocks in the .text section during program rewriting. Each symbol holds a pointer to the block or datum it references.

Instructions

GTIRB explicitly does NOT represent instructions or instruction semantics but does provide symbolic operand information and access to the bytes. There are many intermediate languages (IL)s for representation of instruction semantics (e.g., BAP's BIL, Angr's Vex, or Ghidra's P-code). GTIRB works with these or any other IL by storing instructions generally and efficiently as raw machine-code bytes and separately storing the symbolic and control flow information. The popular Capstone/Keystone decoder/encoder provide an excellent option to read and write instructions from/to GTIRB's machine-code byte representation without committing to any particular semantic IL. By supporting multiple ILs and separate storage of analysis results in auxiliary data tables GTIRB enables collaboration between independent binary analysis and rewriting teams and tools.

Auxiliary Data

GTIRB provides for the sharing of additional information, e.g. analysis results, in the form of AuxData objects. These can store maps and vectors of basic GTIRB types in a portable way. The GTIRB manual describes the structure for common types of auxiliary data such as function boundary information, type information, or results of common analyses in Standard AuxData Schemata.

UUIDs

Every element of GTIRB---e.g., modules (Module), symbols (Symbol), and blocks (Block)---has a universally unique identifier (UUID). UUIDs allow both first-class IR components and AuxData tables to reference elements of the IR.

Instructions and symbolic operands can be addressed by the class Offset which encapsulates a UUID (that refers to the instruction's block) and an offset.

Installing

Packages currently existing for easily installing GTIRB (and attendant tooling including the ddisasm disassembler and gtirb-pprinter pretty printer) on Windows, Ubuntu, and Arch Linux. See below for instructions. GTIRB is versioned with Major.Minor.Patch versioning where Major version increments will require significant source changes but should be very rare, Minor version increments may require small source changes, and Patch version increments shouldn't break any downstream builds. We do not yet provide ABI compatibility across any version changes.

Python API

The GTIRB Python API may be installed with the following. Note however, that installation of the ddisasm and gtirb-pprinter packages as described below is recommended for every API.

pip install gtirb

Windows

Pre-built debug and release binaries are available for Windows at: windows-debug/, and windows-release/. A symbol server for the debugging symbols for both the release and debug binaries is available at https://download.grammatech.com/gtirb/files/. For information about how to use a symbol server with your debugger, please see docs.microsoft.com#Specify_symbol_locations_and_loading_behavior or your debugger's documentation.

Ubuntu

Packages for Ubuntu 16, 18, and 20 are available in the GTIRB apt repository. The GTIRB package has some dependencies which are only available in other PPAs. You will have to add these PPAs to your system in order to install the GTIRB package.

Instructions for adding the appropriate PPAS and installing GTIRB on each platform follow.

Ubuntu16

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:maarten-fonville/protobuf
sudo add-apt-repository ppa:mhier/libboost-latest
echo "deb https://grammatech.github.io/gtirb/pkgs/xenial ./" | sudo tee -a /etc/apt/sources.list.d/gtirb.list
sudo apt-get update
sudo apt-get install --allow-unauthenticated libgtirb gtirb-pprinter ddisasm

Ubuntu18

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:mhier/libboost-latest
echo "deb [trusted=yes] https://grammatech.github.io/gtirb/pkgs/bionic ./" | sudo tee -a /etc/apt/sources.list.d/gtirb.list
sudo apt-get update
sudo apt-get install libgtirb gtirb-pprinter ddisasm

Ubuntu20

sudo apt-get install software-properties-common
echo "deb [trusted=yes] https://grammatech.github.io/gtirb/pkgs/focal ./" | sudo tee -a /etc/apt/sources.list.d/gtirb.list
sudo apt-get update
sudo apt-get install libgtirb gtirb-pprinter ddisasm

Arch Linux

Arch packages are available for download from https://grammatech.github.io/gtirb/pkgs/arch/ and may be directly installed with pacman.

Additionally, the Arch User Repository (AUR) https://aur.archlinux.org/ has packages for GTIRB (gtirb-git) the GTIRB Pretty Printer (gtirb-pprinter-git) and the datalog disassembler (ddisasm-git). Note that installing ddisasm-git will cause the other two packages to be installed as well given that they are both dependencies.

The following command will build and install GTIRB using the popular aur helper yay.

yay gtirb-git

Building

GTIRB's C++ API should successfully build in 64-bits with GCC, Clang, and Visual Studio compilers supporting at least C++17. GTIRB uses CMake which must be installed with at least version 3.10.

The common build process looks like this:

mkdir build
cd build
# Note: You may wish to add some -D arguments to the next command. See below.
cmake <path/to/gtirb>
cmake --build .
# Run the test suite.
ctest

For customizing the GTIRB build, you can get a list of customization options by navigating to your build directory and running:

cmake -LH

Requirements

To build and install GTIRB, the following requirements should be installed:

  • CMake, version 3.10.0 or higher.
    • Ubuntu 18 provides this version via the APT package cmake.
    • Ubuntu 16 and earlier provide out of date versions; build from source on those versions.
  • Protobuf, version 3.0.0 or later.
    • Ubuntu 18 provides this version via the APT packages libprotobuf-dev and protobuf-compiler.
    • Ubuntu 16 and earlier provide out of date versions; build from source on those versions.
  • Boost (non-standard Ubuntu package from launchpad.net), version 1.67 or later.
    • Ubuntu 18 only has version 1.65 in the standard repository. See Ubuntu instructions above.

Usage

GTIRB is designed to be serialized using Google's protocol buffers (i.e., protobuf), enabling easy and efficient use from any programming language.

GTIRB may also be used through a dedicated API implemented in multiple languages. The APIs provide efficient data structures suitable for use by binary analysis and rewriting applications; see below for details.

Using Serialized GTIRB Data

The serialized protobuf data produced by GTIRB allows for exploration and manipulation in the language of your choice. The Google protocol buffers homepage lists the languages in which protocol buffers can be used directly; users of other languages can convert the protobuf-formatted data to JSON format and then use the JSON data in their applications.

The proto directory in this repository contains the protocol buffer message type definitions for GTIRB. You can inspect these .proto files to determine the structure of the various GTIRB message types. The top-level message type is IR.

For more details, see Using Serialized GTIRB Data.

GTIRB API Implementations

The GTIRB API is currently available in C++, Python, and Common Lisp. There is a partial Java API which is not ready for external use. For language-independent API information, see GTIRB Components. For information about the different API implementations, see:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].