1

My lecturers have requested that I debug binwalk in order to understand how it works and develop new features so that it can extract more. I tried to use gdb to debug binwalk but it results in the error message "/usr/bin/binwalk": not in executable format: File format not recognized". What other tool can be used to debug it?

3

I tried to use gdb to debug binwalk but it results in the error message "/usr/bin/binwalk": not in executable format: File format not recognized".

In order for gdb to interface with a binary executable, the binary must have one of the following object file formats:

  • a.out
  • COFF
  • ECOFF
  • XCOFF
  • PE
  • ELF
  • SOM

The binary must also have intact section information, as gdb relies on libbfd. Since binwalk is written in Python and interpreted by the Python interpreter instead of being compiled in to an executable binary that conforms to one of the aforementioned formats, gdb cannot be used to dynamically analyze binwalk.

My lecturers have requested that I debug binwalk in order to understand how it works and develop new features so that it can extract more.

If your primary goal is extending the functionality of binwalk, then dynamically analyzing it may not be as productive as looking at

as well as documentation on

But if "debugging" binwalk is the primary focus, then pdb or using a Python IDE will work.

| improve this answer | |
2

Binwalk is written on Python language. Please try pdb. Python debugger.

| improve this answer | |
  • or any modern python IDE with debugging capabilities such as PyCharm. – HamZa Mar 19 '17 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.