- 题目
大牛在今年的hvv过程中,渗透进某业务系统,发现了密文,可是不知道如何解出明文,你能帮他找出来吗?
已知密文由两部分组成,后面的推测为秘钥
密文如下:
y3rmc2hvd3tjcnlwdg9fc2lnbmlux2lzx2vhc3l9-a0004008a0
- 分析
后面是密钥,先看一下长度
>>>print(len(bin(int('a0004008a0', 16))[2:]))
>>>40
再看一下密文的长度
>>>print(len("y3rmc2hvd3tjcnlwdg9fc2lnbmlux2lzx2vhc3l9"))
>>>40
打印密钥
>>>print(bin(int('a0004008a0', 16))[2:])
>>>1010000000000000010000000000100010100000
怀疑是密文按密钥相应位改变了大小写,脚本:
from base64 import b64decode as b64
key = bin(int('a0004008a0', 16))[2:]
c = "y3rmc2hvd3tjcnlwdg9fc2lnbmlux2lzx2vhc3l9"
for i in range(len(c)):
if key[i] == '1':
c = c[:i] + c[i].upper() + c[i + 1:]
flag = b64(c)
print(flag)
b'ctfshow{crypto_signin_is_easy}'