Created
April 5, 2017 08:53
-
-
Save mskd12/88eaf74ce2ca983dea8ea0f6914009ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
int login() { | |
int accessLevel = 0xff; | |
char username[16]; | |
char password[32]; | |
printf("Username (max 15 characters): "); | |
gets(username); | |
printf("Password (max 31 characters): "); | |
gets(password); | |
printf("%d, %s, %s\n", accessLevel, username, password); | |
if (!strcmp(username, "admin") && !strcmp(password, "{{ create_long_password() }}")) { | |
accessLevel = 2; | |
} else if (!strcmp(username, "root") && !strcmp(password, "{{ create_long_password() }}")) { | |
accessLevel = 0; | |
} else if (!strcmp(username, "artist") && !strcmp(password, "my-password-is-secret")) { | |
accessLevel = 0x80; | |
} | |
return accessLevel; | |
} | |
int main() { | |
int access = login(); | |
printf("Your access level is: 0x%08x\n", access); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment