http://ksnctf.sweetduet.info/problem/7
- 見るからにwhitespaceなので、以前作っていたwhitespaceのdebuggerで実行
PIN:
と聞かれる- 1を答えたときのstackの様子を見てみる
$ runkotlin whitespace.kt program.cpp true
S-S-STSTSSSSL # stack push 80
TL-SS # io print char from 80: P
S-S-STSSTSSTL # stack push 73
TL-SS # io print char from 73: I
S-S-STSSTTTSL # stack push 78
TL-SS # io print char from 78: N
S-S-SSTTTSTSL # stack push 58
TL-SS # io print char from 58: :
S-S-SSTSSSSSL # stack push 32
TL-SS # io print char from 32:
S-S-SL # stack push 0
TL-TT # io read number to heap[0]
1
S-S-SL # stack push 0
TT-T # heap stack push from heap[0]
S-S-SSSSSSSTTTTTTTSSTTTTSTTTSSSSSTSSL # stack push 33355524
TS-ST # arithmetic 1 - 33355524
L-TS-TL # flow if stack pop (-33355523) == 0 then jump to label T
S-S-STSSTTTSL # stack push 78
TL-SS # io print char from 78: N
S-S-STSSTTTTL # stack push 79
TL-SS # io print char from 79: O
L-LL # flow exit
33355524
ぽい- flag
$ runkotlin whitespace.kt program.cpp
PIN: 33355524
OK
FLAG_XXXXXXXXXXX
whitespaceのdebuggerをupしました。 whitespace.kt