Skip to content

Instantly share code, notes, and snippets.

@mskd12
Created April 5, 2017 08:53
Show Gist options
  • Save mskd12/88eaf74ce2ca983dea8ea0f6914009ca to your computer and use it in GitHub Desktop.
Save mskd12/88eaf74ce2ca983dea8ea0f6914009ca to your computer and use it in GitHub Desktop.
#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