Proj 5: Using nasm, ld, objdump, and strace (10 pts.)

What You Need

A 32-bit x86 Kali Linux machine, real or virtual. The project was written on Kali 2.

Purpose

To practice using assembly language and several important tools

Creating a Hello Program in Assembler

In Kali, in a Terminal window, execute this command:

nano hello.asm
Enter the program shown below. You can omit the ";" characters and he text to the right of them--those are comments.

Save the file with Ctrl+X, Y, Enter.

Compiling, Linking, and Running

Execute these commands to compile, link, and run the program:

nasm -f elf hello.asm

ld -o hello hello.o

./hello
The program should run, printing "Hello World", as shown below. If you see error messages, you will need to correct errors in your source code.

Viewing Objects

Execute this commands view the objects in your executable file:

objdump -d ./hello
You should see the assembly code, including the two INT 80 calls outlined in the image below:

Saving a Screen Image

Make sure the "two INT 80 calls" are visible.

Press the PrintScrn key to copy the whole desktop to the clipboard.

YOU MUST SUBMIT A FULL-SCREEN IMAGE FOR FULL CREDIT!

Paste the image into Paint.

Save the document with the filename "YOUR NAME Proj 5", replacing "YOUR NAME" with your real name.

Turning in your Project

Email the image to cnit.127sam@gmail.com with the subject line: Proj 5 from YOUR NAME

Source

Sample nasm programs


Posted 8-31-15