题目
You are working for a spy agency. Your got a USB thumb drive with a written label:
10107E0AE50ECB0000010107E0C0FFEE
There is only one file cipher.enc inside the USB.
一、分析
首先查看文件内容,cat cipher.enc
发现乱码不能正常显示,尝试使用二进制
with open('cipher.enc','rb') as file:
text = file.read()
print(text)
由于给定字符串"10107E0AE50ECB0000010107E0C0FFEE"是32位长度的十六进制数,转换为二进制后是128位长度,因为AES密钥通常是128位、192位或256位,首先尝试AES解密
二、解密
由于此处并未给出IV/Counter等信息,先尝试使用ECB
from Crypto.Cipher import AES
import binascii
with open('cipher.enc','rb') as file:
text = file.read()
print(text)
label = '10107E0AE50ECB0000010107E0C0FFEE'
key = binascii.unhexlify(label)
cipher = AES.new(key, AES.MODE_ECB)
try:
decrypted_text = cipher.decrypt(text)
except ValueError as e:
decrypted_text = f"Decryption error: {str(e)}"
print(decrypted_text)
得到FLAG