Skip to content

Instantly share code, notes, and snippets.

@0awawa0
Created April 6, 2021 06:25
Show Gist options
  • Save 0awawa0/479cc2662bb780215132f0a21f4df278 to your computer and use it in GitHub Desktop.
Save 0awawa0/479cc2662bb780215132f0a21f4df278 to your computer and use it in GitHub Desktop.
#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