some more playlist stuff
This commit is contained in:
BIN
mochis_tale/binary_exploitation/local_target/local-target
Executable file
BIN
mochis_tale/binary_exploitation/local_target/local-target
Executable file
Binary file not shown.
50
mochis_tale/binary_exploitation/local_target/local-target.c
Executable file
50
mochis_tale/binary_exploitation/local_target/local-target.c
Executable file
@@ -0,0 +1,50 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
int main(){
|
||||
FILE *fptr;
|
||||
char c;
|
||||
|
||||
char input[16];
|
||||
int num = 64;
|
||||
|
||||
printf("Enter a string: ");
|
||||
fflush(stdout);
|
||||
gets(input);
|
||||
printf("\n");
|
||||
|
||||
printf("num is %d\n", num);
|
||||
fflush(stdout);
|
||||
|
||||
if( num == 65 ){
|
||||
printf("You win!\n");
|
||||
fflush(stdout);
|
||||
// Open file
|
||||
fptr = fopen("flag.txt", "r");
|
||||
if (fptr == NULL)
|
||||
{
|
||||
printf("Cannot open file.\n");
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Read contents from file
|
||||
c = fgetc(fptr);
|
||||
while (c != EOF)
|
||||
{
|
||||
printf ("%c", c);
|
||||
c = fgetc(fptr);
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
fclose(fptr);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
printf("Bye!\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
Reference in New Issue
Block a user