Question

how can I write just a simple disassembler for linux from scratches? Are there any libs to use? I need something that "just works".

Was it helpful?

Solution

you have to understand the ELF file format first. Then, you can start processing the various sections of code according to the opcodes of your architecture.

OTHER TIPS

Instead of writing one, try Objdump.

Based on your comment, and your desire to implement from scratch, I take it this is a school project. You could get the source for objdump and see what libraries and techniques it uses. The BFD library might be of use.

You can use libbfd and libopcodes, which are libraries distributed as part of binutils.

http://www.gnu.org/software/binutils/

As an example of the power of these libraries, check out the Online Disassembler (ODA).

http://www.onlinedisassembler.com

ODA supports a myriad of architectures and provides a basic feature set. You can enter binary data in the Live View and watch the disassembly appear as you type, or you can upload a file to disassemble. A nice feature of this site is that you can share the link to the disassembly with others.

You can take a look at the code of ERESI

The ERESI Reverse Engineering Software Interface is a multi-architecture binary analysis framework with a tailored domain specific language for reverse engineering and program manipulation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top