• Stars
    star
    1,704
  • Rank 27,394 (Top 0.6 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

like ~~grep~~ UBER, but for binaries

bingrep

Actions crates.io version

Greps through binaries from various OSs and architectures, and colors them. Current backends:

  • ELF 32/64, arm, x86, openrisc - all others will parse and color, but relocations won't show properly
  • Mach 32/64, arm, x86
  • Unix and BSD archive printer
  • PE (debug only)

NOTE: Building requires rustc version 1.20 or greater. If you're using a distro's rust compiler, consider using https://rustup.rs to install your rustc compiler and associated binaries.

elf_table2

elf_table1

mach

archive

Install

bingrep is available through cargo, via cargo install bingrep, or you can build, and install the resulting binary wherever you like.

Build

Tested with stable rustc 1.38.0.

cargo build --release

Now copy the resulting binary in <path_to_bingrep>/target/release/bingrep wherever you like.

Run

Example:

bingrep /bin/ls

To dump internal debug representation of the parsed binary:

bingrep -d /bin/ls

To demangle symbols, use -D or --demangle:

bingrep -D /bin/ls

Meta Analysis (Experimental)

You can print a hextable (WIP) via --hex or an overview of file offset ranges via --ranges.

ranges

Searching

Search functionality is being added.

You can try it out using bingrep --search "string" or bingrep -s "string". Currently only works for ELF targets.

Please chime in on #13 for how this functionality will:

  1. Be presented,
  2. What API will be exposed
  3. What usecases are most important (e.g., how do you like to search binaries)
  4. How it will be implemented

FAQ

Why is this repo called bingrep, it's nothing like grep at all

That's a good question; I was using this as a personal development tool for some time, and I was conferring with someone from the internet about some binary stuff, when I decided I should just upload this to a proper repo instead of sending pictures. So I quickly created a repo, I felt like I had been greppin' through binaries, so that was the name I uploaded. Even worse, I named it bg as the produced executable at the time of the upload, and this of course immediately conflicted with the unix command bg. There's an issue for a better name, you can chime in too!

Why do you/should I use this instead of X ?

For some of my projects or workflows I need to very quickly see the load address, offset, or size of a symbol/program header/section header/export/import. I got tired of using objdump/nm/X because really, I just needed to colorize addresses, sizes etc., so I can quickly identify them and move on. So I wrote this, very quickly, and named it a bad name (sorry!). Then I went totally overboard and started coloring everything, everywhere. You love it, don't worry. Also you're free to use anything you want, whatever makes you happy and productive!

Is there anything to work on?

Yes, there are several open issues. I think I'd actually like to port the symbol map functionality (which enables printing every binary that exports a symbol) from https://github.com/m4b/rdr, as well as implement a "reverse symbol map", which finds every binary that calls/imports a symbol.

If you also like hacking on binary stuff, the backend this uses, https://github.com/m4b/goblin, is responsible for the actual loading, parsing, etc., and there are several open issues on that repo as well if you feel like contributing.

More Repositories

1

goblin

An impish, cross-platform binary parsing crate, written in Rust
Rust
1,167
star
2

faerie

Magical ELF and Mach-o object file writer backend
Rust
263
star
3

dryad

An almost-parallel, semi-functioning, dynamic linker experiment, written in Rust
Rust
162
star
4

scroll

Scroll - making scrolling through buffers fun since 2016
Rust
151
star
5

rdr

Rdr is a cross-platform binary analysis and reverse engineering library, utilizing a unique symbol map for global analysis.
OCaml
83
star
6

raml

OCaml runtime and FFI bindings directly in Rust
Rust
78
star
7

elf2json

Converts an ELF binary to a JSON representation
OCaml
32
star
8

bin2json

Converts ELF, mach-o, or PE binaries to a JSON representation
OCaml
29
star
9

cargo-sym

Prints various binary symbols in your crate
Rust
13
star
10

silicon-disassembler

A high-performance, asynchronous disassembler which uses capstone.js as the backend and Web Workers for non-blocking requests
HTML
11
star
11

compilers-vm

A sandmark VM, in OCaml. Very fast.
OCaml
8
star
12

lazy_transducer

Lazy, parallel, indexable, generic data iterators
Rust
7
star
13

apli

Haskell APL Interpreter - ver 0.1
Haskell
6
star
14

stackup

Statically modify a program binary's runtime stack size on Mac OS X --- without recompiling.
Swift
6
star
15

algos

Algebraic arithmetization of boolean algebra and its implementation.
OCaml
6
star
16

silicon-hex-table

An efficient web-component hex table for all your online hexadecimal needs.
HTML
4
star
17

cloaked-robot

compilers final project --- Data Flow
Haskell
3
star
18

silicon-instructions

Display assembly instructions in a list-like format, using highlight.js
CSS
3
star
19

paper-trek

Boldly going where no paper element has gone before!
JavaScript
2
star
20

derp-archer

Project 2: Grammar Analysis and Parsing, CS454/554
Haskell
2
star
21

dotfiles

dotfiles and other configuration files
Haskell
2
star
22

metagoblin

WIP: Provides abstracted meta information about a binary
Rust
1
star
23

element-party

The splash page for http://element-party.xyz --- for those times when you just need to party.
HTML
1
star
24

scroll_derive

Macros 1.1 implementing #[derive(Pread, Pwrite)]
Rust
1
star
25

m4b.github.io

HTML
1
star
26

chat

Simple OCaml chat program
OCaml
1
star
27

ms-present

Master's Examination slides
TeX
1
star
28

silicon-symbols

Displays a list of symbols
HTML
1
star
29

drag-drop-behaviors

HTML
1
star
30

topo-tango

NM Game Jam Topological Tango
Lua
1
star
31

silicon-upload

A simple binary upload widget, to deliver all those bits to the server of your choice
HTML
1
star
32

get-polymer-imports

Simple python script to get all the polymer imports from a bower_components directory
Python
1
star
33

avant-lexeme

haskell compilers project
Haskell
1
star
34

foiled

Scala Implementation of FOIL
Scala
1
star
35

silicon-image

Displays a rasterized binary image with `silicon-image-behavior`, to update binary offsets via mouse movement, and etc.
HTML
1
star