5

I already tried this, I opened a a.out file with a text editor but I get only a bunch of characters with some instructions in it like:

üÙ

Manuel de Leon
  • 2,623
  • 4
  • 19
  • 12

5 Answers5

5

Try hexdump. Something like:

$ hexdump -X a.out

It will give you just that: an hexadecimal dump of the file.

Having said that, another possibility might include using GDB's disassemble command.

Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292
3

Lookup your local friendly Hex Editor.

Andrew White
  • 52,720
  • 19
  • 113
  • 137
0

To see the disassembly (with opcode bytes) of the code only, not including any file headers:

objdump -d a.aot
Igor Skochinsky
  • 24,629
  • 2
  • 72
  • 109
0

Executable files come in several formats. For Unix/Linux it's ELF: http://en.wikipedia.org/wiki/Executable_and_Linkable_Format

For Windows it's PE: http://en.wikipedia.org/wiki/Portable_Executable

Use the objdump tools to see the opcodes as others have pointed out

James
  • 9,064
  • 3
  • 31
  • 49
0

when you open a binary file you would see unreadable characters, the reason is that ascii encoding uses 7 bits , therefore all the characters that have a code point from 128 to 255 won't be recognized by the editor and therefore you see unknown characters.

if you want to see all the contents of a binary file , you could use programs like hexdump,objdump and readelf, for example lets say we want to dissect /bin/bash as a binary file in linux(elf) into its bytes in hexadecimal representation, so we say:

hexdump /bin/bash

but the best tool for these kind of files is: readelf

if we want to see all the contents of a binary file in a more human-readable format than the hexdump output we could just say:

readelf -a /bin/bash

and we would see all different sections of the binary file (elf header, program header , sections header and data).

also using other flags we could see only one header at a time, or we could just disassemble the .text sections in the file and so on.

Mgh Gh
  • 81
  • 4