Semester Project
- Score:
- Description:
- Write a program with the following properties:
- Write a program, called
mission_impossible_5.c
, that accepts a user password first.
- If an input password is correct, the program will execute a piece of code,
called Mission Briefing Code (MBC) hereafter, that will display the following message
("Ethan Hunt, Run!") for 2 minutes and then delete the file
mission_impossible_5.c
and terminate itself.
- If an erroneous password is input, the program will delete the file
mission_impossible_5.c
and terminate itself.
- Initially, MBC must be stored in a global array and is encoded with your password. You can use
any approach to encode MBC. When the input password is correct, your program will decode MBC and
place it in the heap and then transfer your execution flow to the decoded MBC.
- Hint:
-
- You can write your MBC as a normal program first.
- Then compile the above program.
- Then use a tool, such as
objdump
, to find the corresponding machine code.
-
- You can use your password to XOR the MBC to encode it.
-
- You may need to use the library function
printf
to display message. Hence, in your MBC
you may need to know the address of function printf
. To simply the problem,
use static link to compile your program so that function printf
will be inside your
executable file and you can use a tool, such as objdump
, to find the address of the
function.
-
- When calling function
printf
, do not forget to prepare the stack segment correctly so that
function printf
can obtain its parameters.
- Project Submission:
- The due day of reports submission is 28th May.
- The demo will be held on 29th May, 30th May
1st June, and 2nd June.
- Contact the TAs to choose your demo time before 28th May.
- On site demo of this project is required.
- When demonstrating your projects, the TAs will ask you some questions regarding to your projects. Part of
your project grade is determined by your answers to the questions.
- You need to submit both an electronic version and a hard-copy of your project report to the TAs.
- The electronic versions could be sent to the TAs through e-mails.
- Do not forget writing the names and student IDs of all members in your team.
- Your report should contain:
- Your source code
- the execution results
- Late submission will NOT be accepted.