

Here is a modified version of the above script: #!/usr/bin/python3ĬODE = b"\x50\x51\x52\x53\x54\x55\x56\x57" and newer processors and on Linux kernel 2.6.30 and later versions. If you have loose hex dump data that you wish to disassemble. So if we change 0x55 to 0x54 the output becomes 0x1000: push esp - a different register is pushed. The Bastard disassembler is a powerful, scriptable disassembler for Linux and FreeBSD. When we consult the x86 opcode table, we see that a value of 0x50 + the register = Push Word, Doubleword or Quadword Onto the Stack.

This is similar to blackarch-decompiler, and there will probably be a lot of programs that fall into both, however these packages produce assembly output rather than the raw source code. Print("0x%x:\t%s\t%s" %(i.address, i.mnemonic, i.op_str)) List of all disassembler tools available on BlackArch. If you want to disassemble individual bytes, you can use the Capstone disassembly framework's Python bindings to write scripts that disassemble the byte values that you specify. It sounds like you are interested in going the other way, that is, disassembling object (binary) code.
LINUX DISASSEMBLER DUMP CODE
GCC is a compiler toolchain, which performs preprocessing of the source file, translates source code to assembly, translates that to machine code, and then performs relocation via the link-editor, producing an ELF binary. If you want to create your own libopcodes-based disassembler that does this, the following article will help you get started: Basic disassembly with libopcodes. rely on the BFD library, meaning they take well-formed ELF files, not arbitrary byte values or ASCII hex strings, as input. Linux binutils tools, such as objdump, gdb etc.
