Tuesday 1 November 2011

How To Search Strings In Binary Files in Linux

There is this very useful strings command in linux that lets us to search strings inside binary and object files. This is useful for developers in many cases and also for linux binary crackers. Also, end users can study more about executable with this command.

I've used strings command several times for ELF binary cracking and the command helps us gather more information of any given executable. It supports many executables and object formats such as elf32-i386, a.out-i386-linux, pei-i386, elf32-little, elf32-big, elf64-x86-64, pei-x86-64, elf64-l1om, elf64-little, elf64-big, plugin, srec, symbolsrec, verilog, tekhex, binary, ihex, and trad-core.

Usage:

The command itself is pretty easy to use, the simplest being as below:

strings file_name

Specify the name of object or executable file of supported type and you are good to go. However you might want to customize the way strings command searches the strings in the given file. For example, to search for strings in all the sections of the file(by default, it searches only
the data section), you can use the command as below:

strings -a file_name

There are much more options which you can study by typing strings -h and man strings in the terminal. I hope it helps you.