在 CTF 中,隱寫術 (Steganography) 是 Forensics 中非常常見的題型之一。
它的核心精神是:將資訊藏在一個檔案裡,讓人乍看之下找不到在哪裡
stegsolve
, zsteg
, binwalk
, steghide
silenteye
snow
Wireshark
接下來,我們來看一題文字隱寫的題目~
這題給了一個檔案,直接打開他會發現內容是全白的
但我們用xxd
分析之後發現檔案中只有兩種文字,一種是e28083
也就是Unicode 的 EM SPACE,另一種是20
也就是ASCII 的 空白字元
我們可以將這兩種空白分別對應0跟1,將他轉換為二進位。然後再將二進位轉為ASCII!
聽起來有點麻煩,但我們可以用python來幫助我們快速解題~
def decode_file(filename):
with open(filename, 'rb') as f:
data = f.read()
i = 0
result = ''
while i < len(data):
if data[i:i+3] == b'\\xe2\\x80\\x83':
result += '0'
i += 3
elif data[i] == 0x20:
result += '1'
i += 1
return result
binary_str = decode_file('whitepages.txt')
print(f"二進位資料為:\n{binary_str}")
text = ''.join(chr(int(binary_str[i:i+8], 2)) for i in range(0, len(binary_str), 8))
print(f"\n轉換後文字內容:\n{text}")
這樣就得到flag啦~
以上就是今天隱寫術的內容,明天會講關於wireshark的使用!
想看更多,歡迎明天再來ㄛ~