Question: Program in C Assignment overview You have been provided with a program called hackme . To successfully hack the program, you need to provide the

Program in C

Program in C Assignment overview You have been provided with a programcalled hackme . To successfully hack the program, you need to providethe correct password. A random password would be impossible to guess. Thankfully,you have a few clues to discover the password: - You know

Assignment overview You have been provided with a program called hackme . To successfully hack the program, you need to provide the correct password. A random password would be impossible to guess. Thankfully, you have a few clues to discover the password: - You know the password is definitely 12 characters in length - The password could contain any character in the range 33126 in ASCII - You have a function called checkPassword which can be used to discover the password. Unfortunately, it can only check 3 consecutive characters at a time. You supply a three character guess ( const char password) and the position in the password you want to check (int start). The function will return if the guess is correct, 1 if it is not correct. To discover the password, you will have to use brute-force to check every possible 12 character combination. You will do this by checking three characters at a time. Characters from position 0-2, position 3-5, position 6-8, and position 9-11. When your program finds a match, it should print the match to the screen. To make the discovery task faster, you will divide the task between 4 processes and you will demonstrate that forking accomplishes the task quicker. Purpose The goals of this assignment are the following: - Learn about process creation and control in Linux environment - Get experience with the fork(), execl(), getpid(), getppid() and system functions - Gain more experience with the C programming language from an OS perspective Computing platform You are welcome to develop your program on your own workstation if you wish, but you are responsible for ensuring that your program compiles and runs without error on the Gaul computing platform. Marks will be deducted if your program fails to compile, or your program runs into errors on Gaul. - https://wiki.sci.uwo.ca/sts/computer-science/gaul Instructions Attached to this assignment is a tarball with the following files in it. None of these files should be modified: checkPassword.hcheckPassword.ohackmeMakefilerun-assignment.sh&..AheaderfilecontainingtheprototypeforcheckPassword()&TheobjectfileforcheckPassword().Makerequiresthis&Theprogramyouneedtohack!&Apre-packagedMakefile.Thistellsyouhowyourprogramshouldbestructured&.Ashellscriptthatwillautomaticallyrunyourprogram Download this tarball and upload it to Gaul. Extract the tarball (tar - xvf Assignment-1.tar). Change to the directory. You will write a program called assignment-1.c. This program: - Can accept an optional command-line argument -f to signify that forking should be enabled or not. - Can accept an optional command-line argument -p to signify that the parent process should automatically run - If forking is not requested, it will check characters 02,35,68, and 911 in that order. - If forking is requested - The parent (1.0) will check characters 0-2, then wait on child 1 and child 2 to finish - Child 1 (1.2) will check characters 3-5 - Child 2 (1.1) will check characters 68, then wait on Child 3 to finish - Child 3 (1.1.1) will check characters 9-11 - Your program should print PIDs of all parent and child processes - If running hackme automatically is not requested, simply return 0 - if running hackme automatically is requested, wait for all child processes if necessary, then run hackme - When three characters of the password are found, just print them to the screen. In the case of forking, this means the password will probably be printed out of order. This is okay because some processes will find their part of the password faster than others. The point is speed. The order you can figure out manually. Output Assuming the password was abcdef123456, Executing ./assignment-1 should produce the following output: abcdef123456 Executing ./assignment-1 - fp should produce the following output (356... is the pid using getpid() and getppid()): and ./run-assignment.sh 1 should produce the following output: ASSIGNMENT 1 STARTED - DOW MOn \#\# \#\#:\#\#: \#\#\# AM/PM EST 2023 Cleaning environment rmf assignment-1.0 assignment-1 Checking environment Assignment 1 (without forking) assignment-1, 5032 abc def 123 456 104 Seconds Assignment 1 (with forking) PID 1.0 IS 356930 . CHILD 1.1 IS 356932 PID 1.1 IS 356932 . PPID IS 1.356930 PID 1. IS 356930 . CHILD 1.2 IS 356933 PID 1.1 IS 356932 . CHILD 1.1.1 IS 356934 PID 1.1.1 IS 356934 . PPID 1.1 IS 356932 PID 1.2 IS 356933. PPID 1.0 IS 356930 assignment 1,356930f -assignment-1,356932 -f assignment-1,356934 -f Lassignment-1,356933 -f def 456 123 abc 43 Seconds Enter your guess: abcdef123456 Trying: abcdef123456 Please enter a password: ACCESS GRANTEDI Cleaning environment rmf assignment-1.0 assignment-1 ASSIGNMENT 1 COMPLETED - DOW MOn \#\# \#\#:\#\#:\#\# AM/PM EST 2023 Helpful hints - If you cannot remember how to read command-line arguments in C, see https://www.tutorialspoint.com/cprogramming/c command line arguments.htm - To use the checkPassword function 1. make sure you \#include "checkPassword.h" in your source file 2. make sure you include the checkPassword.o object file when you compile. This can be done one of two ways: 1. gcc checkPassword.o assignment-1.c 2. Use the Makefile by issuing the command make 1. The make command will read the Makefile and execute the rule it finds first ( make default) which will in turn run the all rule

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!