• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cargo-crates/H03-May-2022-854,864715,937

etc/H03-May-2022-

src/H19-Jan-2021-1,5631,382

.gitignoreH A D19-Jan-202127 44

.travis.ymlH A D19-Jan-202199 98

Cargo.lockH A D19-Jan-202118.9 KiB743658

Cargo.tomlH A D19-Jan-2021828 3732

LICENSEH A D19-Jan-20211 KiB2217

README.mdH A D19-Jan-20213.6 KiB8649

README.md

1# bingrep [![Build Status](https://travis-ci.org/m4b/bingrep.svg?branch=master)](https://travis-ci.org/m4b/bingrep)
2
3Greps through binaries from various OSs and architectures, and colors them. Current backends:
4
5* ELF 32/64, arm, x86, openrisc - all others will parse and color, but relocations won't show properly
6* Mach 32/64, arm, x86
7* Unix and BSD archive printer
8* PE (debug only)
9
10**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.
11
12![elf_table2](etc/elf_table2.png)
13
14![elf_table1](etc/elf_table1.png)
15
16![mach](etc/mach.png)
17
18![archive](etc/archive.png)
19
20## Install
21
22`bingrep` is available through cargo, via `cargo install bingrep`, or you can build, and install the resulting binary wherever you like.
23
24## Build
25
26Tested with stable rustc 1.38.0.
27
28`cargo build --release`
29
30Now copy the resulting binary in `<path_to_bingrep>/target/release/bingrep` wherever you like.
31
32## Run
33
34Example:
35
36```
37bingrep /bin/ls
38```
39
40To dump internal debug representation of the parsed binary:
41
42```
43bingrep -d /bin/ls
44```
45
46To demangle symbols, use `-D` or `--demangle`:
47
48```
49bingrep -D /bin/ls
50```
51
52## Meta Analysis (Experimental)
53
54You can print a hextable (WIP) via `--hex` or an overview of file offset ranges via `--ranges`.
55
56![ranges](etc/ranges.png)
57
58## Searching
59
60Search functionality is being added.
61
62You can try it out using `bingrep --search "string" ` or `bingrep -s "string"`.  Currently only works for ELF targets.
63
64Please chime in on https://github.com/m4b/bingrep/issues/13 for how this functionality will:
65
661. Be presented,
672. What API will be exposed
683. What usecases are most important (e.g., how do you like to search binaries)
694. How it will be implemented
70
71# FAQ
72
73> Why is this repo called bingrep, it's nothing like grep at all
74
75That'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](https://github.com/m4b/bingrep/issues/1) for a better name, you can chime in too!
76
77> Why do you/should I use this instead of X ?
78
79For 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!
80
81> Is there anything to work on?
82
83Yes, 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.
84
85If 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.
86