level00: done

level01: done
This commit is contained in:
0x35c
2025-05-05 17:59:07 +02:00
commit 74805a47ac
6 changed files with 87 additions and 0 deletions

38
level01/source.c Normal file
View File

@ -0,0 +1,38 @@
#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;
}