MRCTF2020:千层套路

附件给个压缩包,什么都没说,先尝试爆破(从四位数开始爆破)

解压完了发现里面还是一个压缩包,这个密码也是似曾相识,就是文件名,,到这里明白了千层套路的意思,估计是要上脚本了

复制代码
import os
import zipfile


def extract_and_store_final_file(initial_zip_path, target_dir):
    if not os.path.exists(target_dir):
        os.makedirs(target_dir)

    current_zip_path = initial_zip_path

    password = os.path.basename(initial_zip_path)[:4]

    while True:
        with zipfile.ZipFile(current_zip_path, 'r') as zip_ref:
            files = zip_ref.namelist()
            file_name = files[0]
            next_zip_name = os.path.join(target_dir, file_name)
            try:
                zip_ref.extractall(target_dir, pwd=bytes(password, 'utf-8'))
                print(f"Extracted {file_name} to {target_dir} using password {password}")
            except RuntimeError as e:
                print(f"Error extracting {file_name}: {e}")
                break

            if file_name.endswith('.zip'):
                current_zip_path = next_zip_name
                password = file_name[:4]
            else:

                print(f"The final file is {file_name}, stored in {target_dir}")
                break



initial_zip_path = '0573.zip'
target_dir = 'flag'
extract_and_store_final_file(initial_zip_path, target_dir)

脚本提取文件名的前四位作为密码,然后将解压后的文件都放进名为flag的文件夹中,直到解压出的文件后缀不是zip为止

看见了一个qr.zip文件解压看一眼

看着像是RGB数据串,随波逐流转图片,当然也可以使用脚本

转换完成后给了个二维码,扫一下就出来了

MRCTF{ta01uyout1nreet1n0usandtimes}

相关推荐
databook1 小时前
Manim实现闪光轨迹特效
后端·python·动效
Juchecar2 小时前
解惑:NumPy 中 ndarray.ndim 到底是什么?
python
用户8356290780512 小时前
Python 删除 Excel 工作表中的空白行列
后端·python
Json_2 小时前
使用python-fastApi框架开发一个学校宿舍管理系统-前后端分离项目
后端·python·fastapi
支付宝体验科技3 小时前
AI4SDL:支付宝业务应用研发安全保障体系建设实践
安全
没逻辑9 小时前
Post-Quantum HTTPS:未来的安全通信架构
后端·安全
数据智能老司机9 小时前
精通 Python 设计模式——分布式系统模式
python·设计模式·架构
数据智能老司机10 小时前
精通 Python 设计模式——并发与异步模式
python·设计模式·编程语言
数据智能老司机10 小时前
精通 Python 设计模式——测试模式
python·设计模式·架构
数据智能老司机10 小时前
精通 Python 设计模式——性能模式
python·设计模式·架构