Quantcast
Channel: 记事本
Viewing all articles
Browse latest Browse all 122

fd

$
0
0

1分的题……

#include <stdio.h>#include <stdlib.h>#include <string.h>charbuf[32];intmain(intargc,char*argv[],char*envp[]){if(argc<2){printf("pass argv[1] a number\n");return0;}intfd=atoi(argv[1])-0x1234;intlen=0;len=read(fd,buf,32);if(!strcmp("LETMEWIN\n",buf)){printf("good job :)\n");system("/bin/cat flag");exit(0);}printf("learn about Linux file IO\n");return0;}

stdin是fd 0,0x12344660。所以

$ echo LETMEWIN | ./fd 4660

Viewing all articles
Browse latest Browse all 122

Trending Articles