Super Secret Password
Source Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum {false, true} bool;
static const char secretPass[] = "SuperSecureAndSuperSecretPassword!";
int flag()
{
system("/bin/cat flag.txt");
fflush(NULL);
}
bool password_match(char *pass)
{
// return true if password match
if (strncmp(pass, secretPass, strlen(secretPass)) == 0)
{
return true;
}
return false;
}
void authentigate()
{
printf("WELCOME TO THE A U T H E N T I G A T E\n");
printf("\n");
bool auth_enabled = false;
char pass[256];
printf("Enter the correct password to be allowed through the gate: \n");
fflush(NULL);
scanf("%s", &pass[0]);
if (!auth_enabled)
{
printf("Sorry, the AuthentiGate is closed, authentication is not currently enabled!\n");
fflush(NULL);
return;
}
if (password_match(&pass[0]))
{
printf("Congratulations! You have opened the AuthentiGate and here is your reward!\n");
flag();
}
else
{
printf("ERROR, INCORRECT PASSWORD!\n");
fflush(NULL);
}
}
int main()
{
setbuf(stdin, NULL);
setbuf(stdout, NULL);
authentigate();
return 0;
}Big brain solution




Small brain solution
Last updated