42_Override/level01/source.c
0x35c 74805a47ac level00: done
level01: done
2025-05-05 17:59:07 +02:00

39 lines
759 B
C

#include <stdbool.h>
#include <stdio.h>
#include <string.h>
char a_user_name[100];
bool verify_user_name(void)
{
puts("verifying username....\n");
return memcmp(a_user_name, "dat_wil", 7) != 0;
}
bool verify_user_pass(const char *password)
{
return memcmp(password, "admin", 5) != 0;
}
int main(void)
{
char password[64];
bool valid;
memset(password, 0, sizeof(password));
valid = false;
puts("********* ADMIN LOGIN PROMPT *********");
printf("Enter Username: ");
fgets(a_user_name, 256, stdin);
valid = verify_user_name();
if (valid) {
puts("nope, incorrect username...\n");
} else {
puts("Enter Password: ");
fgets(password, 100, stdin);
valid = verify_user_pass(password);
puts("nope, incorrect password...\n");
}
return 1;
}