--- tags: CTF_Writeups, picoCTF, General Skills --- # mus1c * 提示 Do you think you can master rockstar? * 解題 這題很特別,乍看之下真的不知道要做什麼... 題目給了一個奇怪的歌詞檔案, 先將它下載下來,會得到 `lyrics.txt` 檔案: ``` Pico's a CTFFFFFFF my mind is waitin It's waitin Put my mind of Pico into This my flag is not found put This into my flag put my flag into Pico shout Pico shout Pico shout Pico My song's something put Pico into This Knock This down, down, down put This into CTF shout CTF my lyric is nothing Put This without my song into my lyric Knock my lyric down, down, down shout my lyric Put my lyric into This Put my song with This into my lyric Knock my lyric down shout my lyric Build my lyric up, up ,up shout my lyric shout Pico shout It Pico CTF is fun security is important Fun is fun Put security with fun into Pico CTF Build Fun up shout fun times Pico CTF put fun times Pico CTF into my song build it up shout it shout it build it up, up shout it shout Pico ``` 這是一段歌詞的樣子, 看了幾次後,可能是我看過許多不同的程式語言吧, 總覺得這可能是一種奇妙的語言或指令。 像是 `shout` 頻繁出現、 xxx `is` yyy 、 還有最可疑的 `put` xxx `into` yyy , 十足像是將某某變數放入某個值的感覺。 但這樣還是沒有頭緒,我們看看提示: **Do you think you can master rockstar?** 我將 rockstar 拿來搜尋 Google ,沒有什麼有用資訊, 然後再搜尋了 **master rockstar** , 果不其然這次就出現了一個網站: [rockstar:try it](https://codewithrockstar.com/online) ![](https://i.imgur.com/T8V4yFM.png) 中獎了!這看起來就像是翻譯機或是某種編譯器, 這次將歌詞貼到上面的大框,按下 Rock 看看: ![](https://i.imgur.com/X30ShEf.png) 下面的 output 出現了一串再熟悉不過的特殊數字, 觀察它們的數字都介在幾十到一百多之間, 十之八九是 ASCII code 了。 我們將除了 `Program completed in xxx ms` 以外的數字複製, 然後建立一個檔案例如 code.txt ,貼到裡面後存檔。 可以藉由 Python 轉換 ASCII code , 我們直接寫個 Python 程式 (ascii.py) : ```python= while True: try: a = chr(int(input())) # 轉成 int 後 chr 成字元 print(a, end='') except: break print() ``` 注意到我是直接用 input 讀取**標準輸入**,一般來說是鍵盤, 但也可以由重新導向從檔案讀取: ```shell $ python ascii.py < code.txt ``` 也就是從 code.txt 讀取那些數字, 然後這些資料會由 input() 讀取,最後轉成字元印出: ``` rrrocknrn0113r ``` 用 picoCTF{} 包起來: ``` picoCTF{rrrocknrn0113r} ```