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:
üÙ
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:
üÙ
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.
To see the disassembly (with opcode bytes) of the code only, not including any file headers:
objdump -d a.aot
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
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.
© 2022 - 2024 — McMap. All rights reserved.