mjhouse / deaf

A library for inspecting/modifying ELF binaries
GNU General Public License v3.0
7 stars 0 forks source link

[![Tests][tests-shield]][tests-url] [![Docs][docs-shield]][docs-url] [![GPL v3][license-shield]][license-url]


DEAF

A Rust library for parsing and modifying ELF binaries
Contributions · Code Of Conduct · Report Bug · Request Feature

Table of Contents
  1. Introduction
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. Contact

Introduction

This is a library for parsing and modifying ELF-format binaries. There are other libraries like elf, elfy, and elfkit for parsing the format, but they are either not able to modify the ELF binary (elf and elfy) or are limited/unmaintained (elfkit). DEAF is written with the explicit goal of allowing users to modify anything that they can see in the binary- you should be able to add symbols to the symbol tables, remove the body of a function, or change the name of a section, easily and intuitively. Some of the changes you can make will probably break the binary. For example, if you remove the body of a function then relative branch instructions after the gap will no longer point to the correct address.

As the development of the library progresses, there should be fewer and fewer ways that your changes break the ELF binary, and the end goal is to even handle updating branch instructions when code is removed from an executable section.

(back to top)

Getting Started

This project is still in the very early stages, so expect a lot of breaking changes, restructuring, and reorganization from one version to the next as we figure out where things belong. If you still want to try it out, include deaf in your project by using cargo add:

cargo add deaf

Or by manually updating your cargo toml:

deaf = "0.1.2"

Then use it in your project like so:

use deaf::{Binary,Section,common::SectionType};

let binary = Binary::load("assets/libjpeg/libjpeg.so.9").unwrap();

for section in binary.sections(SectionType::Strings).iter() {
    let name_offset = section.name_index();
    let name_value = binary.section_name(name_offset).unwrap();
    println!("{}",name_value);
}

For more details, refer to the documentation.

(back to top)

Roadmap

0.1.0

This version is mainly aimed at providing initial functionality.

0.2.0

This release is generally aimed at propagating changes to keep the binary useable.

0.3.0

This release is going to be all about gathering context about executable code, if not outright disassembling it.

Future

This is a haphazard collection of things that should be added to the library at some point but that aren't quite on the roadmap yet.

(back to top)

Contributing

Anyone is welcome to contribute to DEAF, just try to follow the code of conduct and the contribution guidelines. If something is unclear or not covered in the guides, create an issue describing the problem and someone will get back to you as soon as possible.

(back to top)

Contact

Create an issue and @mjhouse to get my attention, or email me at mjhouse@protonmail.com.

(back to top)