蓝桥杯决赛2023 RE CyberChef2

思路很清晰,爆IV

但是题目出的有点屎,六位字符串,62的6次方,要我爆到猴年马月?

就当练习脚本吧

python 复制代码
#Cyber2 wp
from Crypto.Cipher import DES, AES  
from Crypto.Util.Padding import pad, unpad  
  
key_des = b'0a0b0c0d'  # DES key must be 8 bytes long  
#print(key_des)
cipher = bytes.fromhex("416935cabeb8e30cd9b56db3aa6778fa25ad5c3a5105d1c6aad4cba5f109f18afeaf5edcb8fd4e80aca82d75b42d751c40337f08df6c5231140b8c0b947362812df3dd5b5666447043240728a23da1da5cb4c7b197523b960106960cdcb6d48578667aae17caf1cb") 
#print(cipher)
import string
import itertools

table=string.ascii_letters+string.digits
#print(table)
for i in itertools.product(table,repeat = 6):
    x=''.join(i).encode()
    iv = "01" + x.decode()
    #print(iv)
    # Decryption  
    decipher_des = DES.new(key_des, DES.MODE_CBC, (str(iv).zfill(8)).encode('utf-8'))  
    decryptedtext_des = unpad(decipher_des.decrypt(cipher), DES.block_size)  
    #print(decryptedtext_des)
    key_aes = b'0102030405060708'  # AES key must be 16, 24, or 32 bytes long  
    cipher_aes = pad(decryptedtext_des, AES.block_size)
    # Note: You must also store the initialization vector (IV) for decryption  
    iv_aes = b'0807060504030201'
    # Decryption 
    decipher_aes = AES.new(key_aes, AES.MODE_CBC, iv=iv_aes)  
    decryptedtext_aes = pad(decipher_aes.decrypt(cipher_aes), AES.block_size)  
    if (decryptedtext_aes.startswith(b"flag{")) & (decryptedtext_aes.endswith(b"}")):  
        print(decryptedtext_aes)  
    else:  
        continue 

print("end")
相关推荐
想做富婆12 分钟前
python入门:简单介绍和python和pycharm软件安装/学习网址/pycharm设置(改成中文界面,主题,新建文件)
python·学习·pycharm
Start_Present12 分钟前
Pytorch 第十四回:神经网络编码器——变分自动编解码器
pytorch·python·深度学习·神经网络·数据分析
新知图书17 分钟前
第一个Qt开发的OpenCV程序
开发语言·qt
阿斌_bingyu70943 分钟前
Arduino开发物联网ESP32快速入门指南(包含开发语言说明、学习路径和实战教程)
开发语言·物联网·学习
Jwoka1 小时前
正则表达式学习笔记
笔记·python·正则表达式·re
移远通信1 小时前
智能硬件开发革命:低代码平台+物联网
python·物联网·低代码·智能硬件
这个懒人2 小时前
linux下io操作详细解析
开发语言·c++·io
亚林瓜子2 小时前
python的web框架flask(hello,world版)
python·flask·conda·web·python3
东方醴歌2 小时前
VMware安装飞牛私有云fnOS并挂载小雅Alist实现异地远程访问
开发语言·后端·golang
暗影~行星2 小时前
C语言,原码、补码、反码
c语言·开发语言