How can I dump the assembly of main function of binary(not striped) in ubuntu?
I want to see the assembly command and the hex value of this command
There are 1 binary for arm and 1 binary for x86
Reverse Engineering Stack Exchange is a question and answer site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation. It only takes a minute to sign up.Sign up to join this community
In your Ubuntu terminal, go to the directory where the file is located and type this:
objdump -M intel -D name-of-file | grep -A20 main.:
(assuming you want intel assembly since it's easier to read but if not, remove "-M intel" from the command above.)
This should show you the first twenty lines of your main function. objdump should skip a line after a function is over, so keep adding to the number after -A til you see the whole function followed by a blank line.
In order to view the assembly from any function of a compiled binary you will need a disassembler. There are many disassemblers that can be used for this function including:
IDA Pro (Commercial)
Ghidra (Open Source)
Radare2 (Open Source)
To use these tools you will usually just load the binary into the software and it will present you with the assembly representation of the binary using various algorithms such as Linear Sweep and Recursive traversal.
Alternatively you can always open the binaries within a hex editor and extract the OP codes from HEX. However the challenge would be to locate your target location in the binary.
Hope this helps!