ランキングに戻る

m4b/bingrep

Rust

like ~~grep~~ UBER, but for binaries

grepbinaryobjdumpelfportable-executablemach-o
スター成長
スター
1.8k
フォーク
68
週間成長
Issue
7
5001k1.5k
2023年1月2024年3月2025年5月2026年7月
成果物crates.iocargo add bingrep
README

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.74 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.74.0.

cargo build --release

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

Build for Packagers

If using cargo, I suggest to use the "product" profile, which uses LTO with 1 codegen unit; this should be the most performant, but also ends up slimming the binary down somewhat.

cargo build --profile product
strip target/product/bingrep

The resulting binary in target/product/bingrep is ready to go.

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 https://github.com/m4b/bingrep/issues/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.

関連リポジトリ
BurntSushi/ripgrep

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

Rustcrates.ioThe Unlicenseripgreprecursively-search
66.4k2.7k
ast-grep/ast-grep

⚡A CLI tool for code structural search, lint and rewriting. Written in Rust

Rustcrates.ioMIT Licensecodemodlinter
ast-grep.github.io
15.1k416
onceupon/Bash-Oneliner

A collection of handy Bash One-Liners and terminal tricks for data processing and Linux system maintenance.

MIT Licenseoneliner-commandsbash
onceupon.github.io/Bash-Oneliner/
10.8k646
Fechin/reference

⭕ Share quick reference cheat sheet for developers.

EJSGNU General Public License v3.0cheatsheetreference
cheatsheets.zip
10.7k1.3k
learnbyexample/Command-line-text-processing

:zap: From finding text to search and replace, from sorting to beautifying text and more :art:

Shellcommand-linelinux
10.2k704
dmtrKovalenko/fff

The fastest and the most accurate file search SDK for AI agents, Neovim, Rust, C, Python, Bun and NodeJS

Rustcrates.ioMIT Licensefilesearchlua
fff.dmtrkovalenko.dev
9.8k386
bitfield/script

Making it easy to write shell-like scripts in Go

GoGo ModulesMIT Licenseshellcat
bitfieldconsulting.com/subscribe
7k361
alexpasmantier/television

A very fast, portable and hackable fuzzy finder.

Rustcrates.ioMIT Licenseclicommand-line-tool
alexpasmantier.github.io/television/
6.1k181
Genivia/ugrep

🔍 ugrep 7.8 file pattern searcher -- a user-friendly, faster, more capable grep replacement. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more

C++BSD 3-Clause "New" or "Revised" Licensegrepunicode
ugrep.com
3.2k141
BeaconBay/ck

Local first semantic and hybrid BM25 grep / search tool for use by AI and humans!

Rustcrates.ioApache License 2.0grepgrep-like
beaconbay.github.io/ck/
1.7k70
dyng/ctrlsf.vim

A text searching plugin mimics Ctrl-Shift-F on Sublime Text 2

Vim Scriptvimneovim
1.6k89
beyondgrep/ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**

PerlOtherperltree
github.com/beyondgrep/ack3/
1.5k138