40 lines
522 B
C
40 lines
522 B
C
|
#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;
|
||
|
}
|