#include #include void getFlag(); int main(int argc, char** argv) { struct { int answer; short _reserved; char buffer[9]; int correct; } data; data.correct = 42; setbuf(stdout, NULL); // turn off output buffering printf("What's the average weight of an Atlantic canary? "); fgets(data.buffer, 512, stdin); data.answer = atoi(data.buffer); if(data.answer != data.correct) { printf("Here's a hint: %lx\n", *(unsigned long*)(data.buffer + data.answer)); // ask again printf("What's average weight of an Atlantic canary? "); fgets(data.buffer, 512, stdin); data.answer = atoi(data.buffer); } if(data.answer == data.correct) { printf("How do you know so much about canaries?\n"); } return 0; } void getFlag() { if (getenv("TASK_NAME")) { printf("Success!\n"); system("python ctf.py success"); exit(0); } else { printf("Success!"); exit(0); } }