Created
April 6, 2021 06:25
-
-
Save 0awawa0/479cc2662bb780215132f0a21f4df278 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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int win(){ | |
char flag[128]; | |
FILE *file = fopen("flag.txt","r"); | |
if (!file) { | |
printf("Missing flag.txt. Contact an admin if you see this on remote."); | |
exit(1); | |
} | |
fgets(flag, 128, file); | |
puts(flag); | |
} | |
int vuln(){ | |
char password[64]; | |
puts("Enter the secret word: "); | |
gets(&password); | |
if(strcmp(password, "password123") == 0){ | |
puts("Logged in! The flag is somewhere else though..."); | |
} else { | |
puts("Login failed!"); | |
} | |
return 0; | |
} | |
int main(){ | |
setbuf(stdout, NULL); | |
setbuf(stderr, NULL); | |
vuln(); | |
// not so easy for you! | |
// win(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment