bin-debug-friendly
A fast, Bubblewrap-sandboxed Linux ELF debugger, stationary live-arrow TUI, execution mapper, lifecycle heap dumper, and dynamic stack/register string extractor—built to shred any runnable ELF binary (even stripped & sstripped) into clean, human-readable intelligence.
⚠️ PLATFORM SUPPORT: LINUX ONLY.
bin-debug-friendly relies on Linux kernel namespaces (bubblewrap), /proc/<pid>/maps memory introspection, named FIFOs, ELF32/ELF64 binary parsing, GNU gdb, and optional qemu-user emulation.
ZERO MANDATORY pip DEPENDENCIES: Built 100% on the Python 3 standard library (colorama is purely optional for terminal diff colors and never required).
Table of Contents
- Why
bin-debug-friendly?
- You Can't Hide From This Suite
- The Three-Tool Arsenal
- Quick Start & Prerequisites
- Synopsis & Launch Flags (
main.py)
- Direct Exact-Address Debugging (Zero
main+offset Math)
- Complete Interactive Command Reference
- Live View (
view) & Nested Call Windows (nestN)
- Call Navigation (
call <func>) & Call Ignoring (ignore)
- Interactive
stdin (fgets / scanf / read)
- Smart Zero-Trimmed Stack Inspection & Dumping
- Session Recording (
--record) & Register Dereferencing (DEREF)
- Autonomous Execution Mapping (
--map & --func)
- Lifecycle Heap Dumper (
heap_dump.py)
- Dynamic Stack & Register String Extractor (
stack_strings.py)
- Safety Limits, Timeouts & Graceful Interrupts
- Configuration Reference (
src/config.py)
- Security Model (Bubblewrap Sandbox &
--no-sandbox)
- Cross-Architecture Debugging (QEMU + ARM / AArch64 / x86)
- Real-World Reverse Engineering Walkthroughs
- Running the Test Suite
- License
1. Why bin-debug-friendly?
Have you ever copied an address like 0x1149 straight out of objdump, binpatch, readelf, or a hex dump—only to watch raw GDB fight you every single step of the way?
In plain GDB:
- Debugging a PIE binary means manually calculating
runtime_base + 0x1149 or typing b *main+0x12.
- Stepping casually drops you inside
puts@plt, _dl_runtime_resolve, and hundreds of lines of ld-linux.so and libc internals.
- Register dumps show raw hex without showing whether
RDI or RDX points to "letmein123" or "Wrong.".
- Dumping
[stack] writes 135 KB of empty 0x00 guard memory instead of your active stack frames.
- Feeding
fgets / scanf inside a debugger turns into messy TTY collisions.
- Static
strings binary finds nothing when a binary decrypts its secrets onto the stack or heap at runtime.
- Feeding an
sstripped binary (where all section headers are deleted) makes standard disassemblers and debuggers crash or refuse to work.
bin-debug-friendly replaces all of that pain with a fast, unified, human-friendly reverse-engineering workflow.
If an ELF binary is valid and can run on Linux, you can debug it, record it, map it, dump its stack, snapshot its heap, extract its runtime strings, and tear it apart—even if it was stripped down to the bone with strip --strip-all or sstrip, or compiled into a sub-1 KB custom syscall ELF binary.
2. You Can't Hide From This Suite
Crackmes, CTFs, obfuscated tools, and malware try every trick in the book to hide secrets from static analysis. Here is how bin-debug-friendly defeats each layer automatically:
| Anti-Analysis / Hiding Trick |
How bin-debug-friendly Defeats It |
| PIE / ASLR randomization |
Automatically discovers runtime base via /proc/<pid>/maps / auxv and translates objdump offsets back and forth transparently. |
| Stack-constructed / XOR-decoded secrets |
view lights up changed stack bytes green in real time; --record and --map log stack diffs; stack_strings.py catches secrets materializing byte-by-byte (crac $\rightarrow$ crackme123). |
Heap-only allocation (malloc, never touches stack) |
heap_dump.py freezes execution at sys_read (fd == 0) and dumps [heap] immediately, revealing heap-only buffers like letmein123. |
Just-in-time decode after fgets + explicit_bzero / free wipe |
heap_dump.py installs post-stdin traps on strcmp, strncmp, memcmp, explicit_bzero, free, and exit_group—snapshotting [heap] before the wipe (up to 16 distinct states). |
| Register-only pointer passing |
--map and --record automatically check every GPR (>= 0x1000) for printable C-strings and log DEREF: RDI->'letmein123'; stack_strings.py sweeps them all up (note: coincidental short ASCII runs inside GOT/libc pointers like @QUUUU also appear alongside real strings). |
strip --strip-all & sstrip (zero section headers) |
Reconstructs synthetic .text, .data, and .shstrtab sections past the last PT_LOAD segment in the sandboxed copy so GDB never crashes; recovers main() statically from _start on x86_64 (lea rdi, [rip+disp32]) and i386 (push imm32 before call), and traps main dynamically via X0/R0 when stepping _start on aarch64/arm. |
3. The Three-Tool Arsenal
main.py — The core Bubblewrap-sandboxed ELF debugger, stationary live-arrow view dashboard, session recorder (--record), and autonomous execution/syscall mapper (--map).
heap_dump.py — Standalone lifecycle heap dumper that catches [heap] snapshots before stdin reads and right before strcmp/explicit_bzero/free/exit_group wipes—working even on sstripped binaries.
stack_strings.py — Standalone string extractor that reconstructs all chronological stack states and DEREF: register targets from any --record or --map folder into a unified binary stream and deduplicated timeline.
4. Quick Start & Prerequisites
System Requirements (Linux Only)
- Python 3.10+ (standard library only—zero mandatory
pip packages)
- GNU
gdb
bubblewrap (bwrap) — mandatory for sandboxed execution
- Optional:
colorama — enables bright-green byte/character change highlights in interactive TTYs
qemu-user + gdb-multiarch — enables cross-architecture debugging (aarch64, arm, i386)
xxd and less — for inspecting .stack.bin / heap.bin dumps and stack less
Install Dependencies
# Artix / Arch Linux
sudo pacman -S --needed python gdb bubblewrap
# Optional colors & cross-arch support:
sudo pacman -S --needed python-colorama qemu-user gdb-multiarch
# Debian / Ubuntu
sudo apt update && sudo apt install -y python3 gdb bubblewrap
# Optional colors & cross-arch support:
sudo apt install -y python3-colorama qemu-user gdb-multiarch
Make Scripts Executable
chmod +x main.py heap_dump.py stack_strings.py
For system-wide installation (bin-debug-friendly, bin-debug-friendly-heap, bin-debug-friendly-strings), see INSTALLATION.md.
5. Synopsis & Launch Flags (main.py)
python3 main.py <binary> [target_args...] [OPTIONS]
| Flag |
Argument |
Description |
-m, -main, --main |
(none) |
Start and automatically pause at main(). Supports symbol-rich binaries across all architectures, plus stripped/sstripped binaries on x86_64 and i386 (via _start recovery). Also pairs with --map to map from main() forward. |
-A, -a, --args |
"ARGS" |
Pass arguments to the target binary safely (supports quoted strings and escaped \", e.g. -A "-o out.txt \"hello \\\"world\\\"\""). |
-record, --record |
(none) |
Record every interactive command, timing, disassembly context, register diff, register dereferences (DEREF), full active stack, and stdout into record-<bin>_<DD-MM-YYYY_HH-MM-SS>/. |
-map, --map |
(none) |
Run autonomous execution mapper: traces instructions, GPRs, DEREF: strings, active stack snapshots & diffs, system calls, and stats into <bin>-mapped_<DD-MM-YYYY_HH-MM-SS>/. |
-func, --func, --function |
ADDR|SYM |
With --map: start tracing when ADDR or SYM is entered and automatically stop when it returns. |
--dump-stack-syscalls |
(none) |
With --map: save binary .stack.bin snapshots (syscall_NNNN_<name>.stack.bin) on every system call entry. |
--no-sandbox |
(none) |
Disable Bubblewrap isolation and debug directly on the host (triggers a full-screen warning and 3-step confirmation: two yes/no prompts followed by typing "I know"). |
Default Entry Behavior
- Running
python3 main.py ./binary (without -m) automatically skips ld-linux.so loader noise and pauses cleanly at the binary's real entry point (_start), ready for inspection even on stripped, sstripped, or raw custom-syscall binaries.
6. Direct Exact-Address Debugging (Zero main+offset Math)
Whether your binary is compiled with PIE (-fPIE -pie), -no-pie, or stripped with sstrip, you can paste addresses directly from objdump, binpatch, readelf, or xxd.
Accepted Hex Formats
Every address command (stop, 0x..., jump, --func) normalizes whitespace, quotes, case, and 0x prefixes automatically:
0x1149
1149
0X401149
"0x1149"
" 0x 40 11 49 "
"11 49"
Instant Run-To Shortcut (0x...)
Type any 0x-prefixed hex address alone at the prompt (in either the main CLI or view):
0x10a0 (_start)> 0x12c4
[+] Ran to 0x12c4 (pie_vaddr(objdump=0x12c4))
[*] Stopped (breakpoint-hit) at 0x12c4 in main
=> 0x12c4: e8 23 ff ff ff call 0x11ec <check_password>
If the program has already exited, typing 0x12c4 restarts it cleanly and runs straight there.
7. Complete Interactive Command Reference
Full readline history (Up / Down arrows, Ctrl+R, Left/Right editing) and Tab autocompletion are active in both the main CLI and view.
Navigation, Breakpoints & Execution
| Command |
Aliases |
Usage & Behavior |
0x<addr> |
"0x 11 49" |
Immediately runs (or restarts if exited) to <addr> and stops. |