--- tags: CTF_Writeups, picoCTF, General Skills --- # Bases * 解題 這題給了一串文字: `bDNhcm5fdGgzX3IwcDM1` 題目標題是 **bases** ,可以猜到這應該是 base64 編碼, 可以看看維基百科的說明: [base64](https://zh.wikipedia.org/wiki/Base64) 簡單來說 base64 是一串編碼, 用來將一串二進制資料轉成「可視字元」, 諸如網址、圖片等都能用 base64 轉換成一串編碼。 可以用 Python 中的 base64 套件來編碼與解碼, 此題要解碼,所以我們會用到其中的 b64decode() 函式, 解碼出來會是 `bytes` 型態,直接列印出來會是 `b'xxx'` 形式, 需要再調用 .decode() 方法轉成 `str` 型態: ```python= import base64 b = base64.b64decode('bDNhcm5fdGgzX3IwcDM1') print(b.decode()) ``` 畢竟 base64 本來就是從二進制資料轉換過來的, 解碼時也要先轉回二進制資料的 bytes 型態, 再藉由 .decode() 方法轉回字串。 結果: ```shell $ python bases.py l3arn_th3_r0p35 ``` 用 flag 格式包起來: picoCTF{l3arn_th3_r0p35}
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up