思路很清晰,爆IV
各种格式转换和删除padding非常麻烦,不过终于还是调出来了
#Cyber2 wp
from Crypto.Cipher import DES, AES
from Crypto.Util.Padding import pad, unpad
key_des = b'0a0b0c0d'
cipher = bytes.fromhex("416935cabeb8e30cd9b56db3aa6778fa25ad5c3a5105d1c6aad4cba5f109f18afeaf5edcb8fd4e80aca82d75b42d751c40337f08df6c5231140b8c0b947362812df3dd5b5666447043240728a23da1da5cb4c7b197523b960106960cdcb6d48578667aae17caf1cb")
#print(cipher)
import string
import itertools
table = string.digits
#print(table)
for i in itertools.product(table,repeat = 6):
x=''.join(i).encode()
iv_des = b"01" + x
#print(iv_des)
decipher_des = DES.new(key_des, DES.MODE_CBC, iv_des)
decrypted_text_des = unpad(decipher_des.decrypt(cipher), DES.block_size)
#print("DES Decrypted text:", decrypted_text_des)
try:
tmp1 = bytes.fromhex(decrypted_text_des.decode('utf-8'))
except:
continue
#print(tmp1)
key_aes = b'0102030405060708'
iv_aes = b'0807060504030201'
decipher_aes = AES.new(key_aes, AES.MODE_CBC, iv_aes)
decrypted_text_aes = decipher_aes.decrypt(tmp1), AES.block_size
flag = decrypted_text_aes[0]
#print("AES Decrypted text:", flag)
if flag.startswith(b'fla'):
print(flag)
print(iv_des)
else:
continue
print("end")
'''
b'flag{8a860a81-0370-42be-9b7d-78208c5d1f9c}\x06\x06\x06\x06\x06\x06'
b'01070309'
end
'''