Files

32 lines
529 B
C

#include <fcntl.h>
#include <unistd.h>
#define FLAG_PATH "/flag.txt"
void win(void) {
char flag[128];
int fd = open(FLAG_PATH, O_RDONLY);
if (fd < 0) {
write(1, "No flag here, contact the admins!\n", 34);
_exit(1);
}
ssize_t n = read(fd, flag, sizeof(flag));
if (n > 0) {
write(1, flag, n);
}
_exit(0);
}
int main(void) {
char name[64];
write(1, "What's your name?\n", 18);
read(0, name, 0x100);
write(1, "Nice to meet you!\n", 18);
return 0;
}