題目連結
https://learn.cylabacademy.org/library/762
題目解法
將題目提供的原始碼下載後,可以看到第11行顯示當使用者輸入 1751 個
e時,就會印出 flag。app.py1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21while(True): try: print('⊹──────[ BYTEMANCY-1 ]──────⊹') print("☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐") print() print('Send me ASCII DECIMAL 101 1751 times, side-by-side, no space.') print() print("☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐") print('⊹─────────────⟡─────────────⊹') user_input = input('==> ') if user_input == "\x65"*1751: print(open("./flag.txt", "r").read()) break else: print("That wasn't it. I got: " + str(user_input)) print() print() print() except Exception as e: print(e) break直接輸入 1751 個
e當然可以獲得 flag,不過比起直接輸入,使用腳本可以更快速地完成。
以下是簡易使用 pwntools 的簡易 python 腳本。1 2 3 4 5 6 7 8 9 10from pwn import * # 連線(請替換成自己題目的網址和 port) r = remote('foggy-cliff.picoctf.net', 58509) # 送出 payload r.sendline(b'e' * 1751) # 直接進入互動模式,或是讀到結尾 print(r.recvall().decode())回傳的內容就會包含 flag 了。
⊹──────[ BYTEMANCY-1 ]──────⊹ ☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐ Send me ASCII DECIMAL 101 1751 times, side-by-side, no space. ☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐☉⟊☽☈⟁⧋⟡☍⟐ ⊹─────────────⟡─────────────⊹ ==> picoCTF{h0w------------------f00}