I have a binary file. If I open it with vi, it shows sequences of human-readable text and binary characters. What is the best way to extract the human-readable portion only using bash?
I was thinking, maybe we can do this over a grep or sed pattern?
$ cat file1.bin | grep '????' > newfile.txt
If you're on a Debian distro, you can probably get radare2 (r2) with just sudo apt install radare2
.
After you've installed r2, either with apt
, some other installer on some other distro, or by following an online guide, you can use rabin2
to extract just the text part of a binary:
$ rabin2 -z your_binary
This is often "better" than just strings
because it outputs just the useful .data
section of the binary. Stuff outside that section isn't always very useful.
Use the strings
utility - that's exactly what it's designed for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With