蓝桥杯决赛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")
相关推荐
岁月宁静20 小时前
LangChain + LangGraph 实战:构建生产级多模态 WorkflowAgent 的完整指南
人工智能·python·agent
爱丽_20 小时前
深入理解 Java Socket 编程与线程池:从阻塞 I/O 到高并发处理
java·开发语言
多敲代码防脱发20 小时前
为何引入Spring-cloud以及远程调用(RestTemplate)
java·开发语言
第二只羽毛21 小时前
主题爬虫采集主题新闻信息
大数据·爬虫·python·网络爬虫
plmm烟酒僧21 小时前
TensorRT 推理 YOLO Demo 分享 (Python)
开发语言·python·yolo·tensorrt·runtime·推理
天才测试猿21 小时前
Postman中变量的使用详解
自动化测试·软件测试·python·测试工具·职场和发展·接口测试·postman
sailing-data21 小时前
【SE】接口标准化
java·开发语言
无名38721 小时前
RTPEngine 官方自带的 perl 测试程序
开发语言·perl·通信
帕巴啦21 小时前
Arcgis计算面要素的面积、周长、宽度、长度及最大直径
python·arcgis
fruge21 小时前
接口 Mock 工具对比:Mock.js、Easy Mock、Apifox 的使用场景与配置
开发语言·javascript·ecmascript