write-ups-challenges-2019-2020/call_me_maybe/call_me_maybe.c

40 lines
522 B
C
Raw Permalink Normal View History

2022-11-24 21:43:03 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printflag() {
printf("The flag is %s\n", getenv("IG_FLAG"));
fflush(stdout);
}
void login() {
char buffer[32];
printf("Enter the password: \n");
fflush(stdout);
gets(buffer);
if(strcmp(buffer, getenv("IG_PASSWORD")))
{
printf ("Wrong!\n");
fflush(stdout);
}
else
{
printf ("Correct!\n");
fflush(stdout);
printflag();
}
}
int main()
{
printf("Pointer to printflag is %p\n", printflag);
fflush(stdout);
login();
return 0;
}