135 shaares
50 private links
50 private links
Some web challenges require executing /readflag
to get the flag. This executable will ask the user to compute some simple math. The timeout is very short, so the intended way to solve it is to write a script. However, there are better ways to solve it:
Solution 1: Trap the SIGALRM signal
$ trap "" 14 && /readflag
Solve the easy challenge first (((((-623343)+(913340))+(-511878))+(791102))-(956792))
input your answer: -387571
ok! here is your flag!!
Solution 2: mkfifo trick
$ mkfifo pipe
$ cat pipe | ./readflag |(read l;read l;echo "$(($l))" > pipe;cat)
input your answer:
ok! here is your flag!!
Ref: https://balsn.tw/ctf_writeup/20190427-*ctf/#solve_readflag-(not-a-challenge)