Installation
Install your favorite Virtual Machine like Virtual Box and a GNU/Linux like Kali. Extract the image and import the appliance.
Start the machine (or change the defaults if you have experience with that), and log in.
Example
Open a terminal, create a folder and use your favorite editor to create file.c.
//file.c
#include <stdio.h>
int main(void) {
printf("hello\nWorld\n\n");
return 0;
}
// build with gcc file.c output is a.out
Here is an image of the terminal.
We have a very simple program now.
Tools
First we can use the command file to determine the type of file we are dealing with. Next we can use Object Dump, objdump to look at the assembly.
We see gcc the GNU C Compiler produced an Executable and Linkable Format (ELF), which is an executable. Scroll to the contents and find .main.
Now run objdump -M intel -d a.out
So we see we have a command like push, move, call, pop, or return.
First we push rbp onto the stack. rbp is the register that holds the frame pointer. Move the stack pointer into the base pointer. lea now loads the effective address. We call printf (our print function), zero out eax, pop off the stack the base pointer and go about our way. Refer back to section 3 for additional details on the registers.
Samples
Now look through the Internet for simple C and C++ programs. Write programs to add, to subtract, etc. Disassemble and walk through each one until it is clear how the program is functioning.
There is also a much simpler way by using GCC with the -S parameter. This will create a file.s containing assembly. There is another important command as (for assembly) that can compile your assembly files.