加密邏輯
def encode(flag):
l1 = [chr(ord(a) - 10) for a in flag]
l1.reverse()
mid = ''.join(l1)
key = base64.b64encode(mid)
return key
key = 'YmVVJ2ReT2ZqZVVpWSY=='
逆向解密
import base64
def decode(value):
tmp_str = base64.b64decode(value) # 1. Base64 解碼
lists = list(tmp_str)
lists.reverse() # 2. 反轉列表
new_list = [chr(ord(x) + 10) for x in lists] # 3. 每字符 +10
return ''.join(new_list)
flag = decode('YmVVJ2ReT2ZqZVVpWSY==')
print(flag) # 輸出原始 flag
步驟解析
- Base64 解碼得到中間字符串。
- 反轉字符順序(抵消加密時的 reverse)。
- 每字符 ASCII 碼 +10(抵消加密時的 -10)。
- 拼接得原始 flag。