蓝桥杯决赛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")
相关推荐
zwjapple几秒前
React + Java 技术面试完整指南
java·开发语言·jvm·react
秋邱8 分钟前
Java匿名内部类的使用场景:从语法本质到实战优化全解析
android·java·开发语言·数据库·python
kimi-2229 分钟前
Transformer 模型中位置编码(Positional Encoding, PE)
pytorch·python·transformer
不会c嘎嘎9 分钟前
QT中的常用控件(一)
开发语言·qt
程序员阿鹏11 分钟前
RabbitMQ持久化到磁盘中有个节点断掉了怎么办?
java·开发语言·分布式·后端·spring·缓存·rabbitmq
资生算法程序员_畅想家_剑魔12 分钟前
Java常见技术分享-20-多线程安全-进阶模块-并发集合与线程池-ThreadPoolExecutor
java·开发语言
reasonsummer14 分钟前
【教学类-89-02】20251229新年篇11—— 马年红包(Python图片)
python·通义万相
Mqh18076215 分钟前
day53 预训练模型CBAM注意力
python
程序员佳佳15 分钟前
【硬核实测】GPT-5.2-Pro 对决 Gemini-3-Pro (Banana Pro):开发者如何低成本接入下一代 AI 模型?附 Python 源码
人工智能·python·gpt·chatgpt·ai作画·midjourney·ai编程
lsx20240620 分钟前
CSS 列表
开发语言