Lab5

 

Assembly assignment

A valid password consists of up to 7 characters and must contain one lowercase letter, at one uppercase letter, and one digit from 0-9. You are a security consultant for company XYZ. Your job is to assess the security of their password protected network. To enter their network, the user must pass the password checker. This is accomplished by calling a function and passing into the function a password string:

int check_password(char *passwd);

check_password returns a 7-digit integer of 0s and 1s to indicate which character was correct (0 to indicate a character was incorrect, 1 to indicate it is correct, and 2 to indicate it was not used). If the password entered is “aB2” and the passwd is “a11”, then check_password returns the integer 2222100. If passwd entered is “ab2”, then check_password returns the integer 2222101.

Your assignment is to write an assembly function “hack_password” that will find the secret password stored in “check_password” by iterating through all possible combinations of a-z, A-Z, and 0-9 according to password rule given above and calling the function check_password to determine when the return value is all 1’s and 2’s (e.g., 2211111, 1111111, 2222111, etc…). Note that the correct password decoder returns indicator that a character was not used as well. hack_password will print out the correct password.

You may write the main driver in C as follow:

int main()

{

hack_password();

return 0;

}

Tags: No tags