--- tags: CTF_Writeups, picoCTF, General Skills --- # Nice netcat... * 解題 題目要求先使用 [nc](https://zh.wikipedia.org/zh-tw/Netcat) 工具連上一個伺服器上的程式: ```shell $ nc mercury.picoctf.net 7449 ``` 並且題目說該程式不會說英文,這是什麼意思? 我們先連上去就知道了: ``` 112 105 99 111 67 84 70 123 103 48 48 100 95 107 49 116 116 121 33 95 110 49 99 51 95 107 49 116 116 121 33 95 102 50 100 55 99 97 102 97 125 10 ``` 結果程式跑出一堆數字,如果稍微寫過程式可能就會有點感覺, 這些數字八成是 [ASCII code](https://zh.wikipedia.org/zh-tw/ASCII) ,我們可以寫一個 Python 程式將它們轉為字母: ```python= # nice_nc.py while True: try: n = int(input()) print(chr(n), end='') except: print() break ``` ```shell $ nc mercury.picoctf.net 7449 | python nice_nc.py ``` 我們連上該伺服器後,用 linux 的管線將輸出當作 python 程式的輸入,直接轉換成字母並印出來: ``` picoCTF{g00d_k1tty!_n1c3_k1tty!_f2d7cafa} ```